Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Stirling's approximation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Speed of convergence and error estimates == [[File:Stirling series relative error.svg|thumb|upright=1.8|The relative error in a truncated Stirling series vs. <math>n</math>, for 0 to 5 terms. The kinks in the curves represent points where the truncated series coincides with {{math|Γ(''n'' + 1)}}.]] Stirling's formula is in fact the first approximation to the following series (now called the '''Stirling series'''):{{r|nist}} <math display=block> n! \sim \sqrt{2\pi n}\left(\frac{n}{e}\right)^n \left(1 +\frac{1}{12n}+\frac{1}{288n^2} - \frac{139}{51840n^3} -\frac{571}{2488320n^4}+ \cdots \right).</math> An explicit formula for the coefficients in this series was given by G. Nemes.{{r|Nemes2010-2}} Further terms are listed in the [[On-Line Encyclopedia of Integer Sequences]] as {{OEIS link|A001163}} and {{OEIS link|A001164}}. The first graph in this section shows the [[Approximation error|relative error]] vs. <math>n</math>, for 1 through all 5 terms listed above. (Bender and Orszag<ref>{{Cite book |last1=Bender |first1=Carl M. |title=Advanced mathematical methods for scientists and engineers. 1: Asymptotic methods and perturbation theory |last2=Orszag |first2=Steven A. |date=2009 |publisher=Springer |isbn=978-0-387-98931-0 |edition=Nachdr. |location=New York, NY}}</ref> p. 218) gives the asymptotic formula for the coefficients:<math display="block">A_{2 j+1} \sim(-1)^j 2(2 j) ! /(2 \pi)^{2(j+1)}</math>which shows that it grows superexponentially, and that by the [[ratio test]] the [[radius of convergence]] is zero. [[File:Stirling error vs number of terms.svg|thumb|upright=1.8|The relative error in a truncated Stirling series vs. the number of terms used]] As {{math|''n'' β β}}, 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 <math>n</math> there are only so many terms of the series that improve accuracy, after which accuracy worsens. This is shown in the next graph, which shows the relative error versus the number of terms in the series, for larger numbers of terms. More precisely, let {{math|''S''(''n'', ''t'')}} be the Stirling series to <math>t</math> terms evaluated at <math>n</math>. The graphs show <math display=block>\left | \ln \left (\frac{S(n, t)}{n!} \right) \right |, </math> which, when small, is essentially the relative error. Writing Stirling's series in the form <math display=block>\ln(n!) \sim n\ln n - n + \tfrac12\ln(2\pi n) +\frac{1}{12n} - \frac{1}{360n^3} + \frac{1}{1260n^5} - \frac{1}{1680n^7} + \cdots,</math> it is known that the error in truncating the series is always of the opposite sign and at most the same magnitude as the first omitted term.{{Citation needed|date=December 2024}} Other bounds, due to Robbins,{{r|Robbins1955}} valid for all positive integers <math>n</math> are <math display=block>\sqrt{2\pi n}\left(\frac{n}{e}\right)^n e^{\frac{1}{12n + 1}} < n! < \sqrt{2\pi n}\left(\frac{n}{e}\right)^n e^{\frac{1}{12n}}. </math> This upper bound corresponds to stopping the above series for <math>\ln(n!)</math> after the <math>\frac{1}{n}</math> term. The lower bound is weaker than that obtained by stopping the series after the <math>\frac{1}{n^3}</math> term. A looser version of this bound is that <math>\frac{n! e^n}{n^{n+\frac12}} \in (\sqrt{2 \pi}, e]</math> for all <math>n \ge 1</math>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)