<<

Physics 2400 Spring 2017

euler-maclaurin formula

lecture notes, spring semester 2017

http://www.phys.uconn.edu/˜rozman/Courses/P2400_17S/

Last modified: May 19, 2017

PN Euler-Maclaurin summation formula gives an estimation of the sum i=n f (i) in terms of R N the f (x)dx and “correction” terms. It was discovered independently by Euler n and Maclaurin and published by Euler in 1732, and by Maclaurin in 1742. The presentation below follows [1], [2, Ch. 6.3], [3, Ch. 1].

1 Preliminaries. Bernoulli numbers

The Bernoulli numbers Bn are rational numbers that can be defined as coefficients in the following power expansion:

x X∞ xn = B . (1) ex − 1 n n! n=0

These numbers are important in , analysis, and differential topology. Unless you are using a computer algebra system for series expansion 1 it is not easy to find the coefficients in the right hand side of Eq. (1). However, it is easy to write

1For example, Series[x/(Exp[x] - 1), x, 0, 6] in Mathematica

Page 1 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

for the reciprocal of the left hand side of Eq. (1):

ex − 1 1 X∞ xk X∞ xk x x2 x3 = = = 1 + + + + .... (2) x x k! (k + 1)! 2 6 24 k=1 k=0 Thus, the Bernoulli numbers can be computer recurrently by equating to zero the coeffi- cients at positive powers of x in the identity ! x ex − 1 x x2 x3  B B  1 = · = 1 + + + + ... · B + 1 x + 2 x2 + ... ex − 1 x 2 6 24 0 1! 2!  B B   B B B  = B + 0 + 1 x + 0 + 1 + 2 x2 + .... (3) 0 2!0! 1!1! 3!0! 2!1! 1!2! − 1 − 1 − 1 − 1 From here, B0 = 1, B1 = 2 B0 = 2 , B2 = 3 B0 B1 = 6 , etc.

1 B = − (4) 1 2 is the only non-zero Bernoulli number with an odd subscript. The first Bernoulli numbers with even subscripts are as following: 1 1 1 1 5 B = 1,B = ,B = − ,B = ,B = − ,B = ,.... (5) 0 2 6 4 30 6 42 8 30 10 66 The first few terms in the Expansion Eq. (1) are as following:

x x x2 x4 x6 x8 x10 = 1 − + − + − + + .... (6) ex − 1 2 12 720 30240 1209600 47900160

2 Preliminaries. Operators Dˆ and Tˆ

If f (x) is a “good” function (meaning that we can apply formulas of differential without ’reservations’), then the correspondence

d f (x) −→ f 0(x) ≡ f (x) (7) dx can be regarded as the operator of differentiation d Dˆ ≡ (8) dx

Page 2 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

that act on the function and transforms it into . Given Dˆ , we can naturally define the powers of the operator of differentiation   d d d2 d2 Dˆ 2f (x) = Dˆ Dfˆ (x) = f (x) = f (x) i.e. Dˆ 2 = , (9) dx dx dx2 dx2 or in general, dn Dˆ n = . (10) dxn We can define functions of the operator of differentiation as following: if g(x) is a “good” function that can be expanded into , X ∞ n g(x) = anx , (11) n=0 then the operator function g(Dˆ ) is defined as following. X ˆ ∞ ˆ n g(D) = anD (12) n=0 Let’s consider the of the differential operator:

n ˆ X∞ Dˆ Tˆ ≡ eD = . (13) n! n=0 When applied to a “good” function f (x),

X∞ 1   X∞ 1 dnf Tˆ f (x) = Dˆ nf (x) = . (14) n! n! dxn n=0 n=0 The last expression in Eq. (14) is just a Taylor series for f (x + 1). Thus,

Tˆ f (x) = f (x + 1). (15)

and Tˆ can be regarded as the shift operator. Shifting by 2 can be considered as a composition of two shift by one operations:   f (x + 2) = Tˆ f (x + 1) = Tˆ Tˆ f (x) = Tˆ 2f (x). (16)

Similarly, shifting by a positive value s can be considered as the result of operator Tˆ s:

f (x + s) = Tˆ sf (x). (17)

Page 3 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

3 Summation of series in terms of operator Dˆ

We can now formally write

X∞ f (x + n) = f (x) + f (x + 1) + f (x + 2) + ... = f (x) + Tˆ f (x) + Tˆ 2f (x) + ... n=0   1 1 = 1 + Tˆ + Tˆ 2 + ... f (x) = f (x) = f (x), (18) 1 − Tˆ 1 − eDˆ where the expression for the sum of geometric progression was used. Treating Dˆ as an ordinary variable, and using Bernoulli numbers, we obtain the expansion:   ˆ X 1 1 D 1  1 ∞ Bn n = − = − 1 − Dˆ + Dˆ  − Dˆ ˆ Dˆ − ˆ  2 n!  1 e D e 1 D n=2 X 1 1 ∞ Bn n 1 = − + − Dˆ − . (19) ˆ 2 n! D n=2

