Professional Documents
Culture Documents
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.
emphasis is dierent 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 dierent 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 modications 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 modications 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 specic
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 dierences 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 modications 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
modies 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 denite 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 dierent assumptions on the sequence
X
1 s
To state the result we need the constants dened 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 = eB = 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 pB 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
dierence 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)
2i CB
i D(r )
0
iL i
D(1) CA
0 1 2 1 0 1 2
iL i
i
2i
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 = iA =2 and
0
Z =
n (2t) d h(t) dt;
n n
= (2n1)
2
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)
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
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 modied 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 eect on the speed of con- 0
vergence of the algorithm). The same analysis as has innite radius of convergence), and using this
before shows that the analogue of Proposition 2 re- with two dierent 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
not too many decimal digits are required (say at where the qi are dened 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 innite 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)