Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

Stirling’s like approximation for log factorial

Posted by peeterjoot on December 24, 2012

[Click here for a PDF of this post with nicer formatting]

Motivation

Back in my undergrad days, I rarely took notes, since most of what we covered was in the text books. The only notes I’d taken from the course where we did some thermodynamics was half an 8\, 1/2 \times 11 scrap paper with a simple Stirling like approximation for \ln N! (sitting in my old text [1]). Here it is

Guts

First write the factorial in product form

\begin{aligned}N! = \Pi_{k = 0}^{N-1} (N - k).\end{aligned} \hspace{\stretch{1}}(1.2.1)

so that it’s logarithm is a sum

\begin{aligned}\ln N! = \sum_{k = 0}^{N-1} \ln( N - k ).\end{aligned} \hspace{\stretch{1}}(1.2.2)

We can now derivatives of both sides with respect to N, ignoring the fact that N is a discrete variable. For the left hand side, writing f = N!, we have

\begin{aligned}\frac{d \ln f }{dN} = \frac{1}{{f}} \frac{d f}{dN}.\end{aligned} \hspace{\stretch{1}}(1.2.3)

Now for the right hand side

\begin{aligned}\frac{d}{dN} \sum_{k = 0}^{N-1} \ln( N - k ) = \sum_{k = 0}^{N-1} \frac{1}{{ N - k }}\approx\int_{0}^{N-1} \frac{dk}{ N - k }= \int_{N}^{1} \frac{-du}{ u }= \ln N - \ln 1 = \ln N\end{aligned} \hspace{\stretch{1}}(1.2.4)

Merging 1.2.3 and 1.2.4 into two differentials, and integrating we have

\begin{aligned}\frac{df}{f} \approx \ln N dN.\end{aligned} \hspace{\stretch{1}}(1.2.5)

Observing that

\begin{aligned}(x \ln x -x)' = x \frac{1}{{x}} + \ln x - 1 = \ln x,\end{aligned} \hspace{\stretch{1}}(1.2.6)

we have

\begin{aligned}\ln N! \approx N \ln N - N + C.\end{aligned} \hspace{\stretch{1}}(1.2.7)

Even though we are interested in large N, we note that with N = 1 we have

\begin{aligned}0 = -1 + C,\end{aligned} \hspace{\stretch{1}}(1.2.8)

but this is small compared to N for large N, so we have

\begin{aligned}\boxed{\ln N! \approx \ln N^N - N}\end{aligned} \hspace{\stretch{1}}(1.2.9)

Expontiating, this is

\begin{aligned}\boxed{N! \approx N^N e^{-N}}.\end{aligned} \hspace{\stretch{1}}(1.2.10)

I think that our Professor’s point at the time was that when we only care about the logarithm of N! we can get away with 1.2.9, and can avoid the complexity and care required to do a proper Stirling’s approximation.

References

[1] C. Kittel and H. Kroemer. Thermal physics. WH Freeman, 1980.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: