FLINT3.7.0-dev
Module · 24 functions

acb_mzeta.h

#include <flint/acb_mzeta.h>

Multiple zeta values#

void acb_mzeta_mzv(arb_t res, const ulong * s, slong r, slong prec)

Sets res to the multiple zeta value

ζ(s1,…,sr)=∑n1>n2>⋯>nr≥11n1s1⋯nrsr,\zeta(s_1, \ldots, s_r) = \sum_{n_1 > n_2 > \cdots > n_r \ge 1} \frac{1}{n_1^{s_1} \cdots n_r^{s_r}},

with the convention of PARI/GP's zetamult (the first index belongs to the largest summation variable; s1≥2s_1 \ge 2 for convergence, otherwise the result is indeterminate). The empty index gives 1, depth 1 uses arb_zeta_ui.

For depth r≥2r \ge 2 the value is computed from the iterated integral representation by Akhilesh's double tails [Akh2017], a recursion over the subwords of the index in fixed-point arithmetic, with cost O(k2P2)O(k^2 P^2) for weight kk and PP bits; from 25000 bits it is instead reduced by Hölder convolution [BBBL2001] to multiple polylogarithms at 12\tfrac12, evaluated by binary splitting in quasi-linear time. See Double tails and Hölder convolution.

void acb_mzeta_mzv_star(arb_t res, const ulong * s, slong r, slong prec)
void acb_mzeta_mzv_t(acb_t res, const ulong * s, slong r, const acb_t t, slong prec)

The multiple zeta star value ζ⋆(s1,…,sr)=∑n1≥⋯≥nr≥1n1−s1⋯nr−sr\zeta^\star(s_1, \ldots, s_r) = \sum_{n_1 \ge \cdots \ge n_r \ge 1} n_1^{-s_1} \cdots n_r^{-s_r}, respectively Yamamoto's interpolation [Yam2013]

ζt(s)=∑pt r−depth⁡(p)ζ(p),\zeta^t(s) = \sum_{p} t^{\,r - \operatorname{depth}(p)} \zeta(p),

the sum over the 2r−12^{r-1} indices pp obtained from ss by replacing some of the commas by plus signs (t=0t = 0 gives ζ(s)\zeta(s), t=1t = 1 gives ζ⋆(s)\zeta^\star(s)), as with PARI/GP's zetamult(s, t). The values ζ(p)\zeta(p) are computed together, sharing their subwords, and the result is a polynomial in tt evaluated at t; for tt far from [0,1][0, 1] the absolute error is relative to the largest term. Depth at most 24.

Flags for acb_mzeta_mzv_all: star values instead of multiple zeta values; only the weight kk instead of all weights up to kk. The values are those of PARI/GP's zetamultall with the bits 0 and 2 of its flag.

void acb_mzeta_mzv_all(arb_ptr res, ulong k, int flags, slong prec)

Sets res to all multiple zeta values of weight 2,…,k2, \ldots, k (2k−1−12^{k-1} - 1 values) or of weight kk only (2k−22^{k-2} values), ordered by their index mm (see acb_mzeta_mzv_index), i.e. starting at m=1m = 1, respectively m=2k−2m = 2^{k-2}. The words are evaluated together by the double tail recursion, so that shared subwords are computed once. Requires 2≤k≤2 \le k \le FLINT_BITS −2- 2.

Conversions between an admissible index ss and the integer m=(1y)2m = (1 y)_2 where x0yx1x_0 y x_1 is the word of ss (written with the digits 0=x00 = x_0, 1=x11 = x_1), as in PARI/GP's zetamultconvert: the indices of weight kk are 2k−2≤m<2k−12^{k-2} \le m < 2^{k-1}. The first function returns 0 if ss is not admissible or its weight exceeds FLINT_BITS; the second writes the index to s (room for k−1k - 1 entries) and returns its depth.

Multiple polylogarithms and colored multiple zeta values#

void acb_mzeta_polylog(acb_t res, const ulong * s, acb_srcptr x, slong r, slong prec)

Sets res to the multiple polylogarithm

