acb_dirichlet.h
#include <flint/acb_dirichlet.h>This module evaluates Dirichlet L-functions
and their analytic continuations, where is a Dirichlet character of the dirichlet module, together with the special cases and relatives of : the Riemann zeta function (the trivial character), the Hurwitz zeta function , the Lerch transcendent and the Stieltjes constants. It also computes Gauss and Jacobi sums and theta series of characters, discrete Fourier transforms on groups of characters, the Hardy Z-function, and the nontrivial zeros of : counting them with Turing's method, isolating and refining them by the Riemann–Siegel formula, or many at a time at large height by Platt's method. All results are rigorous enclosures.
acb_zeta and acb_hurwitz_zeta of the acb module call acb_dirichlet_zeta and acb_dirichlet_hurwitz. The Euler–Maclaurin summation behind the Hurwitz zeta function is _acb_poly_zeta_cpx_series of acb_poly, and polylogarithms are acb_polylog. The methods are described in Zeta functions, polylogarithms and L-functions and Zeros of the Riemann zeta function, and the tutorial The Riemann zeta function, its zeros and L-functions computes zeros and L-function values in complete programs.
Conventions#
- A character is given by a group
G(the characters modulo ) and an elementchiofdirichlet_char_t, or by its Conrey number; seedirichletand Dirichlet characters. Functions that acceptG=chi=NULLthen use the trivial character modulo 1, that is, the Riemann zeta function. This is the case foracb_dirichlet_l,acb_dirichlet_l_jet,acb_dirichlet_l_fmpqand the Hardy Z-functions. - The parity of is if and if , and is the conjugate character.
- Power series in ("jets") are written as vectors of Taylor coefficients: entry of the output of
acb_dirichlet_zeta_jetis . - Outputs may alias inputs unless stated otherwise.
Roots of unity#
Precomputed data for evaluating the roots of unity of a fixed order , as used for character values.
void acb_dirichlet_roots_init(acb_dirichlet_roots_t t, ulong order, slong num, slong prec)Initialise t for the roots of unity of order = order, optimised for num evaluations at precision prec, and free it.
void acb_dirichlet_root(acb_t z, const acb_dirichlet_roots_t t, ulong n, slong prec)Sets z to .
Character values#
void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, slong prec)Sets res to , which is 0 if and a root of unity otherwise.
void acb_dirichlet_chi_vec(acb_ptr v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv, slong prec)Sets v to , sharing the powers of one root of unity.
void acb_dirichlet_pairing(acb_t res, const dirichlet_group_t G, ulong m, ulong n, slong prec)void acb_dirichlet_pairing_char(acb_t res, const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b, slong prec)Set res to the value of the Conrey pairing, that is, the value at of the character with Conrey number ; the second form takes the two characters as input.
Gauss and Jacobi sums#
void acb_dirichlet_gauss_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_gauss_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_gauss_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_gauss_sum_order2(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_gauss_sum_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Set res to the Gauss sum . The naive version sums the definition; factor writes the sum as a product of local Gauss sums by the Chinese remainder theorem; order2 assumes that is real and primitive and returns ; theta assumes that is primitive and obtains the sum from the functional equation of the theta series at . The default version reduces an imprimitive character to the primitive one inducing it and then chooses among the methods.
void acb_dirichlet_jacobi_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)void acb_dirichlet_jacobi_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)void acb_dirichlet_jacobi_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)void acb_dirichlet_jacobi_sum_gauss(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)void acb_dirichlet_jacobi_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, ulong b, slong prec)Set res to the Jacobi sum . The naive version sums the definition; factor writes it as a product of local Jacobi sums; gauss assumes that is primitive and uses . The default version handles trivial and inverse pairs by closed formulas (and returns 0 for even ) and otherwise chooses among the methods. The ui version takes the Conrey numbers and .
Theta series#
The theta series of a character modulo with parity is
For primitive it satisfies , where is the root number, which gives the Gauss sum and the root number from .
void acb_dirichlet_theta_arb(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t t, slong prec)void acb_dirichlet_ui_theta_arb(acb_t res, const dirichlet_group_t G, ulong a, const arb_t t, slong prec)Set res to for real ; the ui version takes the Conrey number . The series converges quickly only for not too small; for the caller should use the functional equation above, which is not applied automatically (to avoid recomputing the Gauss sum).
ulong acb_dirichlet_theta_length(ulong q, const arb_t t, slong prec)ulong acb_dirichlet_theta_length_d(ulong q, double t, slong prec)Return a number of terms such that the tail of the theta series of modulus at is less than . The first version uses a lower bound for .
void acb_dirichlet_qseries_arb_powers_naive(acb_t res, const arb_t x, int parity, const ulong * a, const acb_dirichlet_roots_t z, slong len, slong prec)void acb_dirichlet_qseries_arb_powers_smallorder(acb_t res, const arb_t x, int parity, const ulong * a, const acb_dirichlet_roots_t z, slong len, slong prec)Set res to , where is parity (0 or 1), is the root of unity of z, and the exponents are given (with a special value for , as produced by dirichlet_chi_vec_order). The naive version sums the series as written; the smallorder version sums it in the quotient ring by the cyclotomic polynomial and evaluates at the root of unity only at the end, ignoring z except for its order.
void acb_dirichlet_qseries_arb(acb_t res, acb_srcptr a, const arb_t x, slong len, slong prec)Sets res to (the entry is ignored), computing by two multiplications per term.
void acb_dirichlet_arb_quadratic_powers(arb_ptr v, slong nv, const arb_t x, slong prec)Sets v to .
void acb_dirichlet_vec_mellin_arb(acb_ptr res, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, const arb_t t, slong n, slong prec)Sets res[k], for , to (half the theta series at the geometric sequence , scaled), with the tail bound for the truncation after len terms. These are samples for computing the Mellin transform of the theta series.
Power sums#
void acb_dirichlet_powsum_term(acb_ptr res, arb_t log_prev, ulong * prev, const acb_t s, ulong k, int integer, int critical_line, slong len, slong prec)Sets res to as a power series in of length len. The flags integer and critical_line select optimisations for integer and for .
Sets z to as a power series in of length len. Powers of composite are computed as from a table, and the even terms are grouped as a polynomial in . This needs about powers, multiplications and storage for power series, so it is only faster than the naive sum for small len.
Sets z to as a power series in of length len, by partial sieving that adds the multiples of 5-smooth numbers into separate buckets. It computes about of the powers, more than acb_dirichlet_powsum_sieved, but needs only logarithmic extra space and is faster for large len, since power series multiplications are replaced by additions.
The Riemann zeta function#
void acb_dirichlet_zeta(acb_t res, const acb_t s, slong prec)Sets res to , choosing the algorithm from and prec: exact values at integers (Bernoulli numbers for negative integers, arb_zeta_ui for positive ones), the Riemann–Siegel formula for and at precision , the approximate functional equation (acb_dirichlet_l_fmpq_afe_jet) when is an exact real number which is a rational number of small height (in practice a dyadic number such as or ) and the precision is high enough for this to be faster, and Euler–Maclaurin summation otherwise, after the reflection formula for . The result is indeterminate if contains the pole .
void acb_dirichlet_zeta_jet(acb_t res, const acb_t s, int deflate, slong len, slong prec)Sets res (a vector of length len) to the Taylor coefficients of , or of the deflated function if deflate is nonzero. Euler–Maclaurin summation is used (after the reflection formula when , or at precision below 128 bits; for larger negative it is cheaper and loses fewer bits to sum directly at , with guard bits proportional to ), the Riemann–Siegel formula for len high on the critical line, or, for an exact rational number of small height (including integers) at very high precision, the approximate functional equation (acb_dirichlet_l_fmpq_afe_jet), whose cost is instead of and which needs far less memory.
void acb_dirichlet_zeta_bound(mag_t res, const acb_t s)Sets res to an upper bound for , computed quickly: in and slightly around the critical strip by formula (43.3) of [Rad1973], to the right by the value at , and to the left by the functional equation.
void acb_dirichlet_zeta_deriv_bound(mag_t der1, mag_t der2, const acb_t s)Sets der1 and der2 to upper bounds for and , meant for the critical strip. The bounds are not tight.
void acb_dirichlet_eta(acb_t res, const acb_t s, slong prec)Sets res to the Dirichlet eta function (the alternating character is not a Dirichlet character). The removable singularity at , where , is handled.
void acb_dirichlet_xi(acb_t res, const acb_t s, slong prec)Sets res to the Riemann xi function , which satisfies .
The Riemann–Siegel formula#
The Riemann–Siegel formula is implemented following Arias de Reyna [Ari2011]. For with ,
where , , and . The coefficients are expressed through auxiliary coefficients and the derivatives . The cost is terms, against for Euler–Maclaurin summation; see The Riemann–Siegel formula. Because of artificial discontinuities, should be exact inside the evaluation; inexact input is handled by bounding the derivative.
If nonzero (the default), the main sum of the Riemann–Siegel formula is computed with dfloat_powsum_sieved (double-word arithmetic, see dfloat) when that gives enough accuracy. Set it to 0 to always use acb_dirichlet_powsum_sieved. This is a global variable, which should not be changed while other threads evaluate zeta.
void acb_dirichlet_zeta_rs_f_coeffs(acb_ptr c, const arb_t p, slong N, slong prec)Sets c to for , by power series division. This breaks down at , which does not occur for exact .
void acb_dirichlet_zeta_rs_d_coeffs(arb_ptr d, const arb_t sigma, slong k, slong prec)Updates d in place from to for (for , initialises it).
void acb_dirichlet_zeta_rs_bound(mag_t err, const acb_t s, slong K)Sets err to a bound for the error term , by Theorem 4.2 of [Ari2011].
void acb_dirichlet_zeta_rs_r(acb_t res, const acb_t s, slong K, slong prec)Sets res to for in the upper half-plane, with exactly asymptotic terms if and an automatic choice otherwise.
void acb_dirichlet_zeta_rs(acb_t res, const acb_t s, slong K, slong prec)Sets res to by the Riemann–Siegel formula, with exactly asymptotic terms if and an automatic choice otherwise.
void acb_dirichlet_zeta_jet_rs(acb_ptr res, const acb_t s, slong len, slong prec)Sets res to the first len Taylor coefficients of at by the Riemann–Siegel formula. Only len is supported; the derivative is computed with a finite difference.
The Hurwitz zeta function#
void acb_dirichlet_hurwitz(acb_t res, const acb_t s, const acb_t a, slong prec)Sets res to the Hurwitz zeta function , analytically continued. The case calls acb_dirichlet_zeta, and and small negative integers use Bernoulli polynomials; otherwise Euler–Maclaurin summation is used (_acb_poly_zeta_cpx_series). The result is indeterminate if contains 1.
Precomputed data for evaluating at many for a fixed .
void acb_dirichlet_hurwitz_precomp_init(acb_dirichlet_hurwitz_precomp_t pre, const acb_t s, int deflate, slong A, slong K, slong N, slong prec)Precomputes a grid of Taylor polynomials of length for , for fast evaluation of at with fixed . This costs Hurwitz zeta values; each later evaluation costs arithmetic operations plus powers, with a truncation error . With deflate nonzero, the deflated function (without the pole at ) is used.
void acb_dirichlet_hurwitz_precomp_init_num(acb_dirichlet_hurwitz_precomp_t pre, const acb_t s, int deflate, double num_eval, slong prec)void acb_dirichlet_hurwitz_precomp_choose_param(ulong * A, ulong * K, ulong * N, const acb_t s, double num_eval, slong prec)Choose , and to minimise the cost of num_eval evaluations at and precision prec, and (for the first function) initialise pre with them. If evaluating each value from scratch is estimated to be cheaper, .
Frees the precomputed data.
Sets res to a bound for the truncation error (not including rounding errors) of the evaluation of with parameters , , , for .
void acb_dirichlet_hurwitz_precomp_eval(acb_t res, const acb_dirichlet_hurwitz_precomp_t pre, ulong p, ulong q, slong prec)Sets res to using the precomputed data, for . Throws an exception if .
The Lerch transcendent#
void acb_dirichlet_lerch_phi_direct(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec)void acb_dirichlet_lerch_phi_integral(acb_t res, const acb_t z, const acb_t s, const acb_t a, slong prec)Set res to the Lerch transcendent , analytically continued to . The direct version sums the truncated series; the integral version uses a Hankel contour integral; the default version checks special cases that reduce to the Hurwitz zeta function or polylogarithms and otherwise chooses between the two.
Stieltjes constants#
void acb_dirichlet_stieltjes(acb_t res, const fmpz_t n, const acb_t a, slong prec)Sets res to the generalised Stieltjes constant for an integer (an exception is thrown for ), the coefficient in the Laurent series . With these are the ordinary Stieltjes constants.
Dirichlet L-functions#
For a primitive character of conductor and parity , satisfies the functional equation
with the root number .
void acb_dirichlet_root_number(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_root_number_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Set res to the root number of a primitive character. The theta version uses ; the default version uses the Gauss sum, , when has several prime factors, and the theta series otherwise. The default version throws an exception if is not primitive.
void acb_dirichlet_l(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void _acb_dirichlet_l_generic(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Sets res to , choosing the algorithm. If is an exact integer, acb_dirichlet_l_si is used. If is an exact real number which is a rational number of small height (see _acb_dirichlet_get_small_fmpq), the approximate functional equation acb_dirichlet_l_fmpq_afe_jet is used when _acb_dirichlet_l_fmpq_use_afe estimates it to be faster (at high precision or for large conductor). Otherwise (and always in the underscore version): the Riemann zeta function for , the functional equation for primitive and (or near for even ), the Euler product for large , and otherwise the decomposition into Hurwitz zeta functions with a precomputation shared by the values.
void acb_dirichlet_l_si(acb_t res, slong s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Sets res to for an integer , using closed forms where they exist. An imprimitive character is reduced to the primitive character modulo inducing it, using , and gives the Riemann zeta function. For primitive modulo with parity ():
- If , then in terms of a generalized Bernoulli number, which is zero unless . (The functional equation and the Euler product are used instead when is large compared to the precision.)
If and , then
where is the Gauss sum (the Euler product is used instead for large compared to the precision). The generalized Bernoulli number is computed with exact integer arithmetic grouped by the classes of residues with the same character value, so that only roots of unity are needed; at high precision the cost is dominated by the Gauss sum, i.e. by about multiplications.
- If and is even, then , computed with one logarithm per class of residues with the same character value (a single logarithm for real ).
- Otherwise ( and , where no closed form is known), the algorithm is chosen among the Euler product (for large compared to the precision), Catalan's constant (
arb_const_catalan, for , ),acb_dirichlet_l_ui_borwein_bsplit(at high precision, for moderate ), the approximate functional equation (acb_dirichlet_l_fmpq_afe, for larger ) and the Hurwitz zeta function.
void acb_dirichlet_l_ui_borwein_bsplit(acb_t res, ulong s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Sets res to for an integer and a primitive character modulo (with G = NULL for ), using a generalization of Borwein's algorithm for the Riemann zeta function (arb_zeta_ui_borwein_bsplit) with binary splitting, which costs at precision .
If , the 2-component of is primitive, which implies that with ; if is odd, we instead use with . In both cases, is a linear combination over the residues modulo of alternating series , whose terms are moments of a positive measure on with total mass . Borwein's acceleration with terms therefore has error at most for each series. The series are evaluated together by one binary splitting over vectors (several in parallel when threads are available), and the character values only enter in the final linear combination.
The output is indeterminate if the character is not primitive, if (there are then no primitive characters), and if , is odd and (when the factor vanishes).
void acb_dirichlet_l_hurwitz(acb_t res, const acb_t s, const acb_dirichlet_hurwitz_precomp_t precomp, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Sets res to . For and non-principal , the deflated Hurwitz zeta function is used to avoid the poles. If precomp is NULL, each Hurwitz zeta value is computed directly; otherwise the precomputation is used.
void acb_dirichlet_l_euler_product(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s, const signed char * chi, int mod, int reciprocal, slong prec)void acb_dirichlet_l_fmpq(acb_t res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)void acb_dirichlet_l_fmpq_afe(acb_t res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Set res to for rational . The afe version uses the approximate functional equation, a rapidly convergent series of incomplete gamma functions (evaluated by binary splitting and the bit-burst algorithm), which is fastest at very high precision or large modulus; the default version uses acb_dirichlet_l_si when is an integer, the approximate functional equation when this is estimated to be faster, and otherwise calls _acb_dirichlet_l_generic. Imprimitive characters are reduced to the primitive characters inducing them, as in acb_dirichlet_l_fmpq_afe_jet.
int _acb_dirichlet_l_fmpq_use_afe(ulong q, const fmpq_t s, slong prec)int _acb_dirichlet_l_jet_use_afe(ulong q, const fmpq_t s, int deflate, slong len, slong prec)Return whether the approximate functional equation is estimated to be faster than the generic algorithms for , respectively for its expansion to length len, where is the conductor of ( for the Riemann zeta function). These are the heuristics used by acb_dirichlet_l, acb_dirichlet_l_fmpq, acb_dirichlet_l_jet, acb_dirichlet_zeta and acb_dirichlet_zeta_jet (and therefore by acb_dirichlet_stieltjes and arb_const_glaisher, which call acb_dirichlet_zeta_jet). The cutoffs come from timings (wall time) with 1 and 8 threads. They decrease with (for , values at half-integers, and for , jets, always use the approximate functional equation), and with the number of threads (flint_get_num_threads), since the terms of the approximate functional equation are computed in parallel with nearly perfect speedup while Euler–Maclaurin summation and the Hurwitz zeta functions gain less from threads. For they are about bits for , bits for other values, bits for jets at and bits for other jets of length 2 (somewhat higher for longer jets), the latter capped at bits because of the memory of Euler–Maclaurin summation (4 GB at bits). The choice of algorithm, and hence the radius of the output, can therefore depend on the number of threads.
int _acb_dirichlet_get_small_fmpq(fmpq_t x, const acb_t s)If is an exact real number equal to a rational number with numerator of at most 40 bits and denominator of at most 20 bits (i.e. a dyadic number with ), sets to it and returns 1; otherwise returns 0.
void acb_dirichlet_l_fmpq_afe_jet(acb_ptr res, const fmpq_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, slong len, slong prec)Sets res to the Taylor coefficients for rational , with deflate as in acb_dirichlet_l_jet. This uses the same approximate functional equation and precision management as acb_dirichlet_l_fmpq_afe, with every quantity replaced by a power series in where . The required expansions of the incomplete gamma functions with respect to the parameter are computed by jet versions of the binary splitting and bit-burst algorithms (see _arb_gamma_upper_fmpq_step_bsplit_jet), with truncation errors bounded separately for each coefficient. For fixed len, the cost is at precision , roughly len times the cost of acb_dirichlet_l_fmpq_afe; this makes it possible to compute, for example, Glaisher's constant (via ), Stieltjes constants and their generalizations to Dirichlet -functions, or the second-order Landau-Ramanujan constant (via and at ) in quasi- time. An imprimitive character modulo induced by is handled by evaluating and multiplying by the Euler factors . The deflation only has an effect for (as in acb_dirichlet_zeta_jet); for the Riemann zeta function at , deflate must be set, and for a principal character modulo , deflate must not be set; otherwise the output is indeterminate.
The terms of the approximate functional equation are independent, and are computed in parallel when FLINT is allowed to use several threads (see flint_set_num_threads). The terms are added up in a fixed order, so the output does not depend on the number of threads. Each term is added as soon as all earlier terms are done; a term that finishes early waits in a small buffer (a few terms per thread), so the memory usage is bits with threads, independent of the number of terms . The same applies to acb_dirichlet_l_fmpq_afe, which is the case len = 1 of this function.
void acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s, const acb_dirichlet_hurwitz_precomp_t precomp, const dirichlet_group_t G, slong prec)Sets res (of length ) to for all characters modulo , from the values and one discrete Fourier transform. The values are ordered by lexicographically ordered Conrey logarithms, as in acb_dirichlet_dft_index. If precomp is NULL, each Hurwitz zeta value is computed directly.
void acb_dirichlet_l_jet(acb_ptr res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, slong len, slong prec)Sets res to the Taylor coefficients . With deflate nonzero and principal , the expansion of is computed instead, which at is the regular part of the Laurent expansion; for non-principal , deflate has no effect. For this calls acb_dirichlet_zeta_jet. Otherwise, if is an exact rational number of small height (see _acb_dirichlet_get_small_fmpq), the approximate functional equation acb_dirichlet_l_fmpq_afe_jet is used when _acb_dirichlet_l_jet_use_afe estimates it to be faster (this is not done for principal characters with deflation); otherwise the Hurwitz zeta expansions are summed.
void _acb_dirichlet_l_series(acb_ptr res, acb_srcptr s, slong slen, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, slong len, slong prec)void acb_dirichlet_l_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, int deflate, slong len, slong prec)Set res to truncated to length len, for a power series , with deflate as in acb_dirichlet_l_jet.
Discrete Fourier transforms on characters#
The discrete Fourier transform of is the function on the characters modulo . Using the Conrey isomorphism between and its dual, it is computed as . Both functions are thin wrappers around gr_dft_acb_dirichlet_index and gr_dft_acb_dirichlet of gr_dft, which compute a product DFT over the cyclic components of the group in fixed-point arithmetic with rigorous error bounds.
void acb_dirichlet_dft_index(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec)Sets w to the DFT of v, both vectors of length indexed by the lexicographically ordered Conrey logarithms (the order of dirichlet_char_next and dirichlet_char_index).
void acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec)Sets w to the DFT of v, both vectors of length indexed by Conrey numbers. The entries at indices not coprime to are ignored.
Hardy Z-functions#
For a primitive character (or for , with G and chi NULL), the Hardy Z-function is , where the phase is
is real for real , and its real zeros are the zeros of on the critical line. The functions throw an exception if is not primitive.
void acb_dirichlet_hardy_theta(acb_ptr res, const acb_t t, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)Sets res to the first len Taylor coefficients of , using the log-gamma function.
void acb_dirichlet_hardy_z(acb_ptr res, const acb_t t, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)Sets res to the first len Taylor coefficients of , computed as with acb_dirichlet_l_jet. For the Riemann zeta function, this uses the Riemann–Siegel formula when is large and len . If is real, the imaginary parts are set to exactly zero.
void _acb_dirichlet_hardy_theta_series(acb_ptr res, acb_srcptr s, slong slen, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)void acb_dirichlet_hardy_theta_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)void _acb_dirichlet_hardy_z_series(acb_ptr res, acb_srcptr s, slong slen, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)void acb_dirichlet_hardy_z_series(acb_poly_t res, const acb_poly_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, slong prec)Set res to , respectively , truncated to length len, for a power series (given as s).
Gram points and counting zeros#
These functions concern the Riemann zeta function only. Let be the number of zeros of , counted with multiplicity, with , and . They implement Turing's method as described in Turing's method, following the implementation in mpmath [Joh2018b] by Arias de Reyna [Ari2012].
void acb_dirichlet_gram_point(arb_t res, const fmpz_t n, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)Sets res to the -th Gram point , the unique solution in of , for . Only the Riemann zeta function is supported: G and chi must be NULL; otherwise, or for , the result is indeterminate.
ulong acb_dirichlet_turing_method_bound(const fmpz_t p)void acb_dirichlet_zeta_nzeros(arb_t res, const arb_t t, slong prec)void _acb_dirichlet_exact_zeta_nzeros(fmpz_t res, const arf_t t)Set res to . For exact the result is an exact integer; for an inexact ball, it is the ball containing where encloses . The underscore version takes an exact and sets an integer.
void acb_dirichlet_zeta_nzeros_gram(fmpz_t res, const fmpz_t n)Sets res to , for .
void acb_dirichlet_backlund_s(arb_t res, const arb_t t, slong prec)Sets res to , where the argument is defined by continuous variation from to and then to , not the principal value. It is computed as .
void acb_dirichlet_backlund_s_bound(mag_t res, const arb_t t)Sets res to an upper bound for , by Theorem 1 and (1.2) of [Tru2014].
slong acb_dirichlet_backlund_s_gram(const fmpz_t n)Returns , for .
Zeros of the Riemann zeta function#
The -th zero of the Hardy Z-function is , where is the -th nontrivial zero of with positive imaginary part (assuming, as verified for every handled by these functions, that the zeros are on the critical line and simple). Zeros of the Riemann zeta function explains the methods and gives an example.
void acb_dirichlet_hardy_z_zero(arb_t res, const fmpz_t n, slong prec)void acb_dirichlet_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, slong prec)Set res to , respectively to the len consecutive values , accurate to about prec bits. Throws an exception if . The zeros are isolated rigorously and computed by the Riemann–Siegel method, or by Platt's method at large height when that is expected to be faster.
void acb_dirichlet_zeta_zero(acb_t res, const fmpz_t n, slong prec)void acb_dirichlet_zeta_zeros(acb_ptr res, const fmpz_t n, slong len, slong prec)Set res to , respectively to len consecutive zeros starting with . Requires .
void _acb_dirichlet_hardy_z_zeros_rs(arb_ptr res, const fmpz_t n, slong len, slong prec)The same as acb_dirichlet_hardy_z_zeros, always with the Riemann–Siegel method: isolation with Gram points and Turing's method, then refinement with _acb_dirichlet_refine_hardy_z_zero.
slong _acb_dirichlet_hardy_z_zeros_use_platt(const fmpz_t n, slong len, slong prec)Returns 0 if acb_dirichlet_hardy_z_zeros uses the Riemann–Siegel method for len zeros from the -th at target precision prec (or at the default precision if prec is not positive), and otherwise the working precision of the large height method. The choice minimises a cost model measured with 2 threads.
void acb_dirichlet_isolate_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n)void _acb_dirichlet_isolate_gram_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n)void _acb_dirichlet_isolate_rosser_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n)void _acb_dirichlet_isolate_turing_hardy_z_zero(arf_t a, arf_t b, const fmpz_t n)Set to an interval that contains and no other zero of . The gram version uses Gram's law and requires ; the rosser version uses Rosser's rule and requires ; the turing version uses Turing's method and requires ; the default version chooses among them and requires .
int _acb_dirichlet_definite_hardy_z(arb_t res, const arf_t t, slong * pprec)Sets res to , increasing the precision *pprec as needed until the sign of is determined, and returns the sign.
void _acb_dirichlet_refine_hardy_z_zero(arb_t res, const arf_t a, const arf_t b, slong prec)Sets res to the unique zero of in , to prec bits.
void _acb_dirichlet_refine_hardy_z_zero_ball(arb_t res, const arb_t z, slong prec)Sets res to the zero of in the ball z, which must contain exactly one zero (for example a zero computed by Platt's method), to prec bits: z rounded if it is accurate enough, otherwise the last stage of the refinement above if z is accurate to about half the precision, and the full refinement otherwise.
Platt's method for zeros at large height#
Platt's method [Pla2017] evaluates the real function , which has the same zeros as , on a grid of points with spacing by a convolution computed with fast Fourier transforms, then interpolates between the grid points. One multi-evaluation isolates thousands of zeros; see Platt's method. The functions without underscore choose all parameters from the height and expect ; for smaller they return 0. They use flint_get_num_threads() threads.
void acb_dirichlet_platt_scaled_lambda(arb_t res, const arb_t t, slong prec)void acb_dirichlet_platt_scaled_lambda_vec(arb_ptr res, const fmpz_t T, slong A, slong B, slong prec)Sets res to the values of acb_dirichlet_platt_scaled_lambda at the grid points , , by evaluating each point separately. must be even.
void acb_dirichlet_platt_multieval(arb_ptr out, const fmpz_t T, slong A, slong B, const arb_t h, const fmpz_t J, slong K, slong sigma, slong prec)void acb_dirichlet_platt_multieval_threaded(arb_ptr out, const fmpz_t T, slong A, slong B, const arb_t h, const fmpz_t J, slong K, slong sigma, slong prec)Set out to the values of acb_dirichlet_platt_scaled_lambda on the same grid as acb_dirichlet_platt_scaled_lambda_vec, all at once with discrete Fourier transforms, in the notation of [Pla2017]: is the width of the Gaussian, the number of terms of the Dirichlet series, the number of Taylor terms and sigma an odd integer used in the error bounds. The threaded version uses flint_get_num_threads() threads; the default version decides whether to use threads.
If nonzero (the default), acb_dirichlet_platt_multieval computes the sums over with double-word arithmetic when the precision allows it. Set it to 0 to always use ball arithmetic.
void acb_dirichlet_platt_ws_interpolation(arb_t res, arf_t deriv, const arb_t t0, arb_srcptr p, const fmpz_t T, slong A, slong B, slong Ns_max, const arb_t H, slong sigma, slong prec)Sets res to acb_dirichlet_platt_scaled_lambda at , by Gaussian-windowed Whittaker–Shannon interpolation of the grid values p. If deriv is not NULL, it is set to an approximation of the derivative. Ns_max is the maximum number of grid points used on either side of , is the standard deviation of the Gaussian window, and sigma is an odd positive integer used in the error bounds.
slong _acb_dirichlet_platt_local_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, const fmpz_t T, slong A, slong B, const arb_t h, const fmpz_t J, slong K, slong sigma_grid, slong Ns_max, const arb_t H, slong sigma_interp, slong prec)Set at most len entries of res to consecutive zeros of the Hardy Z-function and return the number found. The local versions make one grid evaluation; acb_dirichlet_platt_hardy_z_zeros repeats them until len zeros are found. The parameters of the underscore version have the meanings of acb_dirichlet_platt_multieval and acb_dirichlet_platt_ws_interpolation.
slong acb_dirichlet_platt_isolate_local_hardy_z_zeros(arf_interval_ptr res, const fmpz_t n, slong len, slong prec)slong _acb_dirichlet_platt_isolate_local_hardy_z_zeros(arf_interval_ptr res, const fmpz_t n, slong len, const fmpz_t T, slong A, slong B, const arb_t h, const fmpz_t J, slong K, slong sigma_grid, slong Ns_max, const arb_t H, slong sigma_interp, slong prec)Like the local functions above, but set res to isolating intervals of the zeros instead of refining them.
Sets at most len entries of res to consecutive zeros of by Platt's method, and returns the number found.
The secondary zeta function#
void acb_dirichlet_secondary_zeta(acb_t res, const acb_t s, slong prec)Sets res to the secondary zeta function , where runs over the zeros of with positive imaginary part. The Riemann hypothesis is not assumed. The algorithm follows [Ari2020], with the decomposition depending on a parameter , an improved tail bound for , and rigorous bounds for the tails of and that replace the heuristic bounds of [Ari2020].
Internal functions#
void _acb_dirichlet_theta_argument_at_arb(arb_t xt, ulong q, const arb_t t, slong prec)Sets xt to , the exponent of the theta series.
void _acb_dirichlet_theta_arb_series(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec)Sets res to for = xt, using acb_dirichlet_qseries_arb.
void mag_tail_kexpk2_arb(mag_t res, const arb_t a, ulong n)Sets res to an upper bound for .
Sets res to the polynomial with the len coefficients v evaluated at , by the baby-step giant-step method.
Returns the local factor at (with and pe ) of the Jacobi sum for a character of conductor cond. The value is a signed integer cast to ulong.
void acb_dirichlet_platt_beta(arb_t res, const arb_t t, slong prec)Sets res to , the exponent in the bound used in [Pla2017].
void acb_dirichlet_platt_lemma_32(arb_t out, const arb_t h, const arb_t t0, const arb_t x, slong prec)void acb_dirichlet_platt_lemma_A7(arb_t out, slong sigma, const arb_t t0, const arb_t h, slong k, slong A, slong prec)void acb_dirichlet_platt_lemma_A9(arb_t out, slong sigma, const arb_t t0, const arb_t h, slong A, slong prec)void acb_dirichlet_platt_lemma_B1(arb_t out, slong sigma, const arb_t t0, const arb_t h, const fmpz_t J, slong prec)Set out to the error bounds of Lemma 3.2 and Lemmas A.5, A.7, A.9, A.11, B.1 and B.2 of [Pla2017], which bound the errors of the grid evaluation in acb_dirichlet_platt_multieval (truncation of the Dirichlet series, of the Taylor expansion, aliasing of the discrete Fourier transform, and so on). Lemma A.5 requires ; when a lemma's hypotheses fail, the bound is infinite.
Precomputed constants of the interpolation error bounds.
void acb_dirichlet_platt_c_precomp_init(acb_dirichlet_platt_c_precomp_t pre, slong sigma, const arb_t h, ulong k, slong prec)void acb_dirichlet_platt_c_bound_precomp(arb_t res, const acb_dirichlet_platt_c_precomp_t pre, slong sigma, const arb_t t0, const arb_t h, slong k, slong prec)void acb_dirichlet_platt_c_bound(arb_t res, slong sigma, const arb_t t0, const arb_t h, slong k, slong prec)Set res to the bound of [Pla2017] for the -th derivative of the scaled function in the strip used for the error analysis, with or without precomputed constants that depend only on , and .
void acb_dirichlet_platt_i_precomp_init(acb_dirichlet_platt_i_precomp_t pre, slong A, const arb_t H, slong sigma, slong prec)void acb_dirichlet_platt_i_bound_precomp(arb_t res, const acb_dirichlet_platt_i_precomp_t pre_i, const acb_dirichlet_platt_c_precomp_t pre_c, const arb_t t0, slong A, const arb_t H, slong sigma, slong prec)void acb_dirichlet_platt_i_bound(arb_t res, const arb_t t0, slong A, const arb_t H, slong sigma, slong prec)Set res to the bound of [Pla2017] for the error of the Whittaker–Shannon interpolation caused by the Gaussian window and the sampling rate , with or without precomputed constants.
void acb_dirichlet_platt_ws_precomp_init(acb_dirichlet_platt_ws_precomp_t pre, slong A, const arb_t H, slong sigma, slong prec)void acb_dirichlet_platt_ws_interpolation_precomp(arb_t res, arf_t deriv, const acb_dirichlet_platt_ws_precomp_t pre, const arb_t t0, arb_srcptr p, const fmpz_t T, slong A, slong B, slong Ns_max, const arb_t H, slong sigma, slong prec)The interpolation acb_dirichlet_platt_ws_interpolation with the constants of both bounds precomputed, for many evaluations with the same , and .
References#
- [Rad1973] H. Rademacher, Topics in analytic number theory, Springer, 1973.
- [Ari2011] J. Arias de Reyna, "High precision computation of Riemann’s zeta function by the Riemann-Siegel formula, I", Mathematics of Computation 80 (2011), 995-1009
- [Joh2018b] F. Johansson and others, "mpmath: a Python library for arbitrary-precision floating-point arithmetic (version 1.1.0)", December 2018. https://mpmath.org/
- [Ari2012] J. Arias de Reyna, "Programs for Riemann's zeta function", (J. A. J. van Vonderen, Ed.) Leven met getallen : liber amicorum ter gelegenheid van de pensionering van Herman te Riele CWI (2012) 102-112, https://ir.cwi.nl/pub/19724
- [Tur1953] A. M. Turing, "Some Calculations of the Riemann Zeta-Function", Proc. of the London Mathematical Society 3(3) (1953), 99-117, https://doi.org/10.1112/plms/s3-3.1.99
- [Leh1970] R. S. Lehman, "On the Distribution of Zeros of the Riemann Zeta-Function", Proc. of the London Mathematical Society 20(3) (1970), 303-320, https://doi.org/10.1112/plms/s3-20.2.303
- [Bre1979] R. P. Brent, "On the Zeros of the Riemann Zeta Function in the Critical Strip", Mathematics of Computation 33 (1979), 1361-1372, https://doi.org/10.1090/S0025-5718-1979-0537983-2
- [Tru2011] T. S. Trudgian, "Improvements to Turing's method", Mathematics of Computation 80 (2011), 2259-2279, https://doi.org/10.1090/S0025-5718-2011-02470-1
- [Tru2014] T. S. Trudgian, "An improved upper bound for the argument of the Riemann zeta-function on the critical line II", Journal of Number Theory 134 (2014), 280-292, https://doi.org/10.1016/j.jnt.2013.07.017
- [Pla2017] D. J. Platt, "Isolating some non-trivial zeros of zeta", Mathematics of Computation 86 (2017), 2449-2467, https://doi.org/10.1090/mcom/3198
- [Pla2011] D. J. Platt, "Computing degree 1 L-functions rigorously", Ph.D. Thesis, University of Bristol (2011), https://people.maths.bris.ac.uk/~madjp/thesis5.pdf
- [Ari2020] J. Arias de Reyna, "Computation of the secondary zeta function", https://arxiv.org/abs/2006.04869
The FLINT team, “acb_dirichlet.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/acb_dirichlet/index.html (generated 2026-11-20).
@misc{flint-doc-acb-dirichlet-index,
author = {{The FLINT team}},
title = {{acb\_dirichlet.h (module overview)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/acb_dirichlet/index.html},
note = {Generated 2026-11-20}
}