New asymptotic epansion for the Γ function Gergő Nemes December 7, 2008 http://d.doi.org/0.3247/sl2math08.005 Abstract Using a series transformation, Stirling-De Moivre asymptotic series approimation to the Gamma function is converted into a new one with better convergence properties. The new formula is compared with those of Stirling, Laplace and Ramanujan for real arguments greater than 0.5 and turns out to be, for equal number of correction terms, numerically superior to all of them. As a side benefit, a closed-form approimation has turned up during the analysis which is about as good as 3rd order Stirling s maimum relative error smaller than e-0 for real arguments greater or equal to 0. Note: this article is an etended version of an older one [7] to which it adds the estimate of the remainder. Introduction. The main result In this paper, as we claimed in the abstract, we present a new asymptotic epansion for the gamma function for real arguments greater or equal than one. We give an eplicit formula for the coefficients in the series and estimate the error. After the proof, we compared our new formula with some classical results. The numerical comparison shows that for equal number of correction terms the new formula is the most accurate and it is highly recommended for computing the Gamma function for large real arguments. Theorem. Let, then for every n, the following epression holds: G k Γ e 2k + R n,. k0 where R n O 2n and the Gk coefficients are given by G k m,m 2,...,m k 0 2m +4m 2 +...+2km k 2k k r B mr 2r, G 0,.2 m r! 2r 2r where B r denotes the r th Bernoulli number [4]. Moreover, if n +, then 8e /5 n 2n R n n + e +..3 n 2n 2n nemesgery@gmail.com
2 The proof of the theorem 2. Eplicit formula for the coefficients The proof of our theorem is based on the following well-known and more precise version of the Stirling-De Moivre series [3]. Theorem 2. Let, then for every n, the following epression holds: log Γ 2 where the S n remainder satisfies log + 2 log + S n where B k denotes the k th Bernoulli number. 2k 2k 2k + S n, 2. B 2n, 2.2 2n 2n 2 Proof. A simple algebraic manipulation of the above epansion gives Γ e log /2 2k 2k 2k + S n Taking the eponential of both sides gives Γ e / /2 ep 2k 2k 2k Sn ep. 2.3. 2.4 By the Maclaurin series of the eponential function we obtain Sn ep 2k 2k 2k ep 2.5 Sn ep ep 2k 2k 2k 2.6 Sn B l 2k ep l! 2k 2k 2k. 2.7 l 0 Applying the Cauchy product and collecting the coefficients of 2k we obtain Sn ep l 0 l! where the G k coefficients are given by G k m,m 2,...,m k 0 2m +4m 2 +...+2km k 2k 2k 2k 2k k r l k0 G k 2k + R n, 2.8 B mr 2r, G 0, 2.9 m r! 2r 2r and R n O 2n. This completes the proof of the first part of the theorem. 2
2.2 The estimate of the remainder We will estimate uniformly by and n the value of the remainder R n by the method of Karatsuba []. Proof. In the first part of the proof we saw that First let Sn ep Sn ep ep 2k 2k 2k 2k 2k 2k j 0 k0 G k 2k + R n. 2.0 K j j, 2. thus K 2j G j if 0 j n and K 2j+ 0 if j 0. Let us verify the order of the factor ep. Assume that n +, then by the well known inequality S n B 2n 2n 2n 2n 4 n 2n < n 2n 2n 9 On the other hand we have Sn ep k! 2.2 n 2n B 2n 8. 2.3 Sn Now by the properties of the Stirling series one can find ep 2k 2k 2k + S n From 2.2 and 2.5 we find that ep 2k 2k 2k From 2.4 and 2.6 we have ep ep 2k 2k 2k + S n j 2 k S n + 2δ n, 0 < δ n <. 2.4 < ep ep. 2.5 2 2 2k 2k 2k + S n S n ep ep 2k 2k 2k 2k 2k 2k < ep. 5 S n + 2δ n + 2η n e /5 S n 2.6 2.7 2.8 for η n. Comparing 2.0, 2. and 2.8 we find the following epression for our remainder R n K j j + 2η ne /5 S n, n + 2.9 3
and R n j 2 K j j + 2e/5 S n j 2 K j j + e/5 B 2n. 2.20 n 2n 2n We are going to estimate the value of the sum. Let f z : ep 2k 2k z2k K j z j. 2.2 j 0 Hence the K j coefficients are the coefficients in the Taylor epansion of f. Thus for every w > 0 we have K j f v dv. 2.22 i v w vj+ From this Moreover, f we iϕ K j w f we iϕ dϕ f we iϕ 0 w j+ ma 0 ϕ w j. 2.23 Let w /n, from 2.3 2k 2k w2k B2k ep 2k 2k w2k ep 4 k 2k kw 2k Hence f we iϕ e valid when w /n and by 2.23 we finally have 2k 2k w2k. 2.24 4 2k <. 2.25 k 2k K j en j. 2.26 Substituting this into 2.20 and noting that K 2 0 we obtain R n j 2 en j j + e/5 B 2n n 2n n 2n 2n e n/ + e/5 B 2n n 2n 2n 2.27 n 2n 8e n + e + /5 n 2n n 2n 2n 2.28 8e /5 n 2n n + e +, 2.29 n 2n 2n which completes the proof. 3 Numerical properties 3. The computation of the coefficients From.2 we can compute the numerical values of G k. The Bernoulli numbers start B j, 2, 6, 0, 30, 0, 42, 0,,... j 0. 30 4
So the first few values of the G k coefficients are G 0 G 2 B 2 2 G 2 2 B 4 + 8 B2 2 440 G 3 30 B 6 + 24 B 2B 4 + 48 B3 2 239 362880 G 4 56 B 8 + 60 B 2B 6 + 288 B2 4 + 96 B 4B2 2 + 384 B4 2 46409 8709200 Thus the epansion. starts Γ + e 2 2 + 440 4 + 239 362880 6 46409 8709200 8 +.... 3. The following table shows the numerical values of the first eleven coefficients. G 0.00000000000000000000000000000000000 G 0.08333333333333333333333333333333333 G 2 0.00069444444444444444444444444444444 G 3 0.00065869929453262786596992945326 G 4-0.000532878782774838330393885949445 G 5 0.00079278588700608376534302460228386 G 6-0.00847588932203302840060629596969 G 7 0.006250678247849484632883682462366 G 8-0.029070246305099344470506844402 G 9 0.77845724249308890302832366796470 G 0 -.3774768703993534399676348903067470 Table with numerical values of G k. If we formally write ep 2k 2k 2k G k, 3.2 2k k then the following recurrence holds for k. G k 2k k m0 B 2m+2 G k m, G 0, 3.3 2m + which gives the same as above. This can be shown by differentiating both sides of 3.2 and equating the coefficients of 2k. 3.2 Numerical comparisons Although we considered an asymptotic formula, i. e. a formula which is optimized for use with large values of, it is for practical purposes also of interest to know the behaviour for small values of. Therefore we will compare in this paragraph the numerical performance 5
of some asymptotic formula to the Gamma function with our formula in the range [0.5.. 50]. We compare the following approimation formulas [5,6] e ep 2 360 3 + 260 5... Stirling, 3.4 + e 2 + 288 2 39 5840 3... Laplace, 3.5 6 + e 2 + 8 2 + 240 3... Ramanujan, 3.6 + e 2 2 + 440 4 + 239 362880 6... Nemes. 3.7 The second epression is sometimes incorrectly called Stirling s formula see [2]. The following graph shows the relative error of these formulas to the Gamma function. The plotted quantity is ln a /Γ a /Γ. The first computed values are for 0.5. Thick traces indicate a > Γ, thin ones a < Γ. Color codes for various families: blue - Stirling, green - Laplace, brown - Ramanujan, red - Nemes a denotes the corresponding approimation. The number after a name indicates the power of / in the last kept term in the epansion. The following curves overlap: Laplace 2 overlaps Stirling, Ramanujan 2 overlaps Nemes 2 for large, Nemes 4 overlaps Nemes Closed, Nemes 6 overlaps Stirling 5. For Nemes Closed formula, see Section 4.. Figure : Relative errors of Gamma function approimations. Conclusion. From the graph we see that the first and the third Laplace approimations outperform the corresponding Ramanujan formulas, however these epansions contain the same number of terms. Ramanujan 2 gives better approimation than Laplace 2 and Nemes 2, though the latter is nearly identical for larger values of. The graph also 6
shows that, for equal number of correction terms, the Nemes formulae are always better than all the other e.g., Nemes 4 is better than Stirling 3, Ramanujan 2 and Laplace 2. It seems that for numerical computation the most useful are the Stirling and Nemes formulas. These epansions use only half of the powers of the variable contrary to the Laplace and Ramanujan series. The behavior of the closed formula is very interesting, it gives approimately the same value as Nemes 4 and a better one than Stirling 3, even though it contains only one correction term. 4 Corollaries 4. Closed approimation The structure of the epansion. induces the following closed approimation to the Gamma function. Corollary. Let, then Γ e + 5 4 5 2. 4. Proof. If t < Let t <, then 52 + t 5 4 + 5 4 t + 5 32 t2 5 28 t3 +.... 4.2 + 5 4 + 5 2 2 2 + 440 4..., 4.3 864006 which from the approimation is reasonable compare it with 3.. 4.2 Asymptotic epansion of n n! From Stirling s formula it is well known that n n! n e. 4.4 By our new formula we can easily deduce a complete asymptotic epansion for n n!. Corollary 2. Let n be a positive integer, then n n P k log n n! e n k 4.5 where P k is a polynomial in degree k and for every real number we have P k where V 2i+ 0 and V 2i G i for i 0. k j0 V k j 2 j j! j, 4.6 7
Proof. For positive integer n we have nγ n n!, thus by our formula n n n! n n G k e n 2k 4.7 or We know that n n! n e 2n t ep 2n log t j 0 2n n G k. 4.8 n2k j! log t j, 4.9 2n hence setting t n and applying the definition of V i gives n n n! e j! j 0 log n j Now the Cauchy product of the two series gives the desired form. 2n V k n k. 4.0 Acknowledgment I would like to thank Peter Luschny, Péter Simon and Stanislav Sýkora for their useful help and many advice. References [] E. A. Karatsuba. On the asymptotic representation of the Euler gamma function by Ramanujan. Elsevier Science B.V., 200. [2] E. T. Copson. Asymptotic Epansions. Cambridge University Press, 965. [3] E. Whittaker and G. Watson. A Course of Modern Analysis. Cambridge University Press, 963. [4] M. Abramowitz and I. A. Stegun eds.. Handbook of Mathematical Functions. Dover, 965. [5] P. Luschny. An overview and comparison of different approimations of the factorial function. http://www.luschny.de/math/factorial/appro/simplecases.html, 2007. [6] S. Ragahavan and S. S. Rangachari eds.. S. Ramanujan: The lost notebook and other unpublished papers. Springer, 988. [7] G. Nemes. New asymptotic epansion for the Γz function. http://d.doi.org/0.3247/sl2math07.006, 2007. 8