Li⁡s1,…,sr(x1,…,xr)=∑n1>⋯>nr≥1x1n1⋯xrnrn1s1⋯nrsr\operatorname{Li}_{s_1, \ldots, s_r}(x_1, \ldots, x_r) = \sum_{n_1 > \cdots > n_r \ge 1} \frac{x_1^{n_1} \cdots x_r^{n_r}}{n_1^{s_1} \cdots n_r^{s_r}}

(the convention of PARI/GP's polylogmult). The value is computed from Goncharov's iterated integrals G(a1,…,aL;1)G(a_1, \ldots, a_L; 1) with letters ai∈{0,1/y1,…,1/yr}a_i \in \{0, 1/y_1, \ldots, 1/y_r\}, yi=x1⋯xiy_i = x_1 \cdots x_i, as power series at 0 by binary splitting, either directly (when all nonzero letters have absolute value at least 2) or after splitting the path at 12\tfrac12 (when the nonzero letters aia_i and 1−ai1 - a_i have absolute value at least 34\tfrac34); see Multiple polylogarithms. Other arguments, for example xx outside the unit disk or letters close to 12\tfrac12, are not supported yet, and the result is then indeterminate, as it is for divergent sums (s1=1s_1 = 1, x1=1x_1 = 1).

void acb_mzeta_mzv_colored(acb_t res, const ulong * s, const ulong * e, slong r, ulong N, slong prec)

The colored multiple zeta value Li⁡s1,…,sr(ζe1,…,ζer)\operatorname{Li}_{s_1, \ldots, s_r}(\zeta^{e_1}, \ldots, \zeta^{e_r}), ζ=e2πi/N\zeta = e^{2 \pi i/N}; for N=2N = 2 these are the alternating sums (Euler sums). Supported for N≤8N \le 8, where the algorithm of acb_mzeta_polylog applies to all indices; the result is indeterminate for larger NN.

Cache#

An opaque store of data that algorithms precompute and may reuse between calls with the same lattice or parameters: the reduced lattice (LLL-reduced basis, Cholesky factors, tail-bound constants), and the tables of the double-precision algorithm (one per value of ν\nu). A cache may be shared by different algorithms; the most recent entries of each kind are kept. A cache is not thread-safe: use one per thread.

Initializes or frees a cache.

Epstein zeta function#

The Epstein zeta function of a lattice in Rd\mathbb{R}^d with shifts in the lattice and in its dual is defined, following the conventions of Buchheit, Busse and Gutendorf [BBG2024], by

ZΛ,ν ⁣∣xy∣=∑z∈Λ′e−2πi y⋅z∣x−z∣ν,Λ=AZd,Z_{\Lambda,\nu}\!\begin{vmatrix} x \\ y \end{vmatrix} = \sum_{z \in \Lambda}{}' \frac{e^{-2 \pi i\, y \cdot z}}{|x - z|^{\nu}}, \qquad \Lambda = A \mathbb{Z}^d,

where the columns of AA are a basis of the lattice and the prime omits z=xz = x. The sum converges for Re⁡(ν)>d\operatorname{Re}(\nu) > d and continues to a meromorphic function of ν\nu with at most a simple pole at ν=d\nu = d, which occurs when yy is in the dual lattice Λ∗=A−TZd\Lambda^* = A^{-T} \mathbb{Z}^d. Lattice sums of physics are special cases: the Madelung constant of NaCl is −ZZ3,1(0;(12,12,12))-Z_{\mathbb{Z}^3,1}(0; (\tfrac12, \tfrac12, \tfrac12)), and ZZ,ν(0;0)=2ζ(ν)Z_{\mathbb{Z},\nu}(0; 0) = 2 \zeta(\nu).

All the variants below share one interface. The lattice is given by a d×dd \times d basis matrix A (columns), the shifts x and y by vectors of length dd, and ν\nu is any complex ball. With the flag ACB_MZETA_EPSTEIN_REGULARIZED they compute instead the regularised function

ZΛ,νreg ⁣∣xy∣=e2πi x⋅yZΛ,ν ⁣∣xy∣−s^ν(y)∣det⁡A∣,s^ν(y)=πν/2Γ((d−ν)/2)Γ(ν/2)(πy2)(ν−d)/2,Z^{\mathrm{reg}}_{\Lambda,\nu}\!\begin{vmatrix} x \\ y \end{vmatrix} = e^{2 \pi i\, x \cdot y} Z_{\Lambda,\nu}\!\begin{vmatrix} x \\ y \end{vmatrix} - \frac{\hat s_\nu(y)}{|\det A|}, \qquad \hat s_\nu(y) = \frac{\pi^{\nu/2} \Gamma((d - \nu)/2)}{\Gamma(\nu/2)} (\pi y^2)^{(\nu - d)/2},

which is holomorphic in yy near 00 (and equals ZZ at y=0y = 0). The case ν∈d+2Z≥0\nu \in d + 2 \mathbb{Z}_{\ge 0}, where s^ν\hat s_\nu needs a logarithmic definition, is not supported (the output is then indeterminate).

The functions return 1 when res has been computed, and 0 (with res indeterminate) when the algorithm does not apply to the input. A computed result may be indeterminate, for example at the pole, or when the ball x (resp. y) contains a point of Λ\Lambda (resp. Λ∗\Lambda^*) without being exactly that point. The cache may be NULL.

Flag selecting the regularised function.

int acb_mzeta_epstein(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, slong prec)
int acb_mzeta_epstein_generic(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, acb_mzeta_cache_t cache, slong prec)

Sets res to the Epstein zeta function, choosing an algorithm: acb_mzeta_epstein_shell when the input is exact and rational, above 95 bits; acb_mzeta_epstein_crandall_dfloat up to 95 bits for real ν\nu, unless its result has lost more than 12 bits of accuracy; acb_mzeta_epstein_theta in dimension 3 from 800 bits, 4 from 400 bits and 5 to 8 from 250 bits; and otherwise acb_mzeta_epstein_crandall. Always returns 1.

The first form keeps a thread-local cache with the data of the most recently used lattices and ν\nu (the typical use being many evaluations with a fixed lattice), released by flint_cleanup; the second form, like the individual algorithms below, takes an explicit cache (or NULL for none).

int acb_mzeta_epstein_crandall(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, acb_mzeta_cache_t cache, slong prec)

Evaluates Crandall's representation [BBG2024, Thm. 2.11], which writes ZZ as two exponentially convergent sums of incomplete gamma functions over Λ\Lambda and Λ∗\Lambda^*, term by term in ball arithmetic, for any dd, ν\nu and precision. The sums are truncated rigorously with the tail bound of theta series; their number of terms grows like Pd/2P^{d/2} for PP bits. With an exact Gram matrix, the incomplete gamma function is evaluated once per value of the quadratic form. See Crandall's representation and Term-by-term summation.

int acb_mzeta_epstein_crandall_dfloat(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, acb_mzeta_cache_t cache, slong prec)

The same sums in double-precision ball arithmetic (dfloat balls d1b for prec at most 45, d2b for prec at most 95), with the lattice points processed in batches by vector operations and the incomplete gamma function taken from rigorous tables kept in the cache (one per value of ν\nu); see Double-precision balls. Applies (returns 1) when ν\nu is real and exact as a double, ∣ν∣≤64|\nu| \le 64, d≤8d \le 8, prec is at most 95 and dfloat_is_supported holds.

int acb_mzeta_epstein_theta(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, acb_mzeta_cache_t cache, slong prec)

Writes each of the two Crandall sums as a Mellin integral ∫1∞wa−1Θ(w) dw\int_1^\infty w^{a-1} \Theta(w)\, dw of a Riemann theta function and computes it by Gauss–Legendre quadrature with rigorous error bounds, using acb_theta_one for small ww and direct sums over a few lattice points for large ww; see Mellin integrals of theta functions. The cost is about PP integrand values per sum at PP bits instead of O(Pd/2)O(P^{d/2}) terms, so this method is preferable to acb_mzeta_epstein_crandall at high precision. Applies for d≤8d \le 8. The computation is parallel with up to flint_get_num_threads() threads, and the result does not depend on the number of threads.

int acb_mzeta_epstein_shell(acb_t res, const acb_t nu, const arb_mat_t A, arb_srcptr x, arb_srcptr y, int flags, acb_mzeta_cache_t cache, slong prec)
int acb_mzeta_epstein_gram_shell(acb_t res, const acb_t nu, const fmpq_mat_t G, const fmpq * u, const fmpq * v, int flags, slong prec)

The algorithm by shells, for exact rational input: the first form requires AA, xx, yy to be exact (dyadic, so that the Gram matrix ATAA^T A and the coordinates are rational); the second takes the Gram matrix GG of the lattice and the coordinates uu, vv with x=Aux = A u, y=A−Tvy = A^{-T} v (then ∣x−z∣2=(u−n)TG(u−n)|x - z|^2 = (u - n)^T G (u - n) and y⋅z=v⋅ny \cdot z = v \cdot n for z=Anz = A n), so that lattices such as the hexagonal one can be given exactly. ν\nu must be real and exact with a short dyadic value. Returns 0 (not applicable) for the regularised function, for d>8d > 8, for denominators of uu, vv above 64 and when the estimated cost of the shell counts is too large.

The lattice points are grouped into shells of equal norm, counted exactly (by products of theta series of low-rank blocks, by enumeration, or from sums of three squares), so that each side of the Crandall splitting needs one incomplete gamma value per shell; the splitting parameter is chosen so that one side has exact rational arguments (binary splitting) and, for integer indices such as the Coulomb case ν=d−2\nu = d - 2, the other side is a power series with rational coefficients. See Sums by shells. The computation is parallel with up to flint_get_num_threads() threads, and the result does not depend on the number of threads.

Madelung constant#

Sets res to the Madelung constant of sodium chloride,

M=−∑(i,j,k)≠0(−1)i+j+ki2+j2+k2=1.7475645946331821906…,M = -\sum_{(i,j,k) \ne 0} \frac{(-1)^{i+j+k}}{\sqrt{i^2+j^2+k^2}} = 1.7475645946331821906\ldots,

computed as −ZZ3,1(0;(12,12,12))-Z_{\mathbb{Z}^3,1}\bigl(0; (\tfrac12,\tfrac12,\tfrac12)\bigr) by acb_mzeta_epstein_gram_shell, which here reduces to Crandall's expansion [Cra1999, eq. (1.2)] as an alternating sum of r3(N)r_3(N) times complementary error functions and a power series in e−2π2/λe^{-2\pi^2/\lambda} with coefficients r3(8k+3)/(8k+3)r_3(8k+3)/(8k+3); see The Madelung constant. The computation is parallel with up to flint_get_num_threads() threads, and the result does not depend on the number of threads.

Internal functions#

void _acb_mzeta_gamma_upper_scaled(acb_t res, const acb_t a, const arb_t t, const acb_t ga, slong prec)

Sets res to t−aΓ(a,t)=∫1∞ua−1e−tu dut^{-a} \Gamma(a, t) = \int_1^\infty u^{a-1} e^{-tu}\, du for real t>0t > 0 to a relative accuracy of about prec bits; ga is Γ(a)\Gamma(a) (at a sufficient precision) or NULL.

The method (asymptotic series, convergent series with the working precision raised to cover its cancellation, or an expression in E1E_1 for nonpositive integers aa) and the working precision are chosen here for the lattice sums, which need many values with one aa. A ball tt is evaluated at its midpoint, with the radius propagated through a bound for the derivative; see The scaled incomplete gamma function.

References#

  • [Akh2017] P. Akhilesh, "Double tails of multiple zeta values", Journal of Number Theory 170 (2017), 228-249, https://arxiv.org/abs/2105.12156
  • [BBBL2001] J. M. Borwein, D. M. Bradley, D. J. Broadhurst and P. Lisoněk, "Special values of multiple polylogarithms", Transactions of the American Mathematical Society 353 (2001), 907-941, https://arxiv.org/abs/math/9910045
  • [Yam2013] S. Yamamoto, "Interpolation of multiple zeta and zeta-star values", Journal of Algebra 385 (2013), 102-114, https://arxiv.org/abs/1203.1118
  • [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
  • [Cra1999] R. E. Crandall, "New representations for the Madelung constant", Experimental Mathematics 8 (1999), 367-379
Cite this page

The FLINT team, “acb_mzeta.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/acb_mzeta/index.html (generated 2026-11-07).