1 The question remaining before Eq. (19) can be applied is what does Dˆ − mean. It is natural to assume that Dˆ satisfies the relation  1  Dˆ Dˆ f (x) = f (x) = f (x). (20) Dˆ Dˆ Therefore 1 has to be an inverse operator to differentiation, that is integration. Dˆ Z 1 f (x) = f (x)dx + C. (21) Dˆ We still need to fix an integration constant i.e. to chose the integration limits. As we see later, we obtain consistent results, if Zx 1 f (x) = f (x)dx, (22) Dˆ ∞ or Z 1 ∞ − f (x) = f (x)dx. (23) Dˆ x

Page 4 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

Collecting the results together,

X Z∞ X n 1 ∞ 1 − ∞ Bn d − f (x) f (x + n) = f (x)dx + f (x) n 1 . (24) 2 n! d x − n=0 x n=2

4 The Euler-Maclaurin summation formula

Equation (24) is the Euler-Maclaurin summation formula. It can be rewritten for the case of a finite sum as following:

N X X∞ X∞ f (k) = f (k) − f (k) k=n k=n k=N+1 X∞ X∞ = f (k) − f (k) + f (N) k=n k=N X∞ X∞ = f (k + n) − f (k + N) + f (N) k=0 k=0 Z Z ∞ ∞ 1 1 = f (x)dx − f (x)dx + f (n) − f (N) + f (N) 2 2 n N X∞ B dn 1f (n) X∞ B dn 1f (N) + n − + n − n! d xn 1 n! d xn 1 n=2 − n=2 − N Z " n 1 n 1 # 1 h i X∞ Bn d − f d − f = f (x)dx + f (n) + f (N) + − . (25) 2 ! n 1 n 1 n dx − = dx − = n n=2 x N x n

5 Stirling’s formula

As an application of Euler-Maclaurin summation formula, let’s consider the Stirling’s approximation for Γ (n) for positive integer n  1.

Γ (n + 1) = n!, (26)

Page 5 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

    Xn ln Γ (n + 1) = lnn! = ln 1 · 2 · 3 · ... · (n − 1) · n = lnk. (27) k=1 The first two terms in Eq. (25) give us the following approximation:

Zn   1 ln Γ (n + 1) = ln(n!) = ln(x)dx + (ln(1) + ln(n)) 2 1 Zn n x 1 = x ln(x) − dx + ln(n) 1 x 2 1 1 = nln(n) − n + 1 + ln(n). (28) 2 The next correction requires more efforts. Let’s notice first that the term with the of ln(x) at x = n in Eq. (25) are propor- tional to negative powers of n and thus → 0 as n → ∞. On the other hand, the sum of the term with the derivatives of ln(x) at x = 1 is a constant independent of n. Thus, nn √  √ nn lnΓ (n + 1) = lnn! = ln + ln n + ln(C) = ln C n , (29) e e or √  n n n+ 1 n Γ (n + 1) = n! = C n = Cn 2 e− . (30) e In order to find the constant in Eq. (30), we are going to use the duplication formula for , Eq. (51). We first rewrite eq. (51) as following:

22n  1 Γ (2n + 1) = √ Γ (n + 1) Γ n + , (31) π 2 or 22n  1 (2n)! = √ n! Γ n + , (32) π 2 Let’s assume without proof that Eq. (30) that we derived for large integer n works also for any large positive argument. It is indeed a reasonable assumption – if Eq. (30) is a good approximation for both Γ (n) and for Γ (n + 1), it works with the same error bound (since Γ (x) is monotoneous for x > 1) in between n and n + 1. Therefore,      n 1 1 1 + 1 Γ n + = Γ n − + 1 ≈ C n − e n 2 . (33) 2 2 2 −

Page 6 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

For n  1, 1  n ( 2n) 2 1 n 1 n 1 n − = n 1 − ≈ n e− 2 . (34) 2 2n Thus,  1 Γ n + ≈ Cnne n. (35) 2 − Substituting Eq. (30), (35) into Eq. (32), we obtain:

2n 2n+ 1 2n 2 n+ 1 n n n C (2n) 2 e− = √ Cn 2 e− Cn e− . (36) π

After simplification, √ C = 2π. (37) Finally, √  n √ n n+ 1 n Γ (n + 1) = n! = 2πn = 2πn 2 e− . (38) e

7

6

Figure 1: Stirling’s approx- 5 imation Eq. (38), solid line, 4 compared with Gamma function, dashed line, and 3 , circular markers. 2

1

0

0.0 0.5 1.0 1.5 2.0 2.5 3.0 x

Page 7 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

6 Examples

Example 1. Lets consider the following sum:

X k ∞ α(n2) S(α,k) = e− , α > 0, k > 0. (39) n= −∞ The case of small α, α  1, is most difficult for a numerical summation, since many terms need to be added in the sum Eq. (39). Small α is where the Euler-Maclaurin approximation works the best. Z∞ k Z∞ α(x2) αx2k S(α,k) ≈ e− dx = e− dx. (40) 0 −∞ Introduction of a new integration variable,

  1 2k u 2k 1 1 1 1 u = αx → x = → dx = α− 2k u 2k − du, (41) α 2k transforms the integral as following:

