Stirling's Approximation
I’ve always been fascinated by Stirling’s approximation,
ln(n!) = n ln(n) − n,
where n! is the factorial. Russ Hobbie and I mention Stirling’s approximation in Appendix I of Intermediate Physics for Medicine and Biology. In the homework problems for that appendix (yes, IPMB does has homework problems in its appendices), a more accurate version of Stirling’s approximation is given as
ln(n!) = n ln(n) − n + ½ ln(2π n) .
There is one thing that’s always bothered me about Stirling’s approximation: it’s for the logarithm of the factorial, not the factorial itself. So today, I’ll derive an approximation for the factorial.
The first step is easy; just apply the exponential function to the entire expression. Because the exponential is the inverse of the natural logarithm, you get
n! = en ln(n) − n + ½ ln(2π n)
Now, we just use some properties of exponents
n! = en ln(n) e−n e½ln(2π n)
n! = (eln(n))n e−n √(eln(2π n))
n! = nn e−n √(2π n)
And there we have it. It’s a strange formula, with a really huge factor (nn) multiplied by a tiny factor (e−n) times a plain old modestly sized factor (√(2π n)). It contains both e = 2.7183 and π = 3.1416.
Let’s see how it works.
n | n! | nn e−n √(2π n) | fractional error (%) |
---|---|---|---|
1 | 1 | 0.92214 | 7.8 |
2 | 2 | 1.9190 | 4.1 |
5 | 120 | 118.02 | 1.7 |
10 | 3.6288 × 106 | 3.5987 × 106 | 0.83 |
20 | 2.4329 × 1018 | 2.4228 × 1018 | 0.42 |
50 | 3.0414 × 1064 | 3.0363 × 1064 | 0.17 |
100 | 9.3326 × 10157 | 9.3249 × 10157 | 0.083 |
For the last entry (n = 100), my calculator couldn’t calculate 100100 or 100!. To get the first one I wrote
100100 = (102)100 = 102 × 100 = 10200.
The calculator was able to compute e−100 = 3.7201 × 10−44, and of course the square root of 200π was not a problem. To obtain the actual value of 100!, I just asked Google.
Why in the world does anyone need a way to calculate such big factorials? Russ and I use them in Chapter 3 about statistical dynamics. There you have to count the number of states, which often requires using factorials. The beauty of statistical mechanics is that you usually apply it to macroscopic systems with a large number of particles. And by large, I mean something like Avogadro’s number of particles (6 × 1023). The interesting thing is that in statistical mechanics you often need not the factorial, but the logarithm of the factorial, so Stirling’s approximation is exactly what you want. But it’s good to know that you can also approximate the factorial itself.
Finally, one last fact from Mr. Google. 1,000,000! = 8.2639 × 105,565,708. Wow!
Stirling’s Approximation
https://www.youtube.com/watch?v=IJ5N28-Ujno
Source: http://hobbieroth.blogspot.com/2024/03/stirlings-approximation.html
Anyone can join.
Anyone can contribute.
Anyone can become informed about their world.
"United We Stand" Click Here To Create Your Personal Citizen Journalist Account Today, Be Sure To Invite Your Friends.
Please Help Support BeforeitsNews by trying our Natural Health Products below!
Order by Phone at 888-809-8385 or online at https://mitocopper.com M - F 9am to 5pm EST
Order by Phone at 866-388-7003 or online at https://www.herbanomic.com M - F 9am to 5pm EST
Order by Phone at 866-388-7003 or online at https://www.herbanomics.com M - F 9am to 5pm EST
Humic & Fulvic Trace Minerals Complex - Nature's most important supplement! Vivid Dreams again!
HNEX HydroNano EXtracellular Water - Improve immune system health and reduce inflammation.
Ultimate Clinical Potency Curcumin - Natural pain relief, reduce inflammation and so much more.
MitoCopper - Bioavailable Copper destroys pathogens and gives you more energy. (See Blood Video)
Oxy Powder - Natural Colon Cleanser! Cleans out toxic buildup with oxygen!
Nascent Iodine - Promotes detoxification, mental focus and thyroid health.
Smart Meter Cover - Reduces Smart Meter radiation by 96%! (See Video).