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.
Before It’s News® is a community of individuals who report on what’s going on around them, from all around the world. 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.
LION'S MANE PRODUCT
Try Our Lion’s Mane WHOLE MIND Nootropic Blend 60 Capsules
Mushrooms are having a moment. One fabulous fungus in particular, lion’s mane, may help improve memory, depression and anxiety symptoms. They are also an excellent source of nutrients that show promise as a therapy for dementia, and other neurodegenerative diseases. If you’re living with anxiety or depression, you may be curious about all the therapy options out there — including the natural ones.Our Lion’s Mane WHOLE MIND Nootropic Blend has been formulated to utilize the potency of Lion’s mane but also include the benefits of four other Highly Beneficial Mushrooms. Synergistically, they work together to Build your health through improving cognitive function and immunity regardless of your age. Our Nootropic not only improves your Cognitive Function and Activates your Immune System, but it benefits growth of Essential Gut Flora, further enhancing your Vitality.
Our Formula includes: Lion’s Mane Mushrooms which Increase Brain Power through nerve growth, lessen anxiety, reduce depression, and improve concentration. Its an excellent adaptogen, promotes sleep and improves immunity. Shiitake Mushrooms which Fight cancer cells and infectious disease, boost the immune system, promotes brain function, and serves as a source of B vitamins. Maitake Mushrooms which regulate blood sugar levels of diabetics, reduce hypertension and boosts the immune system. Reishi Mushrooms which Fight inflammation, liver disease, fatigue, tumor growth and cancer. They Improve skin disorders and soothes digestive problems, stomach ulcers and leaky gut syndrome. Chaga Mushrooms which have anti-aging effects, boost immune function, improve stamina and athletic performance, even act as a natural aphrodisiac, fighting diabetes and improving liver function. Try Our Lion’s Mane WHOLE MIND Nootropic Blend 60 Capsules Today. Be 100% Satisfied or Receive a Full Money Back Guarantee. Order Yours Today by Following This Link.
