<<

Lecturas Matem´aticas Volumen 27 (2006), p´aginas 21–25

Even from Gregory-Leibniz π could be computed: an example of how convergence of series can be accelerated∗

Vito Lampret University of Ljubljana, Ljubljana, Slovenia

∞ (−1)j+1 π Abstract. Gregory-Leibniz series Σj=1 2j−1 = 4 ,isdiscussedin literature as an example of beautiful, interesting and simple analytic ex- pression for π. Unfortunately, this series is considered by most authors as unsuitable for computation of π. It is shown that, using a simple transformation of the series and applying the Euler–Maclaurin summa- tion formula, slow convergence can be accelerated to the point where numerical computation of π can be performed accurately to several dec- imal places. It is also suggested that the Euler–Maclaurin formula, of some low order, should be included in the undergraduate curriculum. Key words and phrases. acceleration, alternating, convergence, esti- mate, Euler-Maclaurin, Gregory-Leibniz, remainder, series. 2000 AMS Mathematics Subject Classification. 40A05, 40A25, 65B10, 65B15, 97D30, 97D40. ∞ (−1)j+1 π Resumen. La serie de Gregory-Leibniz Σj=1 2j−1 = 4 ,seconoce en la literatura como un ejemplo de una hermosa, interesante y sen- cilla expresi´on anal´ıtica de π. Desafortunadamente, la mayor´ıa de los autores la consideran inapropiada para el c´alculo de π. En esta nota se usa una simple transformaci´on de la serie y una aplicaci´on de la f´ormula sumaci´on de Euler-Maclaurin para mostrar c´omo esta conver- gencia lenta puede acelerarse hasta el punto de que el c´alculo num´erico de π nos produzca un valor bastante preciso con varias cifras decimales. Tambi´en se sugiere que la f´ormula de Euler-Maclaurin debiera incluirse en los cursos de matem´aticas del pregrado.

∗ Since next year is the third-centenary of Euler’s birth, April 15, 1707, we dedicate this contribution to him, the main creator of the famous Euler-Maclaurin formula. 22 Vito Lampret

It seems that the Gregory-Leibniz series, figuring in the identities

π ∞ − j+1 ∞ − k ( 1) ( 1) , (1) = j − =1+ k 4 j=1 2 1 k=1 2 +1 is not suitable for computation of π. Indeed, from the well known Leibniz estimate† [6, p. 216-217]

n 0 ≤ an+1 − an+2 ≤ (−1) rn ≤ an+1   ∞ ∞ k+1 of remainder rn := k=n+1 ak of k=1(−1) ak, where an monotonically decreasingly converges to zero, we obtain, for the remainder in series (1), the estimate

2 n 1 (1a) ≤ (−1) rn ≤ , (2n + 1)(2n +3) 2n +1 valid for every positive n. Unfortunately, this estimate indicates slow convergence of series (1). To compute π from (1), using (1a), to six decimal places for example, we need to sum up much more than five millions terms of series (1) due to rounding the terms of series during the calculations. Figure n 1 illustrates relation (1a) by showing the graphs of n → (−1) rn ≡ π 4 − sn and n → 1/(2n + 1) for series (1).

0.003 0.0025 0.002 0.0015 0.001 0.0005

200 400 600 800 1000

n Figure 1: Graphs of sequences n → (−1) rn and n → 1/(2n + 1).

In order to accelerate convergence in (1) we first substitute alternating con- ditionally convergent series (1) by absolutely convergent one. Indeed, in partial sums of (1) with even indexes, we collect pairwise the terms with odd and even

†This estimate is sharp as it could be seen from the example of . Even from Gregory-Leibniz series π could be computed 23 indexes 2n − k n n ( 1) 1 − 1 k = i i − k=1 2 +1 i=1 4 +1 i=1 4 1 n − 2 . = i2 − i=1 16 1

This way, using (1), we get the expression π ∞ − 1 . (2) =1 2 i2 − 4 i=1 16 1 The obtained series converges faster than the original one. To accelerate also convergence in (2) we use the Euler-Maclaurin summation formula of order four [3, p. 320, Theorem ] or [4, p. 119, Theorem 2]. It says that for any 4 (4) m ∈ N and any function f ∈ C [1, ∞), such that f (x) does not change sign f n f  n f (3) n ∞ f (4) x  dx and limn→∞ ( ) = limn→∞ ( ) = limn→∞ ( )=0and 1 ( ) converges, there exists a number ω(m), depending on m, such that

