Stirling's approximation


Stirling's approximation

In mathematics, Stirling's approximation (or Stirling's formula) is an approximation for large factorials. It is named in honour of James Stirling.

The formula is written as

:n! approx sqrt{2pi n}, left(frac{n}{e} ight)^{n}.

Roughly, this means that these quantities approximate each other for all sufficiently large integers "n". More precisely, Stirling's formula says that

:lim_{n ightarrow infty} {frac{n!}{sqrt{2pi n}, left(frac{n}{e} ight)^{n} = 1

or

:lim_{n ightarrow infty} {frac{e^n, n!}{n^n sqrt{n} = sqrt{2 pi}.

or

:lim_{n ightarrow infty} {frac{(1+frac{1}{n})^{n^2}, n!}{n^n sqrt{n} = sqrt{2 pi}.

or

:lim_{n ightarrow infty} {frac{((n+1)^{n})^{n}, n!} {((n)^n)^{(n+1)} sqrt{n} = sqrt{2 pi}.

Derivation

The formula, together with precise estimates of its error, can be derived as follows. Instead of approximating "n"!, one considers its natural logarithm:

:ln(n!) = ln 1 + ln 2 + cdots + ln n.

The right-hand side of this equation is (almost) the approximation of the integral int_1^n ln(x),dx = n ln n - n + 1 using the trapezoid rule,and the error in this approximation is given by the Euler–Maclaurin formula:

:ln (n!) - frac{ln n}{2} = ln 1 + ln 2 + cdots + ln(n-1) + frac{ln n}{2}= n ln n - n + 1 + sum_{k=2}^{m} frac{B_k {(-1)}^k}{k(k-1)} left( frac{1}{n^{k-1 - 1 ight) + R_{m,n},

where "B""k" is Bernoulli number and "R"m,n is the remainder term in the Euler–Maclaurin formula.Take limits to find that

:lim_{n o infty} left( ln n! - n ln n + n - frac{ln n}{2} ight) = 1 - sum_{k=2}^{m} frac{B_k {(-1)}^k}{k(k-1)} + lim_{n o infty} R_{m,n}.

Denote this limit by "y". Because the remainder "R""m","n" in the Euler–Maclaurin formula satisfies

:R_{m,n} = lim_{n o infty} R_{m,n} + O left( frac{1}{n^m} ight),

where we use Big-O notation, combining the equations above yields the approximation formula in its logarithmic form:

:ln n! = n ln left( frac{n}{e} ight) + frac{ln n}{2} + y + sum_{k=2}^{m} frac{B_k {(-1)}^k}{k(k-1)n^{k-1 + O left( frac{1}{n^m} ight).

Taking the exponential of both sides, and choosing any positive integer "m", we get a formula involving an unknown quantity "e""y".For "m"="1", the formula is

:n! = e^{y} sqrt{n}~{left( frac{n}{e} ight)}^n left( 1 + O left( frac{1}{n} ight) ight).

The quantity "e""y" can be found by taking the limit on both sides as "n" tends to infinity and using Wallis' product,which shows that e^y = sqrt{2 pi}. Therefore, we get Stirling's formula:

:n! = sqrt{2 pi n}~{left( frac{n}{e} ight)}^n left( 1 + O left( frac{1}{n} ight) ight).

The formula may also be obtained by repeated integration by parts, and the leading term can be found through the method of steepest descent.Stirling's formula, without the factor sqrt{2 pi n} that is often irrelevant in applications, can be quickly obtained by approximating the sum

:ln(n!) = sum_{j=1}^{n} ln j

with an integral:

:sum_{j=1}^{n} ln j approx int_1^n ln x , dx = nln n - n + 1.

Speed of convergence and error estimates

More precisely,

:n! = sqrt{2 pi n} ; left(frac{n}{e} ight)^{n}e^{lambda_n}

with

:frac{1}{12n+1} < lambda_n < frac{1}{12n}.

Stirling's formula is in fact the first approximation to the following series (now called the Stirling series):

: n!=sqrt{2pi n}left({nover e} ight)^n left( 1 +{1over12n} +{1over288n^2} -{139over51840n^3} -{571over2488320n^4} + cdots ight).

As n o infty, the error in the truncated series is asymptotically equal to the first omitted term. This is an example of an asymptotic expansion. It is not a convergent series; for any "particular" value of "n" there are only so many terms of the series that improve accuracy, after which point accuracy actually gets worse. Let S(n, t) be the Stirling series to t terms evaluated at n. The graph shows left | ln (S(n, t) / n!) ight | , which, when small, is essentially the relative error.

The asymptotic expansion of the logarithm is also called "Stirling's series":

: ln n!=nln n - n + {1over 2}ln(2pi n) +{1over12n} -{1over360n^3} +{1over1260n^5} -{1over 1680n^7} +cdots.

In this case, it is known that the error in truncating the series is always of the same sign and at most the same magnitude as the first omitted term.

tirling's formula for the Gamma function

For all positive integers,

:n! = Pi(n) = Gamma(n+1).

However, the Gamma function, unlike the factorial, is more broadly defined for all complex numbers other than non-positive integers; nevertheless, Stirling's formula may still be applied. If Re(z) > 0 then

:ln Gamma (z) = left(z-frac12 ight)ln z -z + frac{ln {2 pi{2} + 2 int_0^infty frac{arctan frac{t}{z{exp(2 pi t)-1}, dt.

Repeated integration by parts gives the asymptotic expansion

:ln Gamma (z) = left(z-frac12 ight)ln z -z + frac{ln {2 pi{2} + sum_{n=1}^infty frac{(-1)^{n-1}B_{n{2n(2n-1)z^{2n-1

where "B""n" is the nth Bernoulli number. The formula is valid for "z" large enough in absolute value when |arg z| < pi - epsilon, where ε is positive, with an error term ofO(z^{-m - 1/2}) when the first "m" terms are used. The corresponding approximation may now be written:

:Gamma(z) = sqrt{frac{2 pi}{ z~{left( frac{z}{e} ight)}^z left( 1 + O left( frac{1}{z} ight) ight).

A convergent version of Stirling's formula

Thomas Bayes showed, in a letter to John Canton published by the Royal Society in 1763, that Stirling's formula did not give a convergent series. [http://www.york.ac.uk/depts/maths/histstat/letter.pdf]

Obtaining a convergent version of Stirling's formula entails evaluating

:int_0^infty frac{2arctan frac{t}{z{exp(2 pi t)-1}, dt= lnGamma (z) - left( z-frac12 ight) ln z +z - frac12ln(2pi).

One way to do this is by means of a convergent series of inverted rising exponentials. If z^{overline n} = z(z+1) cdots (z+n-1), then

:int_0^infty frac{2arctan frac{t}{z{exp(2 pi t)-1} , dt= sum_{n=1}^infty frac{c_n}{(z+1)^{overline n

where

: c_n = frac{1}{n} int_0^1 x^{overline n} left( x-frac12 ight) , dx.

From this we obtain a version of Stirling's series

:ln Gamma (z) = left( z-frac12 ight) ln z -z + frac{ln {2 pi{2} :::{} + frac{1}{12(z+1)} + frac{1}{12(z+1)(z+2)} + frac{59}{360(z+1)(z+2)(z+3)} + frac{29}{60(z+1)(z+2)(z+3)(z+4)} + cdots

which converges when Re(z)>0.

A version suitable for calculators

The approximation

:Gamma(z) approx sqrt{frac{2 pi}{z} } left( frac{z}{e} sqrt{ z sinh frac{1}{z} + frac{1}{810z^6} } ight)^{z},

or equivalently,

:2 ln Gamma(z) approx ln(2 pi) - ln z + z left(2 ln z + ln left( z sinh frac{1}{z} + frac{1}{810z^6} ight) - 2 ight),

can be obtained by rearranging Stirling's extended formula and observing a coincidence between the resultant power series and the Taylor series expansion of the hyperbolic sine function. This approximation is good to more than 8 decimal digits for "z" with a real part greater than 8. Robert H. Windschitl suggested it in 2002 for computing the Gamma function with fair accuracy on calculators with limited program or register memory (see ref. 'Toth').

Gergő Nemes proposed in 2007 an approximation which gives the same number of exact digits as the Windschitl approximation but is much simpler:

:Gamma(z) approx sqrt{frac{2 pi}{z} } left( frac{1}{e} left( z + frac{1}{12z- frac{1}{10z ight) ight)^{z},

or equivalently,

: ln Gamma(z) approx frac{1}{2} left(ln(2 pi) - ln z ight) + z left(ln left( z + frac{1}{12z- frac{1}{10z ight)-1 ight).

History

The formula was first discovered by Abraham de Moivre in the form:n!sim [{ m constant}] cdot n^{n+1/2} e^{-n}.Stirling's contribution consisted of showing that the constantis sqrt{2pi}. The more precise versions are due to
Jacques Binet.

ee also

* Lanczos approximation
* Spouge's approximation

References

* Abramowitz, M. and Stegun, I., "Handbook of Mathematical Functions", http://www.math.hkbu.edu.hk/support/aands/toc.htm
* Paris, R. B., and Kaminsky, D., "Asymptotics and the Mellin-Barnes Integrals", Cambridge University Press, 2001
* Whittaker, E. T., and Watson, G. N., "A Course in Modern Analysis", fourth edition, Cambridge University Press, 1963. ISBN 0-521-58807-3
* Toth, V. T. "Programmable Calculators: Calculators and the Gamma Function". http://www.rskey.org/gamma.htm, modified 2006
*
*


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Stirling (disambiguation) — Stirling is a city in Scotland (formerly the Royal Burgh of Stirling). It also refers to several places related to this city:* Stirling (council area) * Stirling (Scottish Parliament constituency) * Stirling (UK Parliament constituency) *… …   Wikipedia

  • Stirling-Formel — Die Stirling Formel ist eine mathematische Formel, mit der man für große Fakultäten Näherungswerte berechnen kann. Sie ist benannt nach dem Mathematiker James Stirling. Inhaltsverzeichnis 1 Grundlegendes 1.1 Herleitung der ersten beiden Glieder 2 …   Deutsch Wikipedia

  • Stirling-Reihe — Die Stirling Formel ist eine mathematische Formel, mit der man für große Fakultäten Näherungswerte berechnen kann. Sie ist benannt nach dem Mathematiker James Stirling. Inhaltsverzeichnis 1 Grundlegendes 1.1 Herleitung der ersten beiden Glieder 2 …   Deutsch Wikipedia

  • Stirling engine — Alpha type Stirling engine. There are two cylinders. The expansion cylinder (red) is maintained at a high temperature while the compression cylinder (blue) is cooled. The passage between the two cylinders contains the regenerator …   Wikipedia

  • Formule de Stirling — Pour les articles homonymes, voir Stirling. La formule de Stirling, du nom du mathématicien écossais James Stirling, donne un équivalent de la factorielle au voisinage de l infini réel (quand n tend vers l infini) : que l on trouve souvent… …   Wikipédia en Français

  • Lanczos approximation — In mathematics, the Lanczos approximation is a method for computing the Gamma function numerically, published by Cornelius Lanczos in 1964. It is a practical alternative to the more popular Stirling s approximation for calculating the Gamma… …   Wikipedia

  • James Stirling (mathematician) — James Stirling (April 22, 1692 ndash;December 5, 1770) was a Scottish mathematician. He was educated at Balliol College, Oxford where he was a Snell exhibitionerThe Stirling numbers and Stirling s approximation are named after him. =External… …   Wikipedia

  • Spouge's approximation — In mathematics, Spouge s approximation is a formula for the gamma function due to John L. Spouge. The formula is a modification of Stirling s approximation, and has the form:Gamma(z+1) = (z+a)^{z+1/2} e^{ (z+a)} left [ c 0 + sum {k=1}^{a 1}… …   Wikipedia

  • Formule De Stirling — Pour les articles homonymes, voir Stirling. La formule de Stirling, du nom du mathématicien James Stirling, donne un équivalent de la factorielle au voisinage de l infini réel (quand n tend vers l infini) : que l on trouve souvent …   Wikipédia en Français

  • James Stirling (Mathematiker) — James Stirling (* Mai 1692[1] in Garden bei Stirling; † 5. Dezember 1770 in Edinburgh) war ein schottischer Mathematiker. Stirling reiste Ende 1710 nach Oxford, wo er als Snell Stipendiat am 18. Januar 1711 am Balliol College der Universität… …   Deutsch Wikipedia


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.