The Epstein zeta function
The Epstein zeta function of the lattice with shifts and is
the prime omitting , continued meromorphically from (see acb_mzeta for the conventions and the regularised function). All algorithms in FLINT start from Crandall's representation [BBG2024], which splits into two rapidly converging sums over and the dual lattice whose terms are incomplete gamma functions. They differ in how these sums are evaluated: term by term in ball arithmetic, in double-precision ball arithmetic, as Mellin integrals of theta functions, or, for rational lattices, by shells of equal norm. Throughout, and
Reductions#
The basis is first LLL-reduced [LLL1982] through its Gram matrix (arb_mat_spd_lll_reduce), which leaves unchanged and makes the Cholesky factors of the quadratic forms well conditioned. Writing and with and near zero,
by the substitution and periodicity in . A shift whose ball contains a lattice point without being exactly that point gives an indeterminate result, since is discontinuous (or singular) there.
Crandall's representation#
Theorem 1 ([BBG2024, Thm. 2.11]). For and ,
where the primes omit and and is 1 if the condition holds and 0 otherwise.
Proof. For , write and split the integral at . The part over gives the first sum. In the part over , Poisson summation over turns into , and gives the second sum. The sum over in the Poisson formula includes if , whose contribution is subtracted, and the term , if , is . Since is entire in for and is entire, the right-hand side continues to all .
FLINT takes , which balances the two sums. With the upper triangular Cholesky factors of and of , the arguments are and for . For the regularised function, the term of itself is replaced by , , which removes ; at this is the singular term.
Truncation#
Lemma 2. For , .
Proof. for (as ), so .
Theorem 3 (Tail of the Crandall sums). For and any shift ,
Proof. By Lemma 2 each term is at most , and the sum of over the points outside the ellipsoid is bounded by the theta tail bound Theorem 1 of Theta functions with .
is the smallest value making the bound at most for the target precision , so , and the lattice points of both ellipsoids number .
The scaled incomplete gamma function#
The sums need at many real with one , each to a relative accuracy of its own (tapered by the size of the term), so _acb_mzeta_gamma_upper_scaled chooses the method and the working precision itself:
- Asymptotic series. and Taylor's theorem with the integral remainder for give with for (then ). It is used when the smallest term reaches the tolerance, that is for of the order of the precision or larger.
- Convergent series. , whose cancellation (about bits, more near the poles of ) is compensated by raising the working precision by an estimate of the loss. For real with a short dyadic value (the usual case, or for a dyadic ) the sum is computed by rectangular splitting (
_arb_hypgeom_gamma_lower_sum_rs_1), with no division per term; it is stopped at an with , after which the ratios of consecutive terms are at most , so the tail is at most twice the first omitted term. - Nonpositive integers : with , a series of positive terms.
A ball is evaluated at its midpoint and the radius is propagated with at the lower endpoint , which avoids the amplification of the radius by about that the series would cause.
Term-by-term summation#
acb_mzeta_epstein_crandall evaluates both sums of Theorem 1 in ball arithmetic. The points of the ellipsoids are enumerated with acb_theta_eld_set. If the Gram matrix is exact, the quadratic form is exact and the points are grouped by its value, so that is evaluated once per shell; are paired when the center is a lattice point. Each value is computed at a precision tapered by its magnitude . The cost is incomplete gamma values.
Double-precision balls#
At precisions up to 95 bits and for real , acb_mzeta_epstein_crandall_dfloat evaluates the same sums with dfloat balls of one or two doubles. The lattice points are enumerated line by line (Fincke–Pohst [FP1985], the coordinate varying along a line) in outward-rounded double interval arithmetic on enclosures of and the shift, so that no point with is missed (extra points are harmless), and processed in batches with the vector operations of gr: per line the partial quadratic forms and phase offsets, per point , (_gr_vec_exp), the factor from a table, the phase reduced modulo 1 exactly, and (_gr_vec_sin_cos), and two dot products. Dyadic phases come from an exact table of indexed by an integer computation of . Points with (very close to the shift) are evaluated with _acb_mzeta_gamma_upper_scaled.
Tables of . satisfies , so its Taylor coefficients at obey
The table holds Taylor polynomials of degree 28 (resp. 15 for one double) on intervals with centers decreasing geometrically from to , built once per and kept in the cache.
Lemma 4 (Coefficient bounds). With and , . For and any , with .
Proof. and give the first bound. For the second, is analytic for with , , and Cauchy's inequality on the circle of radius applies.
The first bound is used with when , the second with otherwise; either gives the truncation error of the polynomial on the interval. The values at the centers are propagated downward from one evaluation at the top, by evaluating the series of the previous center (of degree 60, resp. 32) at the step . Downward is the stable direction: the homogeneous solution decreases relative to .
Proposition 5 (Propagated error). If the midpoint of is off by , the coefficients computed from it are those of plus times those of , and the value at the next center is off by at most
for a polynomial of degree , plus the truncation error of .
Proof. The recurrence is linear and solves its homogeneous version, so the computed series is truncated at degree . The truncation of is minus its tail; the coefficients of are majorized by those of , which is bounded by on , so by Cauchy's inequality the tail is at most . So the propagated error follows the homogeneous solution, , and its size relative to decreases with ; bounding by the majorant instead would multiply the error by more than at every step.
Within an interval, bounds the effect of , and the polynomial is evaluated by Horner's rule in plain double or double-double arithmetic with the a priori bound times the unit roundoff of a step ( with fused multiply-add, for double-double, with the terms of degree at least 14 summed in plain double and bounded separately). Together these give an absolute bound for the value and for the derivative on each interval, from which a ball input gets its radius.
Mellin integrals of theta functions#
With the matrix of one of the two quadratic forms, its shift, and phases , each Crandall sum is
by the integral form of (the sums converge absolutely for ), and the full sum over is a Riemann theta function,
evaluated with acb_theta_one in quasi-linear time; the excluded points are subtracted. acb_mzeta_epstein_theta computes the integral by Gauss–Legendre quadrature in : the integrand is analytic for , where .
Lemma 6 (Bounds for the theta series). For and the Cholesky factor of ,
for and a lower bound of the of the points that are not excluded. If , then .
Proof. with . Summing over first, with the other coordinates fixed, the terms form a unimodal sequence, whose sum is at most its maximum (at most 1) plus the integral ; repeating for gives . For the second bound, for . Finally .
The interval is covered by intervals of half-length . On the Bernstein ellipse of an interval with center and semi-minor axis below , and , so Lemma 6 bounds by some , and nodes have error at most (Theorem 1 of Rigorous numerical integration). For the tail, for and , , give
The node counts taper with these bounds from interval to interval, and the nodes are shared between the intervals and the two sums: a degree already computed is reused when it is at most above the one required. Nodes come from arb_hypgeom_legendre_p_ui_root, half of them by symmetry.
Direct sums for large . For large the series has few terms of any size. The points with are enumerated once per sum, with their and phases; then
since for . A node uses the direct sum when the needed for its accuracy is at most , and is chosen so that at most points are stored, about where one real exponential per point stops being cheaper than a theta value. This replaces the reduction and the quasi-linear algorithm of acb_theta_one on most nodes of the upper intervals.
Working precision. The value of a node is needed to an absolute accuracy of about . With , is needed to absolute accuracy . A direct sum has relative accuracy and needs about bits, which decreases rapidly for large ; acb_theta_one has absolute accuracy (relative to ), so a theta value needs bits.
The cost is about integrand values per sum, independent of the lattice points of the truncated Crandall sums, so the method wins at high precision: measured crossovers against term-by-term summation are about 700 bits in dimension 3, 400 bits in dimension 4 and 220 bits in dimension 5; in dimension 2 the two break even at about 4000 bits.
Sums by shells#
For an integral positive definite Gram matrix (the lattice Gram matrix being ) and rational , , the function , , is computed by acb_mzeta_epstein_gram_shell. The same Mellin splitting as in Theorem 1, at a free parameter , gives
with singular terms if and if .
Shells. On each side the values of the integral quadratic form at the shifted points, with for the common denominator of the shift , are with integers , the gcd of all differences (computed from the values at and the cross terms ). The points are counted by shell and by the residue of the linear character, so that each side is : one incomplete gamma value per shell instead of one per point.
Choice of . is chosen so that the arguments on one side are with a dyadic . There the values at exact rationals come from binary splitting (the asymptotic series or the series at 0, _arb_hypgeom_gamma_upper_fmpq_inf_bsplit_sum and _arb_hypgeom_gamma_lower_fmpq_0_bsplit_sum, or the convergent series for ). The arguments on the other side are irrational. If its index is a positive integer (the Coulomb potential , and even ), then , and that side is a sum of power series in with rational coefficients . These are summed by rectangular splitting with one shared fixed-point table of powers of , read once per block for the sums over all residues and powers; the denominators are cleared in chunks whose integer multipliers fit in one or two limbs, each chunk is divided once, and the divisions of several chunks are interleaved [GraMol2010]. Otherwise each value on that side is computed below 16384 bits as in The scaled incomplete gamma function, which is faster there, and above by a bit-burst step, whose cost grows more slowly with the precision: binary splitting at a dyadic of about bits near , then the Taylor series in with coefficients from the differential equation ,
and the bound for from the integral form of , so that the tail after degree is at most its first term over , . balances the costs: about incomplete gamma values on the binary splitting side against about terms on the other.
Both sides are truncated with Theorem 3. The sums are split into tasks for flint_parallel_do and accumulated with an order-independent fixed-point accumulator: every contribution is rounded to the grid on its own and added as an exact integer, with the radius in whole ulps, so the result does not depend on the number of threads.
Counts. The integral form is first divided by the content of its entries. The counts come from interchangeable methods, each of which recognises the forms it applies to and estimates its cost; the cheapest applicable one is used (estimates independent of the number of threads, so that the choice, and hence the result, is too), and the sums read the counts block by block.
Products of theta series. is split into mutually -orthogonal sublattices of rank 2 (and one of rank 1 for odd ), with bases from an LLL-reduced basis and the integral kernels of the previous blocks, so that has finite index. On a coset , with , and , the points have
and is an integer for the common denominator of the . So the generating function of a coset is the product of the series of the blocks, each enumerated directly in linear time (a rank-2 block has about as many points as exponents). The products run in by Kronecker substitution with
nmod_polyarithmetic modulo a prime just above a bound for every count. The exponents of a block on a coset lie in one class modulo a common step , so the series are taken in ; among the choices of the first block the one with the least total series length is used.- Enumeration. Fincke–Pohst enumeration with exact integer values, for any form.
- Sums of three squares. For and characters of order at most 2, the counts are streamed from without a table of all shells: for integral shifts, and for the shift with trivial character , . The coefficients (from and ) come from a segmented divisor sieve over , since and have the same character, and fit in 2 bytes; then needs one sparse convolution with per block, or one FFT for short sums.
The Madelung constant#
The Madelung constant of sodium chloride is , computed by the shell algorithm. With the splitting is Crandall's expansion [Cra1999, eq. (1.2)]
The first sum has terms, each an incomplete gamma value at an exact integer by binary splitting; the second is a power series in with terms, whose coefficients come from the sieve. Both cost about up to logarithmic factors, and balances them.
Use in FLINT#
acb_mzeta_epsteinandacb_mzeta_epstein_genericchoose between the algorithms below.acb_mzeta_epstein_crandall: term-by-term summation.acb_mzeta_epstein_crandall_dfloat: double-precision balls.acb_mzeta_epstein_theta: Mellin integrals of theta functions.acb_mzeta_epstein_shell,acb_mzeta_epstein_gram_shell,acb_mzeta_madelung_nacl: sums by shells._acb_mzeta_gamma_upper_scaled: the scaled incomplete gamma function.
Referenced from#
References#
- [BBG2024] A. A. Buchheit, J. K. Busse and R. Gutendorf, "Computation and properties of the Epstein zeta function with high-performance implementation in EpsteinLib", preprint (2024), https://arxiv.org/abs/2412.16317
- [LLL1982] A. K. Lenstra, H. W. Lenstra, Jr. and L. Lovász, "Factoring polynomials with rational coefficients", Mathematische Annalen 261 (1982), 515–534. https://doi.org/10.1007/BF01457454
- [FP1985] U. Fincke and M. Pohst, "Improved methods for calculating vectors of short length in a lattice, including a complexity analysis", Mathematics of Computation 44 (1985), 463-471, https://doi.org/10.1090/S0025-5718-1985-0777278-8
- [GraMol2010] N. Möller and T. Granlund, "Improved division by invariant integers", IEEE Transactions on Computers 60 (2011), 165–175, https://gmplib.org/~tege/division-paper.pdf
- [Cra1999] R. E. Crandall, "New representations for the Madelung constant", Experimental Mathematics 8 (1999), 367-379
The FLINT team, “The Epstein zeta function,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/special-functions/epstein.html (generated 2026-11-07).
@misc{flint-doc-algorithms-special-functions-epstein,
author = {{The FLINT team}},
title = {{The Epstein zeta function}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/special-functions/epstein.html},
note = {Generated 2026-11-07}
}