Theta functions
- Cost
- After reduction, summation needs terms at precision in genus (genus 1: ); the quasi-linear algorithm of Quasi-linear evaluation of theta functions needs for fixed .
In genus , for in the Siegel upper half-space (symmetric complex matrices with positive definite imaginary part ), and characteristics ,
For these are the four Jacobi theta functions: , , and . FLINT evaluates them in two steps: an action of the modular group moves to a reduced point, where the series converges quickly and uniformly, and the theta values at the reduced point are computed either by summing the series (described below) or by the quasi-linear algorithm based on duplication formulas (Quasi-linear evaluation of theta functions). The general references are [Mum1983] and [Igu1972]; the algorithms of acb_theta are those of Elkies and Kieffer [EK2025].
Size of the terms#
Writing and , the term of index has absolute value
Hence the terms decrease like a Gaussian centered at , , and, barring cancellation, where is the distance from to . The normalised function is bounded, and FLINT measures precision in terms of its absolute error (Precision).
Reduction#
The symplectic group acts on by , and the theta transformation formula [Igu1972, p. 176]
relates the theta values at and at , with an explicit permutation of characteristics, an 8th root of unity, and a square root of whose branch must be tracked (acb_siegel_kappa). The group is generated by the block-diagonal matrices (a change of basis of the lattice), the trigonal matrices (integer translations of ), and .
A matrix is reduced (Siegel's fundamental domain, in a relaxed form) if
- is reduced (FLINT uses LLL reduction with parameters , as a practical substitute for Minkowski reduction);
- for all ;
- for a finite set of fundamental symplectic matrices.
For this is the usual fundamental domain , , where the only fundamental matrix is . For , Gottschling [Got1959] found the 19 matrices that define the boundary of the fundamental domain. For no such list is known, and FLINT uses the matrices obtained by embedding the genus 2 matrices on pairs of coordinates and the embeddings of on subsets of coordinates (sp2gz_fundamental). acb_siegel_reduce alternates the three reductions until no fundamental matrix increases ; in exact arithmetic, increases strictly with each such step and is bounded on an orbit, so the iteration terminates. For reduced , the diagonal entries of the Cholesky factor of are bounded below by a constant depending only on (for , ).
The vector is then reduced by the quasi-periodicity in the lattice : subtracting with multiplies every by an explicit exponential, and choosing close to and close to makes and bounded (acb_theta_reduce_z).
Summation over ellipsoids#
After reduction, is approximated by the sum over the lattice points with , an ellipsoid; the shift by is handled by . Write with upper triangular with positive diagonal entries .
Theorem 1 (Tail bound [EK2025]). For every and ,
The factors account for the spacing of the lattice points along the successive coordinates of the triangular basis, and is the order of the Gaussian integral over the outside of a ball of radius ; see [EK2025] for the proof. Weighted versions with bound the tails of the differentiated series. acb_theta_sum_radius solves for , so that , and acb_theta_sum_jet_radius adapts the radius to derivatives.
Ellipsoids. The lattice points with are enumerated recursively on the last coordinate: for fixed the allowed values of form an interval, computed from the triangular structure of , and each value has a child ellipsoid of dimension (acb_theta_eld_set). This uses memory for points, an approach also used by [DHBHS2004]. When several vectors differ by small amounts, one ellipsoid with a union of centers serves all of them.
Summation. The terms are summed line by line: on a line with fixed , the terms are for , where and the cofactor depend on the fixed coordinates and are obtained from those of neighbouring lines by a few multiplications. The powers are computed once for the ellipsoid, the powers by repeated multiplication, and each line is summed with one dot product (acb_dot), so that fewer than two complex multiplications are needed per lattice point on average. Terms far from the center are small and are computed at a lower precision. With and bounded below, the ellipsoid contains points, so summation costs for fixed ; it is the method of choice at low precision and the base case of the quasi-linear algorithm, where it is applied at with points.
Derivatives. Differentiating the series multiplies the term of index by ; the summation workers accumulate these products (acb_theta_sum_jet), and the tail bound includes the polynomial weight.
Genus 1#
For , acb_modular_theta_sum sums the four Jacobi series together. With and ,
and similarly for and with alternating signs. The exponents of , interleaved, are , , that is , and the exponents of are . The powers of are computed with a short addition sequence for this set of exponents [EHJ2016], in which most powers cost one multiplication, and only even powers of and are needed when the odd terms are written as .
Lemma 2 (Truncation bound for genus 1). Let , , and stop the summation before the term of index . With and , the error of each of the four series, and of its -th derivative with respect to , is at most
provided that the denominator is positive.
Proof. The term of index (in whichever series it belongs to) is bounded by with , where the factor 2 accounts for , and the omitted terms of each series are among those with . Since for , the bounds of consecutive terms decrease at least by the ratio . Differentiating times with respect to multiplies the term of index by at most , and . Summing the geometric series gives the bound.
acb_modular_theta_sum chooses the smallest with , which is ; after reduction (to ), , so , and has been reduced so that is bounded. acb_theta_sum calls it for , and the theta constants alone () use the specialised acb_modular_theta_const_sum, with rectangular splitting for many terms.
Use in FLINT#
acb_modular_theta,acb_modular_theta_jet,acb_modular_theta_sum,acb_modular_theta_const_sum,acb_modular_addseq_theta,acb_modular_theta_transform(acb_modular): genus 1.acb_siegel_reduce,acb_siegel_is_reduced,sp2gz_fundamental,acb_theta_reduce_tau,acb_theta_reduce_z,acb_siegel_kappa,acb_theta_char_table(acb_theta): reduction and the transformation formula.acb_theta_eld_set,acb_theta_sum_radius,acb_theta_sum_jet_radius,acb_theta_sum,acb_theta_sum_jet,acb_theta_sum_work: summation.acb_theta_jet,acb_theta_one,acb_theta_all: the main functions, which use summation or the quasi-linear algorithm.
Referenced from#
References#
- [Mum1983] D. Mumford, Tata Lectures on Theta I, Birkhäuser, 1983. https://doi.org/10.1007/978-1-4899-2843-6
- [Igu1972] J.-I. Igusa. Theta functions, Springer, 1972. https://doi.org/10.1007/978-3-642-65315-5
- [EK2025] N. D. Elkies and J. Kieffer, "A uniform quasi-linear time algorithm for evaluating theta functions in any dimension", in preparation.
- [Got1959] E. Gottschling, "Explizite Bestimmung der Randflächen es Fundamentalbereiches der Modulgruppe zweiten Grades'', Math. Annalen 138 (1959), 103–124. https://doi.org/10.1007/BF01342938
- [DHBHS2004] B. Deconinck, M. Heil, A. Bobenko, M. van Hoeij, and M. Schmies, "Computing Riemann theta functions", Math. Comp. 73:247 (2004), 1417–1442. https://arxiv.org/abs/nlin/0206009
- [EHJ2016] A. Enge, W. Hart and F. Johansson, "Short addition sequences for theta functions", preprint (2016), https://arxiv.org/abs/1608.06810
The FLINT team, “Theta functions,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/special-functions/theta-functions.html (generated 2026-11-02).
@misc{flint-doc-algorithms-special-functions-theta-functions,
author = {{The FLINT team}},
title = {{Theta functions}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/special-functions/theta-functions.html},
note = {Generated 2026-11-02}
}