Z∞ 1   1 1 u 1 1 1 α− 2k 1 α− 2k e− u− 2k u 2k − du = Γ , (42) k k 2k 0 so that 1 α 2k  1  S(α,k) ≈ − Γ . (43) k 2k The approximation Eq. (43) is compared with the results of numerical calculations in Fig.2 and Fig.3.

Example 2. Lets consider the following sum:

X ∞ αn(n+1) S(α) = (2n + 1)e− . (44) n=0

As in the example above, the case of small α, α  1, is most difficult for a numerical summation, since many terms need to be added in the sum Eq. (44). Small α is where the Euler-Maclaurin approximation works the best.

Page 8 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

Figure 2: Euler-Maclaurin approximation Eq. (43), 101 dashed line, compared ) (

with numerical value of the S P αn2 sum S(α,1) = n∞= e− , solid line. −∞

100

10 2 10 1 100

10

Figure 3: Euler-Maclaurin 8 approximation Eq. (43), dashed line, compared 6 ) (

with numerical value of the S P αn4 sum S(α,2) = n∞= e− , 4 solid line. −∞

2

0

10 2 10 1 100

Page 9 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

The integral term of the Euler-Maclaurin approximation,

Z∞ Z∞ αx(x+1) αx(x+1) h i S(α) ≈ (2x + 1)e− dx = e− d x(x + 1) . (45) 0 0 Introduction of a new integration variable,

u = x(x + 1), 0 ≤ u < ∞, (46)

transforms the integral as following:

Z∞ αu 1 S(α) = e− du = . (47) α 0

The approximation Eq. (47) is compared with the results of numerical calculations of the sum Eq. (44) in Fig.4.

Figure 4: Euler-Maclaurin 102 approximation Eq. (47), dashed line, compared with ) (

numerical value of the sum S P αn(n+1) S(α) = ∞ (2n + 1)e , n=0 − 1 solid line. 10

100 10 2 10 1 100

Example 3. Euler-Maclaurin summation formula can produce exact expression for the sum if f (x) is a . Indeed, in this case only finite number of derivatives of f (x) is non zero. Thus there is only a finite number of ’correction’ terms in Eq. (25).

Page 10 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

Let’s consider the following sum: Xn ≡ 3 S3 k . (48) k=1 Euler-Maclaurin expression for the sum is exactly as following,

Zn 1   B   B S = x3 dx + n3 + 1 + 2 3n2 − 3 + 4 (6 − 6) 3 2 2 4! 1 1   1   1   = n4 − 1 + n3 + 1 + n2 − 1 , (49) 4 2 4 1 where we used B2 = 6 . After some algebra, 1 S = n2(n + 1)2, (50) 3 4 which is indeed the correct result.

Appendix A. Duplication formula for Gamma function

The duplication formula for the Gamma function is

22z 1  1 Γ (2z) = √ − Γ (z) Γ z + (51) π 2 It is also called the Legendre duplication formula. We start from the definition of Beta function, B(z,z).

Z1 z 1 z 1 B(z,z) = x − (1 − x) − dx. (52) 0 1+t − ≤ ≤ 1 Let’s change the integration variable to t, x = 2 , so that 1 t 1 and dx = 2 dt. This transforms Eq. (52) into

Z1 Z1 1 B(z,z) = 22 2z (1 − t)z 1(1 + t)z 1dt = 22 2z (1 − t2)z 1dt. (53) − 2 − − − − 1 0 − Page 11 of 12 Physics 2400 Summation of series: Euler-Maclaurin formula Spring 2017

Changing the integration variable in the last integral to u = t2, so that 0 ≤ u ≤ 1 and 1 1 2 dt = 2 u− , we transform the integral to

1 Z   1 2 1 1 1 2 1 B(z,z) = 2 z u 2 (1 − u)z du = 2 zB ,z , (54) − − − − 2 0 i.e. 1  B(z,z) = 21 2zB ,z . (55) − 2 In terms of Gamma function, Γ (z)Γ (z) B(z,z) = , (56) Γ (2z)  1  1  Γ 2 Γ (z) B ,z =   , (57) 2 1 Γ z + 2 so that   Γ 1 Γ (z) Γ (z)Γ (z) 1 2z 2 = 2 −   . (58) Γ (2z) 1 Γ z + 2 √ Rearranging, and using the value of Γ (1/2) = π, we see that

22z 1  1 Γ (2z) = √ − Γ (z)Γ z + , (59) π 2 which is the duplication formula.

References

[1] S. Sadov, “Euler’s derivation of the Euler-Maclaurin formula.” http://www.math.mun. ca/˜sergey/Winter03/m3132/Asst8/eumac.pdf, 2003. [Online; accessed 2016-03- 24]. [2] S. Mahajan, Street-Fighting : The Art of Educated Guessing and Opportunistic Problem Solving. MIT Press, 2010. [3] H. Cheng, Advanced Analytic Methods in Applied Mathematics, Science, and Engineering. LuBan Press, 2007.

Page 12 of 12