You are on page 1of 10

Convergence Acceleration of Alternating Series

Henri Cohen, Fernando Rodriguez Villegas, and Don Zagier

CONTENTS
We discuss some linear acceleration methods for alternating se-
The First Acceleration Algorithm ries which are in theory and in practice much better than that of
Two Flavors of the Second Algorithm
Applicability
P
Euler–Van Wijngaarden. One of the algorithms, for instance, al-
lows one to calculate ( 1)k ak with an error of about 17.93 n
Extension to Certain Nonalternating Series f g
from the first n terms for a wide class of sequences ak . Such
References methods are useful for high precision calculations frequently ap-
pearing in number theory.

The goal of this paper is to describe some lin-


ear methods to accelerate the convergence of many
alternating sums. The main strength of these meth-
ods is that they are very simple to implement and
permit rapid evaluation of the sums to the very high
precision (say several hundred digits) frequently oc-
curring in number theory.

THE FIRST ACCELERATION ALGORITHM


The typical series P
we1will be considering are alter-
nating series S = k=0 ( 1)k ak , where ak is a rea-
sonably well-behaved function of k which goes slowly
to 0 as k ! 1. Assume we want to compute a good
approximation to S using the rst n values ak . Then
our rst algorithm is:
Algorithm 1. p
d = (3 + 8)n ; d = (d + 1=d)=2;
Initialize:
b = 1; c = d; s = 0;
For k = 0 up to k = n 1, repeat:
c = b c; s = s + c  a k ;
b = (k + n)(k n)b=((k + )(k + 1)); 1
2
Output: s=d.

This algorithm computes an approximation to S as a


weighted sum of a0 ; : : : ; an 1 with universal rational
Keywords: Convergence acceleration, alternating sum, Chebyshev coecients cn;k =dn (= c=d in the notation of the
polynomial. algorithm; note that both c and d are integers). For
AMS Classi cation: 11Y40 instance, for n = 1, 2, 3, 4 the approximations given

c A K Peters, Ltd.
1058-6458/2000 $0.50 per page
Experimental Mathematics 9:1, page 3
4 Experimental Mathematics, Vol. 9 (2000), No. 1

by the algorithm are the interchange of summations being justi ed by the


2a0 =3; positivity. Let fPn (x)g be a sequence of polynomials
such that Pn has degree n and d~n := Pn ( 1) 6= 0.
(16a0 8a1 )=17; Set
(98a0 80a1 +32a2 )=99; n 1
Pn ( 1) Pn (x) = X c~n;k xk :
(576a0 544a1 +384a2 128a3 )=577; 1+x k=0
respectively. The denominator dn grows like 5:828n De ne S~n as Sn in the proposition but with d~n and
and the absolute values of the coecients cn;k de- c~n;k instead of dn and cn;k . Then
crease smoothly from dn 1 to 0. Proposition 1 Z 1
below proves that for a large class of sequences fak g S~n = P (1 1) Pn ( 1) 1 + x
Pn (x) d = S R ;
n
the algorithm gives an approximation with a relative n 0
accuracy of about 5:828 n , so that to get D decimal say, with
digits it suces to take n equal to approximately Z 1
1.31D. Notice that the number of terms and the Rn = P ( P1)(1 n (x)
+ x) d ; (3)
time needed to get a given accuracy are essentially 0 n
independent of the particular series being summed, and by virtue of the positivity of d we can estimate
if we assume that the ak 's themselves are either easy the \error term" Rn by
to compute or have been precomputed; on a Sparc- Z 1
station 5 using Pari, for instance, the computation M
jRnj  jP ( 1)j 1 +1 x d = jP M( n1)j S;
n
of S to 100 or 1000 decimal digits requires about .1 n 0 n
or 6 seconds, respectively. The algorithm uses O(1) where Mn is the supremum of jPn (x)j on [0; 1]. It
storage and has a running time of O(1) per value of follows that Mn =jPn ( 1)j is an upper bound for the
ak used. relative error made by approximating S by S~n .
Proposition 1. For integers n  k  0 set
We now choose for Pn (X ) the polynomials de ned
p n p n by
dn = (3 + 8) + (3 8) (1) Pn (sin2 t) = cos 2nt; (4)
2
and so that Pn (x) = Tn (1 2x) where Tn (x) is the or-
k   ! dinary Chebyshev polynomial. Clearly Mn = 1 and
cn;k = ( 1)k dn
X n n + m 22 m d~n = Pn ( 1) = dn with dn as in (1).
m=0 n + m 2 m The recursion
n  
= ( 1) k X n n + m 22m :
Pn+1 (X ) = 2(1 2X )Pn (X ) Pn 1 (X )
m=k+1 n + m 2 m (2)
implies by induction the explicit formula
Assume that the ak are the moments of a positive n  
Pn (X ) = ( 1)m n +n m n 2+mm 22m X m ; (5)
X
measure on [0; 1] and set
1 n 1 m=0
Sn = cdn;k ak :
X X
S = ( 1)k ak ; so c~n;k = cn;k with cn;k as in (2). This completes the
k=0 k=0 n proof of the proposition. 
Then Remarks. 1. The method implicit in Proposition 1 is
jS Snj  dS  2 p S : well known in numerical analysis under the head-
n (3 + 8)n ing of \Pade type approximation" [Brezinski 1980;
R1
Proof. By assumption, ak = 0 xk d, where d is a Eiermann 1984; Gustafson 1978/79; Wimp 1981].
positive measure. Then As we mentioned above, we are concerned with cal-
1 Z 1 culations to a high degree of accuracy, where the
S = ( 1)k ak = 1 +1 x d;
X
number of digits gained per number of steps, and the
k=0 0 amount of storage required, are crucial. Thus our
Cohen, Rodriguez Villegas, and Zagier: Convergence Acceleration of Alternating Series 5

