A Fast and Accurate Analytic Method of Calculating Galaxy Two-point
  Correlation Functions
  We have developed a new analytic method to calculate the galaxy two-point
correlation functions (TPCFs) accurately and efficiently, applicable to surveys
with finite, regular, and mask-free geometries. We have derived simple,
accurate formulas of the normalized random-random pair counts $RR$ as functions
of the survey area dimensions. We have also suggested algorithms to compute the
normalized data-random pair counts $DR$ analytically. With all edge corrections
fully accounted for analytically, our method computes $RR$ and $DR$ with
perfect accuracy and zero variance in $O(1)$ and $O(N_{\rm g})$ time,
respectively. We test our method on a galaxy catalogue from the EAGLE
simulation. Our method calculates $RR+DR$ at a speed 3 to 6 orders of magnitude
faster than the brute-force Monte Carlo method and 2.5 orders of magnitude
faster than tree-based algorithms. For a galaxy catalogue with 10 million data
points in a cube, this reduces the computation time to under 1 minute on a
laptop. Our analytic method is favored over the traditional Monte Carlo method
whenever applicable. Some applications in the study of correlation functions
and power spectra in cosmological simulations and galaxy surveys are discussed.
However, we recognize that its applicability is very limited for realistic
surveys with masks, irregular shapes, and/or weighted patterns.
