Numerical evaluation of the Riemann Zeta-function
(pdf version : pdf; (postscript version : ps)
We expose techniques that permit to approximate the Riemann Zeta function in different context. The motivation does not restrict only to the numerical verification of the Riemann hypothesis (see Numerical computations about the zeros of the zeta function) : in  for example, Lagarias and Odlyzko obtained the best asymptotic known method to compute p(x), the number of primes less than x, thanks to massive evaluation of the zeta-function; Odlyzko and Te Riele in  used approximations of the first 2000 critical zeros of z(s) to disprove to Mertens conjecture; finally, computations of z(n) at integer values of n also consistute a motivation, together with series expressed in terms of those values. (More details can be found on the motivation of approximating z(s) in .)
The first section is dedicated to numerical evaluations at a given point, the next section deals with multi-evaluation.

## 1  Numerical evaluation of the Zeta function at a given point

In this section, we present different methods that permit to evaluate numerically the Riemann Zeta function z(s) for complex numbers s=s+it. The section is dedicated to general evaluation, and does not specialize to evaluation of Zeta at integer argument for example (see  where a more deep study is done). As we shall see, the best method to approximate Zeta depends on the purpose of evaluation : for evaluation at middle or high precision, method of subsection 1.2 is suited, as for low precision evaluation in the critical strip (for computations concerning zeros) Riemann-Siegel formula is more competitive.

### 1.1  Euler Maclaurin summation method

This method is the historical first technique proposed to numerically approximate z(s), and was developped by Euler himself in his initial efforts to evaluate z(2). The approach consists in applying Euler-Maclaurin summation not to the global z(s) series itself, (see the section on analytic continuation of the z(s) function where this technique was used), but only to remainders ĺn > N n-s of the series. The result is
 z(s) = Nĺ n=1 1 ns + N1-s s-1 + N-s 2 + q-1ĺ r=1 B2r (2r)! s(s+1)Ľ(s+2r-2) N-s-2r+1 +E2q(s)
(see  for details) for any complex number s=s+it (with s = Â(s) > -2q+1). The terms B2r are the Bernoulli numbers. Backlung gave an estimate of the error term E2q(s) in the form
 |E2q(s)| < ęę s(s+1) Ľ(s+2q-1) B2q N-s-2q+1 (2q)!(s+2q-1) ęę .
However, this method is not very easy to use in the practice since it requires evaluations of numerous Bernoulli numbers, and the error term is difficult to control in this non-convergent expansion (see  where this difficulty is presented). Moreover, even with choosing carefully the parameters N and q, the rate of convergence is not better than the one obtained with other simpler techniques based on acceleration of alternating series presented below.

### 1.2  Convergence of alternating series method

A better method, more efficient and easier to implement, is based on the alternating series convergence (see ). It applies to complex numbers s=s+it with s = Â(s) > 0. The starting point is the Zeta alternating series
 za(s) = Ąĺ n=1 (-1)n-1 ns = (1-21-s)z(s).
(1)
We apply the general technique of convergence of alternating series of  described in Acceleration of the convergence of series. The technique applies because the general term of the series 1/(n+1)s is of the form
 1 (n+1)s = óő 1 0 f(x) xn dx,    with    f(x) = log(1/x)s-1 G(s)
Let Pn(x)=ĺk=0n pk (-x)k be a polynomial such that Pn(-1) ą 0, and let define Sn as
 Sn = 1 Pn(-1) n-1ĺ k=0 ck (-1)k (k+1)s ,       ck= nĺ j=k+1 pj.
Then we have the identity
 za(s) - Sn = xn,       xn = 1 Pn(-1)G(s) óő 1 0 Pn(x)(log(1/x))s-1 1+x dx.
(2)
As always, polynomials (Pn) are choosen such that supx Î [0,1] |Pn(x)/Pn(-1)| is small, making the value of xn small. In , this identity is used with two families of polynomials (Pn) : the Chebyshev polynomials shifted to [0,1], and the polynomials xn(1-x)n, giving the two following results :
Proposition 1 Let
 dk = n nĺ j=k (n+j-1)! 4j (n-j)! (2j)!
then
 z(s) = 1 d0 (1-21-s) nĺ k=1 (-1)k-1 dk ks + gn(s)
where for s=s+it with s ł [ 1/2]
 |gn(s)| Ł 2 (3+Ö8)n 1 |G(s)| 1 |1-21-s| Ł 3 (3+Ö8)n (1+2|t|) e|t|p/2 |1-21-s|
This approach, to compute z(s+it) with d decimal digits of acurracy, requires a number of term n roughly equal to 1.3d+0.9|t|.
The next approach is based on the choice of the polynomial xn(1-x)n. Even if a little less efficient, the technique is simpler. This time, the integral in (2) is convergent whenever s = Â(s) > -(n-1), thus the technique can be also applied in this range.
Proposition 2 Let
 ek = nĺ j=k ćč n j öř
then
 z(s) = 1 (1-21-s) ćč nĺ k=1 (-1)k-1 ks + 1 2n 2nĺ k=n+1 (-1)k-1 ek-n ks öř + gn(s)
where for s=s+it with s > 0
 |gn(s)| Ł 1 8n (1+|t/s|) e|t|p/2 |1-21-s| .
If -(n-1) < s < 0 then
 |gn(s)| Ł 1 8n 4|s| |1-21-s| |G(s)| .

#### Computational aspects

This technique is easy and efficient to compute z(s) with middle or high accuracy, for values of s with small imaginary part (in , computational experiments on the computation of z(5) have been made proving the efficiency of this approach compared to Zeta evaluation in classic computer algebra systems like Maple, Mathematica or Pari). In the practice, one should compute the terms sequentially, doing a fixed number of additions and multiplications per term. One should also notice that for integer values of s, the binary-splitting technique can be used making these formula suitable for huge computations in quasi-linear time.
To compute values of z(1/2+it) for very large values of t, (even with a low precision of 10 digits for example) a number of needed terms proportional to |t| is required. As we will see below, Riemann-Siegel formula is more suited in this context.

### 1.3  The Riemann-Siegel formula

The Riemann-Siegel formula permits to approximate z(s+it) in the critical strip 0 Ł s Ł 1 for large values of t with a number of terms proportional to Ö{|t|} (which is much better than previous methods that requires a number of terms proportional to |t|). It states in the general form as follows.
Theorem 1 [Riemann-Siegel formula] Let x and y be positive real numbers such that 2pxy=|t|. Then for s=s+it with 0 Ł s Ł 1, we have
 z(s) = ĺ n Ł x 1 ns + c(s) ĺ n Ł y 1 n1-s + O(x-s) +O(|t|1/2-s ys-1),
(3)
where the O holds uniformly for x > h and y > h for any h > 0.
We remind that c(s), often used to express functional equation of Zeta, is defined by
 c(s) = 2s ps-1 sin ćč ps 2 öř G(1-s).
Formula (3) looks like the functional equation, for that reason it is also called the approximate functional equation. A proof can be found in  for example.
It is natural to use this formula when x=y=Ö{|t|/(2p)}, which writes in the form
 z(s) = mĺ n=1 1 ns + c(s) mĺ n=1 1 n1-s + Em(s),      m = ęë ćč |t| 2p öř 1/2 úű
(4)
where the error term Em(s) satisfies
 Em(s) = O(|t|-s/2).
An asymptotic expansion of the error term Em(s) can be given explicitly (see  or ), but it is complicated in its general form and we just give its first terms in the particular (but important) case s = 1/2 below.

### Riemann-Siegel formula on the critical line

It is interesting to specialize the Riemann-Siegel formula on the critical line s = 1/2. We first define the Riemann-Siegel Z-function which permits a convenient study of z(s) in this zone.

#### The Riemann-Siegel Z-function

The c(s) function satisfies c(s)c(1-s)=1, thus for s=[ 1/2]+it we have
 c( 1 2 +it) c( 1 2 -it) = 1
so that |c([ 1/2]+it)|=1. Therefore, we can define implicitly the q(t) real function as
 eiq(t) = c( 1 2 +it)-1/2,
(5)
with q(0)=0. Equivalently, it easily shown that q(t) also satisfy
 q(t) = arg( p-it/2 G( 1/4 + i t/2 ) )
(6)
where the argument is defined by continuous variation of t starting with the value 0 at t=0.
The Riemann-Siegel Z-function (also called Hardy Z-function in ) is defined for real values of t by
 Z(t) = exp(i q(t)) z( 1 2 +it).
(7)
The functional equation of the Zeta function entails z([ 1/2]-it) = c([ 1/2]-it) z([ 1/2]+it) and we easily deduce that [`Z(t)] = Z(t). In other words, the Z-function is purely real and the equality |Z(t)| = |z([ 1/2]+it)| holds. This wonderful property, illustrated in figure 1, makes this function convenient for the study of z(s) on the critical line. Figure 1: The Riemann Siegel function Z(t) for values of t near 0. In dashed, the value of |z([ 1/2]+it)|.

#### Riemann-Siegel formula applied on the Z-function

Multiplying (4) by exp(iq(t)) for s=[ 1/2]+it, we obtain
 Z(t)
 =
 eiq(t) mĺ n=1 n-1/2-it + e-iq(t) mĺ n=1 n-1/2+it + O(t-1/4)
 =
 2 mĺ n=1 cos(q(t)-tlogn) Ön +O(t-1/4).
(8)
This concise formula is very suitable for computation of Z(t) for large values of t, as needed in computations relative to zeros of the zeta function. For precise computations, asymptotic formula of the error term is also available, and (using formulation of ) one has for positive t
 Z(t)
 =
 2 mĺ n=1 cos(q(t)-tlogn) Ön +
 (-1)m+1 t-1/2 Mĺ j=0 (-1)jt-j Fj(z) +RM(t),
(9)
with RM(t)=O(t-(2M+3)/4), where we used the notations
t =   ć
Ö

 t 2p

,    m=ëtű,     z = 2 (t-m)-1.
The first functions Fj(z) are defined by
 F0(z)
 =
 cos([ 1/2]pz2 + [ 3/8]p) cos(pz)
 F1(z)
 =
 1 12p2 F0(3)(z)
 F2(z)
 =
 1 16p2 F0(2)(z) + 1 288p4 F0(6)(z)
The general expression of Fj(z) for j > 2 is quite complicated and we refer to  or  for it. As exposed in , explicit bounds have been rigorously obtained on the error term RM(t), and for t ł 200, one has
 |R0(t)| Ł 0.127 t-3/4,       |R1(t)| Ł 0.053  t-5/4,       |R2(t)| Ł 0.011  t-7/4.
To be able to completly approximate Z(t) thanks to formula (9), it remains to give an approximation of the q(t) function which is obtained from expression (6) using Stirling series, giving
 q(t) = t 2 log t 2p - t 2 - p 8 + 1 48t + 7 5760t3 + Ľ
(10)

#### Practical approximation considerations

For practical purposes in computations relative to zeros of z(s) it is not necessary to compute precisely the zeros but just to locate them, and using M=1 or M=2 in formula (9) is usually sufficient. For t around 1010 for example, the choice M=1 permits to obtain an absolute precision of Z(t) smaller than 2×10-14, and with M=2 the precision is smaller than 5×10-20. As for the number of terms involved in the sum of (9), it is proportional to Öt which is much better than previous approaches without Riemann-Siegel formula which required a number of terms of order t. For t @ 1010 for example, Riemann-Siegel formula only requires m @ 40,000 terms, whereas approach of proposition 1 requires at least @ 9×109 terms.

## 2  Multi-evaluation of the Zeta function

Quite recently, Odlyzko and Schönhage in  gave an algorithm that is able to compute efficiently values of z(s+it) at multiples values of of t. More precisely and roughly speaking, the algorithm is able to compute T1/2 approximations of z(s+it) in a range of the form T Ł t Ł T+T1/2 in time O(T1/2+e) and using O(T1/2+e) bits of storage, whereas single evaluations at the same values with techniques presented above would require a time proportional to T.
We do not present the algorithm in its general form and we concentrate on evaluations on the critical line s = 1/2 (and in fact on evaluations of the Riemann-Siegel function Z(t)) that are used for numerically checking the Riemann hypothesis. In this context, the general and original algorithm of  has been refined for practical implementation by Odlyzko (see ). We sketch here the main ideas of this approach.

### 2.1  The Odlyzko-Schönhage algorithm for multievaluation of Z(t) : generalities

The algorithm spends most of the time in the computation of
 F(t) = k1ĺ n=1 1 Ön exp(i tlogk),      k1 = ęë ćč t 2p öř 1/2 úű .
(11)
From Riemann-Siegel formula (9), the value of Z(t) is easily obtained from the value of F(t) as the real part of 2exp(-iq(t)) F(t) and adding remainder terms.
We thus concentrate on multi-evaluations of F(t). The algorithm is divided in two steps : first, values of F(t) are computed on a regular grid of abscissa for t (see 2.2). From these values, an interpolation formula permits to obtain efficiently any value of F(t) at a certain accurracy (see 2.3).

### 2.2  Multievaluation on a regular grid of absissa

We describe here how Odlyzko-Schönhage algorithm permits to evaluate efficiently approximations of the values F(t) at evenly spaced values t=T, T+d, Ľ, T+(R-1)d. We will later precise what values of d and R we should choose.
Instead of computing directly the values F(T), F(T+d), Ľ, F(T+(R-1)d), the key idea of  is to compute their discrete Fourier transform, defined by
 uk = R-1ĺ j=0 F(T+jd) w-jk,      w = exp(2ip/R),
for 0 Ł k < R. The property of the inverse Fourier transform gives
 F(T+jd) = 1 R R-1ĺ k=0 uk wjk.
In the algorithm, the value of R is choosen to be a power of two, so the values F(T+jd) are efficiently obtained from the (uk) with an FFT transform. As described by Odlyzko in , this FFT takes a negligeable portion of the time. So the problem is now reduced to computing efficiently the (uk). Using the definition (11) of F(t) and exchanging the order of summations, we obtain that uk = wk f(wk), where f(z) is defined by
 f(z) = k1ĺ k=1 ak z-bk ,       bk=eidlog k,    ak = eiTlogk k1/2 (1-eiRdlogk),
and we are now lead to compute efficiently the complex values f(wk) for 0 Ł k < R. The idea is to use Taylor series expansions for different subset of the functions in the sum. Given a complex number z0 on the unit circle and given L, 0 < L < 1, consider for example the subset I of indices in {1,2,Ľ,k1} such that |bk-z0| > L for all k Î I. We have the Taylor series expansion
 fI(z) ş ĺ k Î I ak z-bk = ĺ n ł 0 An (z0-z)n,       An = ĺ k Î I (z0-bk)-n-1
valid for all z on the unit circle with |z-z0| < L. When restricting to z with |z-z0| < L/2 for example, the convergence of the Taylor series expansion is better than (1/2)n and a fixed number of terms (say V) in this expansion is sufficient to obtain a given absolute precision. Approximations of values fI(wj) for indices j such that |wj-z0| < L/2 (let us call J this set of indices) are then obtained from this Taylor series expansion. When the number of elements in I is much bigger than the number of terms V used in the series expansion, this gives a much more efficient method to compute the values (f(wj))j Î J. This idea is used in  as a basic ingredient of a sophisticated method that writes f(z) in the form ĺfIl, the (Il) being a partition of {1,2,Ľ,k1} choosen such that Taylor series convergence of fIl is well controlled.

### 2.3  Band limited function interpolation

In the previous paragraph, we have seen how to compute efficiently an approximation of the set of values F(T), F(T+d), Ľ, F(T+(R-1)d). Our goal here is to show how to compute efficiently F(t) for any t with T Ł t Ł T+(R-1)d using an interpolation of these precomputed values. The approach presented in  was to compute several of the derivative F(h)(T+jd) and to compute desired value of F(t) by expanding in a Taylor series around the nearest grid point. This approach has been significantly improved in  where a band-limited function interpolation is used that permits to rely only on evaluations F(T+jd) and to use a less dense grid.
The band-limited function interpolation is classical in signal theory for example. Under mild conditions, it states that a function with a spectrum in [-t,t]
 G(t) = óő t -t g(x) eixt dx
is determined by its samples at np/t with n an integer, and more precisely we have the "cardinal series"
 G(t) = +Ąĺ n=-Ą G ćč np t öř sin(tt-np) tt-np .
However, this series has a too slow convergence, and the idea of Odlyzko was to use a denser sampling to obtain a faster convergence. He applied his approach to the function
 G(t) = F(t) e-iat,       a = logk1 2
which spectrum is in [-t,t] with t = [(logk1)/2], and obtained the representation
 F(t) = l b +Ąĺ n=-Ą F ćč np b öř e-ia(np/b-t) sinl(np/b-t) l(np/b-t) h(np/b-t)
(12)
for any b > t, with l = (b+t)/2, and where h(u) is a kernel function choosen as
 h(u) = c sinh(c) sinh(c2-e2u2)1/2 (c2-e2u2)1/2 ,       e = (b-t)/2
where c is any fixed real positive constant. In his computations, Odlyzko chose b @ 1.44 a (thus d = p/b) and c=30, and observed that this choice permits to approximate values of F(t) with a precision of more than (roughly) 10 digits using roughly 200 terms of the sum in (12).

### 2.4  More on Odlyzko-Schönhage algorithm

The complete algorithm is presented in , where in the context of zeros of the zeta-function on the critical line s = 1/2, a lot of optimizations and practical considerations are presented. Among the important improvements, Odlyzko applies the multi-evaluation algorithm not directly to the function F(t) we have presented, but to the function
 F(k0,k1;t) = k1ĺ k=k0 1 Ön exp(i tlogk)
where k0 is a small integer that permits, in the band-limited function interpolation of Odlyzko, to decrease the size t of the support spectrum of G(t) (and thus to optimize the interpolation), with k0 small enough so that the rest of the contribution ĺ1 Ł k < k0 takes a small amount of time to compute. In  computations are done near the zero number 1020, for which a special care is taken to the numerical imprecisions in all steps of the algorithm.
As for the added-value of this method compared to the classic Riemann-Siegel single evaluation method, Odlyzko estimates in  that for computing zeros of z(s) on the critical line near zero number 1020, his implementation of this algorithm is roughly 2×105 faster, which proves the practical efficiency of the method.

## References


D. Borwein, P. Borwein, A. Jakinovski, "An efficient algorithm for the Riemann Zeta function", (1995) available from the CECM preprint server, URL= http://www.cecm.sfu.ca/preprints/1995pp.html, CECM-95-043.

J. Borwein, D. Bradley, R. Crandall, "Computational strategies for the Riemann Zeta Function", (1999) available from the CECM preprint server, URL= http://www.cecm.sfu.ca/preprints/1999pp.html, CECM-98-118.

H. Cohen, F. Rodriguez Villegas, D. Zagier, Convergence acceleration of alternating series, Bonn, (1991)

H. M. Edwards, Riemann's Zeta Function, Academic Press, 1974.

J. Lagarias and A. Odlyzko, "Computing p(x) : an analytic method," J. Algorithms 8, (1987), 173-191.

Eric W. Weisstein, "Riemann-Siegel functions", available from the MathWorld site at URL= http://mathworld.wolfram.com/Riemann-SiegelFunctions.html

A. Odlyzko, H. J. J. te Riele, "Disproof of the Mertens conjecture," J. Reine angew. Math. 357 (1985), 138-160.

A. Odlyzko, A. Schönhage, "Fast algorithms for multiple evaluations of the Riemann zeta-function," Trans. Amer. Math. Soc. 309 (1988), 797-809.

A. Odlyzko, "The 1020-th zero of the Riemann zeta function and 175 million of its neighbors", unpublished manuscript, 1992. Available at URL= http://www.research.att.com/ amo/unpublished/index.html.

E. C. Titchmarsh, The theory of the Riemann Zeta-function, Oxford Science publications, second edition, revised by D. R. Heath-Brown (1986).

J. van de Lune, H. J. J. te Riele and D. T. Winter, On the zeros of the Riemann zeta function in the critical strip, IV. Math. Comp. 46 (1986), 667-681.

Back to numbers, constants and computation

File translated from TEX by TTH, version 3.40.
On 23 Jul 2003, 01:31.