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!
{{short description|Approximation for factorials}} [[File:Mplwp factorial gamma stirling.svg|thumb|right|upright=1.35|Comparison of Stirling's approximation with the factorial]] In [[mathematics]], '''Stirling's approximation''' (or '''Stirling's formula''') is an [[Asymptotic analysis|asymptotic]] approximation for [[factorial]]s. It is a good approximation, leading to accurate results even for small values of <math>n</math>. It is named after [[James Stirling (mathematician)|James Stirling]], though a related but less precise result was first stated by [[Abraham de Moivre]].{{r|dutka|LeCam1986|Pearson1924}} One way of stating the approximation involves the [[logarithm]] of the factorial: <math display=block>\ln(n!) = n\ln n - n +O(\ln n),</math> where the [[big O notation]] means that, for all sufficiently large values of <math>n</math>, the difference between <math>\ln(n!)</math> and <math>n\ln n-n</math> will be at most proportional to the logarithm of <math>n</math>. In computer science applications such as the [[Comparison sort#Number of comparisons required to sort a list|worst-case lower bound for comparison sorting]], it is convenient to instead use the [[binary logarithm]], giving the equivalent form <math display=block>\log_2 (n!) = n\log_2 n - n\log_2 e +O(\log_2 n).</math> The error term in either base can be expressed more precisely as <math>\tfrac12\log_2(2\pi n)+O(\tfrac1n)</math>, corresponding to an approximate formula for the factorial itself, <math display=block>n! \sim \sqrt{2 \pi n}\left(\frac{n}{e}\right)^n.</math> Here the sign <math>\sim</math> means that the two quantities are asymptotic, that is, their ratio tends to 1 as <math>n</math> tends to infinity.
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)