∞ m−1    ∞ f(m) f (m) (3) f(k)= f(k)+ f(x) dx + − + ω(m) · f (3)(m) k=1 k=1 m 2 12 and 1 (3a) 0 ≤ ω(m) ≤ . 384

The infinite series in (2) originates from function ϕ :[1, ∞) → R, such that 1 (4) ϕ(x) ≡ 16x2 − 1 32x (4a) ϕ(x) ≡− < 0 x2 − 2 (16 1) 32 48x2 +1 (4b) ϕ(2)(x) ≡ > 0 x2 − 3 (16  1)  6144 16x3 + x (4c) ϕ(3)(x) ≡− < 0 x2 − 4 (16 1)  4 2 (4) 6144 1280x + 160x +1 (4d) ϕ (x) ≡ 5 > 0. (16x2 − 1)

Because   ∞ 1 4m +1 ϕ(x) dx = ln , m 8 4m − 1 24 Vito Lampret we obtain from equations (3)–(3a) and (4)–(4c), for any m ∈ N, the following expression ∞ m−1   1  1 1 4m +1 1 = + ln + 16i2 − 1 16i2 − 1 8 4m − 1 2(16m2 − 1) i=1 i=1   8m 6144 16m3 + m + 2 − ω(m) · 4 . 3(16m2 − 1) (16m2 − 1) Hence, from (2) we conclude

(5) π = πm + ρm , where

m−1   1 4m +1 4 64m (5a) πm =4− 8 +ln + + i2 − m − m2 − 2 2 i=1 16 1 4 1 16 1 3(16m − 1) and (5b)   6144 16m3 + m ≤ ρ ≤ ω m · < 32 < 1 0 m 8 ( ) 4 4 5 (16m2 − 1) (4m +1)(4m − 1) (2m − 1) for every m ∈ N. Figure 2 shows graphs of sequences m → ρm and m → (2m − 1)−5.

3·10-10 2.5·10-10 2·10-10 1.5·10-10 1·10-10 5·10-11

60 80 100 120 −5 Figure 2: Graphs of sequences m → ρm and m → (2m − 1) .

Using [7] we find from (5a) that π10 =3.1415924875 ... and from (5b) that −7 −7 0 ≤ ρ10 < 4.04 × 10 . Hence 3.141592 ≤ π<3.141592488 + 4.04 × 10 = 3.141592892. This way we determined π to six decimal places π =3.141592 .... We point out that during this computation we have to sum only 13 terms. To obtain more decimal places of π we should increase parameter m. However, m → πm converges relatively slowly and therefore is not suitable for the computation of large number of digits of π. For example, we have −17 −17 π − π1000 > 1.6 × 10 and ρ1000 < 3.2 × 10 . Thus to obtain 17 decimal places we should sum much more than 1000 terms, due to their rounding during Even from Gregory-Leibniz series π could be computed 25 the computation. Faster convergent sequence, originating in series (2), could be obtained using the Euler-Maclaurin formula of higher order than four [4].

References

[1] R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, Reading, MA, 1994. [2] K. Knopp, Theory and Applicattions of Infinite Series, Hafner Publishing Company, New York, 1971. [3] V. Lampret, An Invitation to Hermite’s Integration and Summation: A Comparison between Hermite’s and Simpson’s Rules, SIAM Rev. 46 (2) (2004), 311–328. [4] V. Lampret, The Euler-Maclaurin and Taylor Formulas: Twin, Elementary Deriva- tions, Math. Mag. 74 (2001), 109–122. [5] V. Lampret, Wallis sequence estimated through the Euler-Maclaurin formula: even from the Wallis product π could be computed fairly accurately, AustMS Gazette 31 (5) (2004), 328–339 [6] M. H. Protter and C. B. Morrey, A First Course in 2nd ed, Springer-Verlag N.Y., UTM 1993. [7] S. Wolfram, Mathematica, version 5.0, Wolfram Research, Inc., 1988–2003. (Recibido en septiembre de 2005. Aceptado para publicaci´on en febrero de 2006)

Vito Lampret Faculty of Civil and Geodetic Engineering University of Ljubljana Ljubljana 1000, Slovenia 386 e-mail: [email protected], [email protected]