emphasis is di erent from that in numerical analy- to a much wider class of series, and also, as is usual
sis, where one usually works in xed, and relatively in acceleration methods, to many divergent series.
low, precision. The implementation of Algorithm 1 7. The choice of the Chebyshev polynomial can be
is good in both respects. shown to be close to optimal if we estimate the re-
2. The classical algorithms found in the literature mainder term Rn crudely as we did above. On the
(see [Press et al. 1988]) are Euler's method or Euler{ other hand, as we will see below, for a di erent class
Van Wijngaarden's method. These can be shown to of alternating series, we can estimate Rn more pre-
correspond respectively to the polynomials Pn (X ) = cisely and nd much better polynomials Pn . The
(1 X )n with convergence like 2 n and polynomials corresponding algorithms and their analysis seem to
Pn (X ) = X a (1 X )b with a + b = n dependent on be new.
the particular sequence, with convergence like 3 n
for a = n=3. Note that a direct implementation of 8. If the sequence ak already converges at a geomet-
the algorithm given in [Press et al. 1988] needs a lot ric rate, better algorithms are possible which are
of auxiliary storage if we want high accuracy, while trivial modi cations of the ones presented in this
our method does not. paper. For example, if one knows in advance that
3. Algorithm 1 computes \on the y" the coe-
ln(ak )  k ln(z ) for some
p z  1, thenpin Algo-
cients of the polynomial (Pn ( 1) Pn (X ))=(1+ X ), rithm 1 simply replace 3+ 8 by 2z +1+2 z (z + 1)
where Pn (X ) = Tn (1 2X ). Equivalently, we could and multiply by z the right hand side of the recur-
also compute on the y only the coecients of the p formula for b. The convergence is in (2z + 1 +
sion
polynomial Pn (X ) itself and use the partial sums 2 z (z + 1)) n , and thus faster than the direct ap-
of the alternating series instead of the individual plication of Algorithm 1. Similar modi cations are
terms, using valid for the other algorithms of this paper. The
n n   m details are left to the reader.
cn;k ak = n +n m n2+mm 22m ( 1)k ak :
X X X1
To illustrate Algorithm 1, we give a few examples.
k=0 m=1 k=0 Each can also be treated individually using speci c
This can be particularly useful when the sequence of methods.
partial sums is naturally given, and not the ak them-
selves, as in the continued fraction example men- Example 1. By taking logarithms we can compute the
tioned at the end of this paper. product
4. The hypothesis that the an 's are moments of a
1 (1 + 2n1 1 )
positive measure on the interval [0,1] is a well known A :=
Y
one, and is equivalent by a famous theorem of Haus- n=1 (1 + 21n ) = 1:0621509055 : : :
dor [1923] to the total monotonicity of the sequence
fan g, in the sense that for each xed k, the sequence rapidly to high accuracy. The product is slowly con-
fk an g of the k-th forward di erences of fang has vergent and the gamma function is hard to compute,
constant sign ( 1)k . so our method is very useful here. In fact, as we will
5. In addition to this, trivial modi cations are pos- see below, Algorithm 2B is even better in this case.
sible. For example, one can replace the step d =
(d + 1=d)=2 by the simpler one d = d=2, since this Example 2. Similar remarks apply to the sum
modi es the nal result by a negligible amount, but 1  
leaves d as a nonintegral value. We could also im- B :=
X
( 1)n Li 2 = 1:1443442096 : : :
mediately divide by d (initializing b to 1=d and c n=2
2
n
to 1). In our implementation each of these modi-
P
cations led to slower programs. where Li2 (x) = 1 k=1 x =k is the dilogarithm func-
k 2
6. We proved convergence of the algorithm (at a tion. This sum arose in connection with the compu-
rather fast geometric rate) under the above condi- tation of a certain de nite integral related to Khin-
tion. However, examples show that it can be applied chin's constant [Borwein and Crandall  2000].
6 Experimental Mathematics, Vol. 9 (2000), No. 1

