Stirling's Approximation for Large Factorials - Prof. Stefan Franzen, Study notes of Physical Chemistry

Stirling's approximation, a mathematical formula used to approximate the natural logarithm of large factorials. The approximation is based on the integral of ln x from 0 to n and is shown to get better as n increases. Examples of the approximation for various values of n and compares the result to the exact value of ln n!.

Typology: Study notes

Pre 2010

Uploaded on 03/10/2009

koofers-user-wau
koofers-user-wau 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Stirling’s Approximation
In confronting statistical problems we often encounter
factorials of very large numbers. The factorial N! is a product
N(N-1)(N-2)..(2)(1). Therefore, ln N! is a sum
where we have used the property of logarithms that log(abc) =
log(a) + log(b) + log(c). The sum is shown in figure below.
The sum of the area under the blue rectangles shown below up to
N is ln N!. As you can see the rectangles begin to closely
approximate the red curve as m gets larger. The area under the
curve is given the integral of ln x.
To solve the integral use integration by parts
Here we let u = ln x and dv = dx. Then v = x and du = dx/x.
Notice that x/x = 1 in the last integral and x ln x is 0 when
evaluated at zero, so we have
ln N!= lnm
Σ
m
=1
N
ln N!= lnm
Σ
m=1
N
ln xd
x
1
N
udv=uv vdu
ln xdx
0
N=xln x0
Nxdx
x
0
N
pf2

Partial preview of the text

Download Stirling's Approximation for Large Factorials - Prof. Stefan Franzen and more Study notes Physical Chemistry in PDF only on Docsity!

Stirling’s Approximation

In confronting statistical problems we often encounter factorials of very large numbers. The factorial N! is a product N(N-1)(N-2)..(2)(1). Therefore, ln N! is a sum

where we have used the property of logarithms that log(abc) = log(a) + log(b) + log(c). The sum is shown in figure below.

The sum of the area under the blue rectangles shown below up to N is ln N!. As you can see the rectangles begin to closely approximate the red curve as m gets larger. The area under the curve is given the integral of ln x.

To solve the integral use integration by parts

Here we let u = ln x and dv = dx. Then v = x and du = dx/x.

Notice that x/x = 1 in the last integral and x ln x is 0 when evaluated at zero, so we have

ln N! = m Σ = 1ln m

N

ln N! = m Σ = 1ln m

N

≈ ln x dx

1

N

u dv = uv – v du

ln x dx

0

N

= x ln x

0

N

  • x dxx 0

N

Which gives us Stirling’s approximation: ln N! = N ln N – N. As is clear from the figure above Stirling’s approximation gets better as the number N gets larger. Let’s try a few numbers N N! ln N! N ln N – N Error 10 3.63 x 10^6 15.1 13.02 13.8% 50 3.04 x 10^64 148.4 145.6 1.88% 100 9.33 x 10^157 363.7 360.5 0.88% 150 5.71 x 10^262 605.0 601.6 0.56%

My calculator overheats at 200!. That is all right since we have shown that the result is converging. In thermodynamics we are often dealing very large N (i.e. of the order of Avagadro’s number). Clearly, for these values Stirling’s approximation is excellent.

ln x dx

0

N

= N ln N – dx

0

N