Euler-Maclaurin Formula and Stirling Approximation
Total Page:16
File Type:pdf, Size:1020Kb
STIRLING’S FORMULA Bernoulli polynomials are defined recursively in the following manner: We start with B (y) y 1 ≡ Then, we introduce B2(y) by y B2(y) = 2 B1(u)du + C 0 where C is chosen so that 1/2 B2(y)dy = 0 1/2 − yielding 1 B (y) = y2 2 − 12 1 1 Note that B2(y) is an even function of y, implying that (i) B2( 2 ) = B2( 2 ), 1 1 − and (ii) it integrates to 0 both in the ( 2 , 0) and the (0, 2 ) range. The next polynomial is simply − y y B (y) = 3 B (u)du = y3 3 2 − 4 0 Note that (i) it is a odd function of y, and (ii) B ( 1 ) = B ( 1 ) = 0, due to the 3 − 2 3 2 second property of the B2(y) function. This is followed by y y2 7 B (y) = 4 B (u)du + C = y4 + 4 3 − 2 240 0 1 again, an even function which integrates (individually, on each half of the 2 1 − to 2 range) to zero, and y 5 7 B (y) = 5 B (u)du = y5 y3 + y 5 4 − 6 48 0 1 1 (an odd function equal to zero at 2 and 2 ). In this manner, we can continue− indefinitely. The main properties of the resulting polynomials are Bn (y) = n Bn 1(y) − 1 · 1 B2k( 2 ) = B2k( 2 ) bk − 1 1≡ B2k 1( ) = B2k 1( ) = 0 − − 2 − 2 for every positive n and k (with the understanding that B0(y) 1, to meet the first identity with n = 1). Note that, on the second line, we introduced≡ a new symbol bk for the corresponding Bernoulli number (one can easily evaluate these to equal to 1 , 1 , 1 , 1 , 5 , .... for k = 1, 2, 3, 4, 5, ...). 6 − 30 42 − 30 66 1 Exponential generating function of these is defined as ∞ B (y) tn G(y, t) n · (1) ≡ n! n=1 and can be obtained by first differentiating each side of (1) with respect to y, getting n m dG(y, t) ∞ n Bn 1(y) t ∞ Bm(y) t = · − · = t · = t G(y, t) + t dy n! m! · n=1 m=0 Solving this ODE yields G(y, t) = c(t) exp(t y) 1 · · − 1 1 Since integrating (1) over y from 2 to 2 returns zero (each Bn(y) integrates to zero), the same must hold for the− last solution, namely 1/2 exp( t ) exp( t ) c(t) exp(t y)dy 1 = c(t) 2 − − 2 1 = 0 1/2 · − · t − − Solving for c(t), the final formula for the EGF is thus t exp(t y) G(y, t) = · · 1 (2) exp( t ) exp( t ) − 2 − − 2 Based on this, we get two important results, namely 1. By setting y = 1 we get − 2 t exp( t ) t · − 2 1 = 1 exp( t ) exp( t ) − exp(t) 1 − 2 − − 2 − which is the EGF of Bernoulli numbers (if we consider coefficients of only the positive even powers of t). 1 2. Replacing y by 2 and t by 2i u (i is the purely imaginary unit) on the RHS of (??) and (1), we get · ∞ b (2i u)2k ∞ ( 1)kb (2u)2k i u + k · · = i u + − k · = · (2k)! · (2k)! k=1 k=1 2i u exp(i u) u (cos u + i sin u) · · · 1 = · 1 exp(i u) exp( i u) − sin u − · − − · Solving for the infinite sum yields ∞ ( 1)kb (2u)2k − k · = u cot u 1 (2k)! · − k=1 2 Bernoulli functions Technically, Bernoulli polynomials, denoted Bˆn(x), 1 1 th are defined on the (0, 1) interval, instead of our ( 2 , 2 ); the n of them is thus (using a somehow unconventional notation): − Bˆ (x) B (x 1 ) n ≡ n − 2 These can be converted into what we call Bernoulli functions (we will use the same Bˆn(x) notation for these) by extending them, periodically (meaning Bˆn(x) Bˆn(x 1) ) throughout the real axis. For example, Bˆn(x) looks as follows:≡ − Euler-Maclaurin formula is, effectively, a ‘correction’ to the well known trapezoidal rule, namely: f(m) + f() ∞ bj (2j 1) (2j 1) f(x)dx f(j) f − () f − (m) (3) − 2 − (2j)! − m j=m j=1 (2j 1) where m and are two integers, f − indicates the corresponding deriva- tive, and the upper limit of the last summation is rather symbolic (one would normally use only a handful of terms). The proof is simple: 1 j+1 1 j+1 1 j+1 − ˆ − ˆ − ˆ f(x)dx = B1 (x) f(x)dx = B1(x) f(x) B1(x) f (x)dx m j · · x=j − j · j=m j=m j=m 1 ˆ − f(j + 1) + f(j) B2 (x) = f (x)dx 2 − 2 · j=m m f(m) + f() Bˆ2(x) Bˆ2(x) = f(j) f (x) + f (x)dx − 2 − 2 · m 2 · j=m x=m ˆ f(m) + f() f () f (m) B3 (x) = f(j) b − + f (x)dx − 2 − 1 · 2 3! · j=m m 3 The last term is equal to Bˆ3(x) f (x)dx − 3! · m ˆ B4 (x) = f (x)dx − m 4! · ˆ ˆ B4(x) B4(x) (4) = f (x) + f (x)dx − 4! · m 4! · x=m ˆ f () f (m) B5 (x) (4) = b2 − + f (x)dx − · 4! 5! · m whose the last term equals ˆ B5(x) (5) f (x)dx − 5! · m Bˆ (x) = 6 f (5)(x)dx − m 6! · Bˆ (x) Bˆ (x) = 6 f (5)(x) + 6 f (6)(x)dx − 6! · m 6! · x=m (5) (5) ˆ f () f (m) B (x) = b − + 7 f (6)(x)dx − 3 · 6! 7! · m etc. Note that, since Bˆ1(x) has a discontinuity at each integer, the corresponding integration had to be broken down into continuous segments (no longer necessary for the remaining Bernoulli functions, which are all continuous). An important special case of (3) lets tend to and assumes that the (2j 1) ∞ corresponding limit of all f − () derivatives (including f() itself) is 0. One then gets ∞ ∞ f(m) ∞ bj (2j 1) f(x)dx f(j) + f − (m) − 2 (2j)! m j=m j=1 Stirling’s formula: When f(x) = ln(x), m = 1, and is replaced by more common (in this context) n, (3) implies ln n ∞ b 1 n ln n n + 1 ln n! j 1 · − − 2 − (2j)(2j 1) n2j 1 − j=1 − − th 2j+1 since the 2j 1 derivative of ln x is (2j 2)!x− . Actually, in this form, the formula is meaningless− because the last (infinite)− summation is not convergent 4 !! We must re-write it (rearranging its terms in the process) as ln n k b ln n! = n ln n n + + j + c + R · − 2 (2j)(2j 1)n2j 1 k n,k j=1 − − where we have made the summation finite, added the corresponding error term Rn,k, and replaced ∞ b 1 j − (2j)(2j 1) j=1 − by ck. It is easy to see that, as n increases, ck + Rn,k will tend to a finite limit which is independent of k and remains to be established. The best we can do in terms of finding a good approximation for ln n! is to replace ck + Rn,k by this limit, equal to ln n lim ln n! n ln n + n (4) n − · − 2 →∞ as all terms of the j summation tend to zero. To do this, we recall that ∞ n! = xn exp( x)dx (5) − 0 Expanding ln of the integrand in x at n yields (x n)2 ln[xn exp( x)] ln[nn exp( n)] − + ... − − − 2n implying that n n (x n)2 x exp( x) n exp( n) exp − − − · − 2n One can refine this approximation by further expanding the ratio of the LHS to the RHS, getting (x n)2 (x n)3 (x n)4 (x n)5 xn exp( x) nn exp( n) exp − 1 + − − + − + ... − − · − 2n · 3n2 − 4n3 5n4 but this will not affect the resulting n limit, as one can easily verify. Using this formula, → ∞ 2 ∞ (x n) ln n! n ln n n + ln exp − dx − − 2n 0 When series expanding the last term in n at infinity we get ln √2nπ + ... This clearly shows that (4) is equal to ln √2π 5 The final approximation is thus ln(2πn) k b ln n! n ln n n + + j · − 2 (2j)(2j 1)n2j 1 j=1 − − ln(2πn) 1 1 1 1 1 = n ln n n + + + + + ... · − 2 12n − 360n3 1260n5 − 1680n7 1188n9 The following graph displays the log 10 of absolute error of this formula (plotted against the value of k) when approximating ln 3! The asymptotic nature of the approximation is quite obvious. 6.