Example 3. The Riemann zeta function can be calcu- from the bound 1=d655  7  10 502 of Proposition
lated for reasonable values of the argument by 1.
1 n
1 2  (s) = (n( +1)1)s ; If we make di erent assumptions on the sequence
 X
1 s

n=0 fak g, we can use better polynomials than the Cheby-


and we nd values like  ( 2 ) = 1:4603545088 : : : or
1
shev polynomials. For example, we can reason as
even follows. Assume that d = w(x) dx for a smooth
function w(x). Then taking Pn (X ) and dn as in (4)
 ( 1 + i) = 0:0168761517 : : : 0:1141564804 : : : i and (1) respectively and setting x = sin2 t, we get
to high accuracy and very quickly (comparable to from (3)
Z =2
Euler{Maclaurin). Note that the latter example
cos(2nt) w(sin t) sin 2t dt
2

works even though the coecients ak of our \al- dn Rn =


P 1 + sin t
2

ternating" series ( 1)k ak are not alternating or 0


Z =2
even real and do not tend to zero. The derivatives = cos(2nt) h(t) dt
of  (s) can also be calculated similarly, e.g. we can 0

compute for a smooth function h(t). If we integrate twice by


X1 ( 1)n log n parts, we get
C1 := pn = 0:1932888316 : : :
dn Rn = 4n1 2 ( 1)n c1 + c2

n=1
by Algorithm
p 1,pand then use the identity C1 = 1 Z =2 cos(2nt) h00 (t) dt; (6)
(1 2)  0 ( 12 ) + 2 ln 2  ( 12 ) to deduce the value of 4n2 0
 0( 12 ) = 3:9226461392 : : : . In a similar manner, we
can compute for some constants c1 = h0 (=2) and c2 = h0 (0).
1 If we multiply both sides of this equation by n2 ,
C2 = ( 1) nlog n = 0:1598689037 : : :
X n
then the rst term 41 (( 1)n c1 + c2 ) has period 2.
n=1 This suggests replacing the polynomial Pn (X ) by
by Algorithm 1, and then use the identity C2 = the polynomial
log 2( 1=2 log 2) to deduce the value of Euler's Pn(1) (X ) = n2Pn (X ) (n 2)2 Pn 2 (X ) :
constant = 0:5772156649 : : : .
Moreover, as suggested to us by R. Sczech, we It is then easily seen that for the new remainder
may even use Algorithm 1 to sum the divergent se- Rn(1) we have dn Rn(1) = O(1=n5) instead of O(1=n2 ).
ries Hence for our purposes Pn(1) is a better polynomial
1
X than Pn . Notice also that
C = ( 1)n log n = 0:2257913526 : : : ;
Pn(1) (sin2 t) = 21 dtd 2 sin(2t) sin(2(n 1)t) :
3
2 
n=1
recovering the known value 12 log( 2 ) of the deriva- Continuing in this way, we de ne a double family of
tive of (1 21 s ) (s) at s = 0. polynomials Pn(m) as the m-th di erence (with step
Note that in the rst two examples ak was in fact 2) of the sequence nm+1 Pn (where we set P n = Pn
the restriction at points of the form 1=k of a function for n > 0 since cos(2nt) is an even function of n),
analytic in the neighborhood of 0, and so other tech- and nd that for m > 0
niques could be used such as expanding explicitly ak Pn(m) (sin2 t) = 21 dtd m+1 sin(2t)m sin(2(n m)t)
 
in powers of 1=k. However, in the last examples, this
cannot be applied. The corresponding remainder term Rn(m) satis es
Computing the constants Ci for i = 1; 2; 3 using dnRn(m) = O(1=n2m+2 )
algorithm 1 with n = 655 took about 20 seconds in
a Gp-Pari implementation on a 300 MHz computer (and even O(1=n2m+3 ) if m is odd) as n ! 1 for
running Linux. The relative errors were: 5  10 504 xed m, so we get better and better sequences of
for C1 , 5  10 506 for C2 and 2  10 500 for C3 , not far polynomials.
Cohen, Rodriguez Villegas, and Zagier: Convergence Acceleration of Alternating Series 7

As polynomials in X , these polynomials can be TWO FLAVORS OF THE SECOND ALGORITHM


computed either from the formula giving the m-th Algorithm 1 can be immediately generalized to any
di erence, i.e., sequence Qn of polynomials, except that the coef-
 
cients of Qn cannot be computed on the y, thus
( 1) mr (n 2r)m+1 Pn 2r (X )
X
(m) r
Pn (X ) = giving rise to the following family of algorithms.
0r m

(where we naturally set P n (X ) = Pn (X )) or by the Algorithm 2Q .


Pn
formulas Q X
Let n ( ) = k=0 k b Xk.
d Q
Set = n ( 1); = c d; s = 0;
Pn(m)(X ) = 2m+r 1 (D)r s k
For = 0 up to = k n 1, repeat:
n m 1
X

2 n 2 m
  c = bk c; s = s + c  a k ;
 k
( 1) 2k+1 X (1 X )k +r n m 1 k+r
Output: s=d.
k=0
where m + 1 = 2r + s with 0  s  1, In particular, applying this to the families Qn =
An and Qn = Bn (de ned in (7) and (8) respec-
D = dXd ; and  = 2X (1 X ) d + 1 2X: tively), we obtain two algorithms 2A and 2B which
dX are of the same sort as Algorithm 1 in that they out-
This suggests taking either the diagonal sequence put an approximation Sn which is a universal ratio-
nal linear combination of a ; : : : ; an . The values
0 1
An = Pn(n 1) =(2n 1 n!) (7) for n = 1 and n = 2 are 2a =3, (16a 8a )=17
0 0 1

or the sequence as before, while those for n = 3 and n = 4 are



(110a 90a + 36a )=111 and (2288a 2168a +
0 1 2 0 1

Bn = Pn(m) = (n m)(m + 1)! 2m (8) 1536a 512a )=2191, respectively (since An = Bn


2 3
for n  4, the coecients are the same for both
with m = bn=2c, where the (unimportant) normal- algorithms up to that point).
izing constants have been chosen so that An (0) = We now analyze the speed of convergence of these
Bn(0) = 1 (other ratios between m and n could algorithms. For Algorithm 2A we will nd that it is
be considered and we will brie y comment on this like 7:89 n for a large class of sequences fak g and
later). like 17:93 n for a smaller class, both better than the
The rst few values are 5:83 n we had for Algorithm 1.
A0 (X ) = 1; For the same two classes of sequences, Algorithm
2B will be like 9:56 n and 14:41 n . In other words,
A1 (X ) = 1 2X; depending on the sequence Algorithm 2A or 2B may
A2 (X ) = 1 8X + 8X 2 ; be the better choice.
A3 (X ) = 1 20X + 54X 2 36X 3 ; On the other hand, unlike Algorithm 1, we do
not have a quick way to compute the individual co-
and Bn (X ) = An (X ) for n  4. ecients cn;k in time O(1) each but must compute
Note that the formulas giving the polynomials An (and store) the whole polynomial An (X ) or Bn (X ).
are particularly simple: we have As a result, these algorithms require storage O(n)
and time O(n ) instead of O(1) and O(n) as before.
An(sin2 t) = 2n1n! dtd n sinn 2t ;
n 
2

(9) Thus they are inferior to Algorithm 1 if the numbers


ak are easy to compute (like ak = 1=(k + 1)), but
and superior to it if the main part of the running time is
2r  d d 2
r
devoted to the computation of the ak (as in Exam-
An (X ) = (2r)! (1 2X ) dX + 2(X X ) dX 2 2
ples 1 or 2 above), or in the extreme case when we
X r (1 X )r (1 2X )s
 only know a xed number of values a ; a ; : : : ; an
0 1 1
and
P
want to make the best guess of the value of
if n = 2r + s with 0  s  1. ( 1)k ak on the basis of this data.
8 Experimental Mathematics, Vol. 9 (2000), No. 1

To state the result we need the constants de ned Here are a few simple examples. We set = Q
by and = Q with Q = A or Q = B , depending on
A = cosh A = 7:8898395 : : : ; whether Algorithm 2A or 2B is used.
B = e B = 9:55699 : : : ; Example 4. Set ak = 1=(k + 1), S = log 2. Here
A = A r0 = 17:9340864 : : : ; w(x) = 1, so the proposition applies directly to give
B = B pr0 = 14:408763 : : : : speed of convergence n . Hence in this case Algo-
rithm 2A is better than Algorithm 2B ,
Here A = 2:754682 : : : and B = 2:2572729 : : : are
the unique real roots of A tanh A = 2L and Example 5. Set ak = 1=(2k + 1), S = =4. Here
B e p B sinh B = 2p L, respectively, where L = w(x) = 12 x 1=2, so xw(x2 ) is analytic and we again
log(1 + 2), and r0 = 4t0 = sin 4t0 = 2:27306 : : : , get convergence n . Once again Algorithm 2A is
where t0 = 0:652916 : : : is the unique root in [0; =2] better.
of t20 + L2 = 21 t0 tan 2t0 . p
Example 6. Set ak = 1=(3k +1), S = (log 2+ = 3)=3.
In addition, let CA be the union of the images in Here w(x) = 31 x 2=3 with a singularity at 0, so the
the complex plane of the two maps convergence is like n . Hence in this case Algo-

t 7! sin2 t (sin(2t)=2)(cos(2t)  i sin(2t)) ; rithm 2B is better than Algorithm 2A .
for 0  t  =2, and let CB be the union of the Example 7. Set ak = 1=(k + 1)2 , S =  2 =12. Here
images in the complex plane of the two maps w(x) = log(1=x), again with a singularity at 0, so
 we get n convergence. The same applies to ak =
t 7! sin2 t (r0 sin(2t)=2) 1=(k +1)s , where w(x) is proportional to logs 1 (1=x)
p  and the convergence is again like n . Again Algo-
r0 cos(2t)  i 1 r02 cos(2t)2 ;
rithm 2B is better.
for t0  t  =2 t0 (see Figure 1). Example 8. Set ak = 1=(k 2 +1), S = 12 + =(e e  ).
Proposition 2. Assume that the coecients ak are Here w(x) = sin(log(1=x))=x, again with conver-
given as moments , gence like n . Again Algorithm 2B is better.
Z
Proof of Proposition 2. We rst consider the case of
1
ak = w(x) xk dx: Algorithm 2A . The rst thing we need to know is
0

For Q = A or Q = B , let RnQ = S SnQ be the the asymptotic behavior of An ( 1). According to
di erence between the true value of S and the output Lagrange's formula, if z = a + w'(z ) with ' analytic
SnQ of Algorithm 2Q . around a then
1 n
1. If w(x) extends analytically to the interior of the
dz = X d ('n (a)) wn
region bounded by the Curve CA, then for Q = A da n=0 dan n! (10)

or Q = B , jRnQ j is bounded by ( Q + o(1)) n .


2. If w(x) extends analytically to the whole com-
(di erentiate [Hurwitz and Courant 1929, p. 138,
plex plane (or only to the interior of the region eq. (8)] with respect to a taking f (z ) = z , for exam-
bounded by the Curve CB ), then for Q = A and ple). Choosing '(z ) = sin 2z; w = u=2 and a = t in
Q = B , jRnQ j is bounded by ( Q + o(1)) n . combination with (9) yields the identity
1
In fact the proof will show that to get convergence = 1 u1cos 2z
X
like Q n we can allow singularities xm 1=2 (m  0) An(sin 2
t) un (11)
n=0 z u sin 2z=t
at the origin (i.e., it is sucient if xw(x2 ) rather 2

than w(x) itself be analytic). If w is analytic in a and in particular


smaller region than those described in Proposition 1
= 1 u1cos 2z
X
2, then we still get exponential convergence of SnQ An ( 1) un ;
to S , but with a worse constant. n=0 z u2 sin 2z=iL
Cohen, Rodriguez Villegas, and Zagier: Convergence Acceleration of Alternating Series 9

2i CB
i D(r )
0
iL i
D(1) CA

0 1 2 1 0 1 2

iL i
i
2i

FIGURE 1. The sets CA and CB.


p
where pL = log( 2+1) (or, more precisely, any value and doing the integration by parts, we obtain
 log( 2 + 1) + in). To nd the limiting value of Z 1
jAn ( 1)j1=n , we need to look at the values of u for An ( 1) Rn = An (x) 1w+(xx) dx
A
which the expression on the right becomes singular. 0
Z =2
This clearly happens if u cos 2z = 1 for a value of z = An(sin t) h(t) dt
2

with 0
Z =2 n
z (u=2) sin 2z = iL: 1
= 2n n! d sinn(2t) h(t) dt
dtn
The smallest value of juj occurs for z = i A =2 and
0
Z =
n (2t) d h(t) dt;
n n
= (2n1)
2

equals 1= A , with A and A as in the proposition. n! 0 sin dtn


Hence lim supn!1 jAn ( 1)j1=n = A . A more care-
ful analysis gives so by Taylor's theorem
1 Z =2 
h t u2 sin 2t dt:
p X 
An ( 1)  2 An+1=2 = n( A2 1) A
An ( 1) Rn u = n
n=0 0

or even an asymptotic expansion, but we will not As t goes from 0 to =2 for a xed (complex) value
use this. of u, the argument t u2 sin 2t moves along a path
Now if we used the proof of Proposition 1 directly Cu connecting the points 0 and =2. If for some
the error term RnA would be estimated essentially by rS> 0 the function h(t) is entire in the region D(r) =
Mn =An ( 1), where C , then the above integral representation of
Pjujr u
Mn = 0max jA (x)j: An ( 1) RnA un shows that this sum is analytic in
x1 n the disc juj < r and hence that
Using (11), one can show that this number grows lim sup jAn ( 1)RnA j1=n  1=r:
like (1:5088 : : : )n (the maximum is attained at x = 12 n!1
if n is even), leading to an error estimate of about The best value of r we can hope for (unless w is very
5:23 n , which is worse than we had before. But of special) is the number r0 = 2:27306 : : : , for which
course the motivation for introducting the polyno- the point t = iL lies on the boundary of D(r), since
mials Pn(m) and the diagonal subsequence An was to at this point the denominator 1 + sin2 t of h(t) will
improve the error term by assuming that the func- vanish. (The value of r0 can be computed
p by simple
tion w(x) or h(t) was smooth and use repeated in- calculus: r0 is the minimum pof 2 t2 + L2 =jsin 2tj for
tegration by parts; see (6). Making this assumption t 2 [0; =2] and is equal to 4t0 = sin 4t0 with t0 as
10 Experimental Mathematics, Vol. 9 (2000), No. 1

in the proposition.) This then leads to the estimate before), but with the numbers and occurring
lim supn!1 jRnA j1=n  A 1 with A = r0 A , and is there replaced by
valid whenever h is analytic in D(r0 ) or equivalently, 1
whenever w is analytic in the region fsin2 t j t 2  = e (cosh +  sinh ) =  ; ( +1)

D(r0)g, which is the region bounded by Curve CB in  = r =   ;


1 ( +1)

Figure 1. If w(x) has a singularity within this region


0

then we get a worse estimate. In particular, if w(x) where =  is a root of 1=(coth +  ) = 2L


has a singularity at the origin, as in the examples and r = 2:2736 : : : is the same number as before.
0

3{6 above and many others, then the convergence of It can be shown that  = 0, i.e. Algorithm 2A ,
SnA to S will be like A n if h(t) has no singularities in gives the largest value of  , and that  = 1, i.e. Al-
D(1), since r = 1 is the largest value of r for which gorithm 2B , gives the largest value of  , whence the
0 is not in the interior of D(r). The boundary of choice of these two algorithms. (Note: the largest
the region fsin2 t j t 2 D(1)g is shown as Curve CA value of  is in fact obtained for  = 0:123559 : : : ,
in Figure 1. but we must restrict to non-negative values of 
The case of Algorithm 2B is very similar, but since otherwise more than n terms of the sequence
slightly more complicated. We sketch it brie y. To fak g are used.)
be able to apply Lagrange's formula (10), we intro- 2. We do not claim that the sequences of polyno-
duce mials that we have given give the best results, only
 m   that they are natural choices. Other sequences of
Cm (t) = m!12m dtd e 2it
2it m
(e sin 2t) sin 2t polynomials Pn can be used for linear acceleration
of alternating sequences which for certain classes of
so that sequences fak g will give even better convergence.
These sequences of polynomials are related to poly-
B2m (sin2 t) = Cm+1 (t) 2+imCm+1( t) for m > 0 : nomials which are used in Diophantine approxima-
tion to get good irrationality measures for numbers
Then a similar use of Lagrange's formula (10) shows such as log 2,  or  (3), following the works of Apery,
that Beukers, Rhin et al.
lim sup jCm (iL)j1=m = B2 ; 3. For sequences fak g for which w(x) is analytic
m!1
in an even larger region than the one bounded by
so that lim sup jBn ( 1)j1=n = B when n ! 1 Curve CB, we can improve the 17:93 n bound for
through even values of n. A similar proof shows Algorithm 2A by taking a linear combination of ak
that the same holds for odd values. and some standard sequence like
The rest of the proof is essentially unchanged, still
using the functions Cm (t). Since e2it is of modu- ak = k +1 1
0

lus 1 when t is real, the domains of analycity re-


quired for w(sin2 t) are still the same. We thus ob- to force w(x) to vanish at 1. Then
tain lim supm!1 jB2m ( 1)R2Bm j1=m  1=r0 and simi-
larly for 2m +1, hence lim supn!1 jBn ( 1)RnB j1=n  Sn = S + w( 1)(Sn S ) + "n ;
0 0

p
1= r0 as claimed.  where the error term "n tends to 0 faster than before
Remarks. 1. More generally we can consider Algo- (and even more than exponentially if w(x) is entire,
rithm 2Q with Qn proportional to Pn(m) with m = since the modi ed series
n=(1 +  ) + O(1) and  > 0, Algorithm 2A corre- X Z =2
sponding to  = 0 and Algorithm 2B to  = 1 (the Qn( 1)Rn =un (entire in t, u) dt
exact choice of m has no e ect on the speed of con- 0

vergence of the algorithm). The same analysis as has in nite radius of convergence), and using this
before shows that the analogue of Proposition 2 re- with two di erent values of n to eliminate the w( 1)
mains true (with the same curves CA and CB as term we get improved approximations to S .
Cohen, Rodriguez Villegas, and Zagier: Convergence Acceleration of Alternating Series 11

APPLICABILITY shows that one can rewrite S as an \alternating"


Since we have given three algorithms, some advice sum
is necessary to be able to choose between the three. S = qbq1 qb1bq2 + bq1bq2b3    ;
If the sequence fak g is very easy to compute and
0 1 1 2 2 3

not too many decimal digits are required (say at where the qi are de ned by q 1 = 0, q0 = 1 and
most 1000), we suggest using Algorithm 1, which qn = cn qn 1 + bnqn 2 , and we can then apply one of
has the advantage of being by far the simplest to the given algorithms to the sequence
Q
implement and which does not require any storage. b
This is the default choice made in the Pari system ak = 1qjqk+1 j :
k k+1
for example. Note that frequently continued fractions converge
If the sequence fak g already converges to 0 at a geometrically (this is true for example in the case
geometric rate, then w(x) cannot be analytic and of simple continued fractions, i.e. bk = 1 for all k
hence Algorithm 1 should again be chosen, taking and ak positive integers) hence Remark 8 on page 5
into account Remark 8 on page 5. must be taken into account, and Algorithm 1 should
If the sequence fak g is dicult to compute or if a usually be preferred.
large number of decimal digits are desired, it should
be better to use Algorithms 2A or 2B . Since a priori
one does not know the analytic behavior of w(x), REFERENCES

in view of the examples which have been presented, [Borwein and Crandall  2000] J. Borwein and R.
w(x) has frequently a singularity at x = 0, hence we Crandall, In preparation.
suggest using Algorithm 2B . Of course, if we know [Brezinski 1980] C. Brezinski, Pade-type approximation
that w(x) is much better behaved, then Algorithm and general orthogonal polynomials, Intern. Series of
2A becomes useful also. Numer. Anal. 50, Birkhauser, Basel, 1980.
[Eiermann 1984] M. Eiermann, \On the convergence
EXTENSION TO CERTAIN NONALTERNATING SERIES of Pade-type approximants to analytic functions", J.
Comput. Appl. Math. 10:2 (1984), 219{227.
The algorithms given can also be used in cases where _ Gustafson, \Convergence
alternating series occur only indirectly. [Gustafson 1978/79] S.-A.
A rst example is the summation of series with acceleration on a general class of power series",
Computing 21:1 (1978/79), 53{69.
positive terms. Using a trick due to Van Wijngaar-
den and described in [Press et al. 1988], such a series [Hausdor 1923] F. Hausdor , \Momentprobleme fur ein
can be converted to an alternating series as follows: endliches Intervall", Math. Z. 16 (1923), 220{248.
1
X 1
X 1
X [Hurwitz and Courant 1929] A. Hurwitz and R. Courant,
ak = ( 1)m bm with bm = 2k a2k m : Vorlesungen uber allgemeine Funktionentheorie und
k=1 m=1 k=0 elliptische Funktionen, Springer, Berlin, 1929.
In this case the coecients bm of the alternating [Press et al. 1988] W. H. Press, B. P. Flannery, S. A.
sum are themselves in nite sums, hence are hard to Teukolsky, and W. T. Vetterling, Numerical recipes in
compute, and so it is usually useful to use Algorithm C, 2nd ed., Cambridge University Press, Cambridge,
2B instead of Algorithm 1. 1988.
A second example is the computation of continued [Wimp 1981] J. Wimp, Sequence transformations and
fractions S = b1 =(c1 + b2 =(c2 +   )) with bk and ck their applications, Math. in Sci. and Engin. 154,
positive. The standard theory of continued fractions Academic Press, New York, 1981.
12 Experimental Mathematics, Vol. 9 (2000), No. 1

Henri Cohen, Laboratoire d'Algorithmique Arithmetique et Experimentale (A2X), Universite Bordeaux I, 33405
Talence, France (Henri.Cohen@math.u-bordeaux.fr)
Fernando Rodriguez Villegas, Department of Mathematics, University of Texas at Austin, Austin, TX 78712, USA
(villegas@math.utexas.edu)
Don Zagier, Max Planck Institut fur Mathematik, Gottfried Claren Strasse 26, 53225 Bonn, Germany
(don@mpim-bonn.mpg.de)

Received December 7, 1998; accepted January 25, 1999

You might also like