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 [5] 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 [7] 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 [2].)
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 [2] 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 [4] 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 [2] 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 [1]). 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 [3] 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 [1], 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 [1], 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 [10] 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 [10] or [8]), 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 [2]) 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 [2]) 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 [6] or [10] for it. As exposed in [2], 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 [8] 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 [8] has been refined for practical implementation by Odlyzko (see [9]). 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 [8] 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 [9], 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 [8] 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 [8] 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 [9] 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 [9], 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 [9] 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 [9] 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

[1]
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.
[2]
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.
[3]
H. Cohen, F. Rodriguez Villegas, D. Zagier, Convergence acceleration of alternating series, Bonn, (1991)
[4]
H. M. Edwards, Riemann's Zeta Function, Academic Press, 1974.
[5]
J. Lagarias and A. Odlyzko, "Computing p(x) : an analytic method," J. Algorithms 8, (1987), 173-191.
[6]
Eric W. Weisstein, "Riemann-Siegel functions", available from the MathWorld site at URL= http://mathworld.wolfram.com/Riemann-SiegelFunctions.html
[7]
A. Odlyzko, H. J. J. te Riele, "Disproof of the Mertens conjecture," J. Reine angew. Math. 357 (1985), 138-160.
[8]
A. Odlyzko, A. Schönhage, "Fast algorithms for multiple evaluations of the Riemann zeta-function," Trans. Amer. Math. Soc. 309 (1988), 797-809.
[9]
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.
[10]
E. C. Titchmarsh, The theory of the Riemann Zeta-function, Oxford Science publications, second edition, revised by D. R. Heath-Brown (1986).
[11]
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.