Stirling approximation

A useful approximation for $N!$ is provided by the Stirling formula:

$\displaystyle \ln N! = N \ln N - N + \ln \sqrt{2 \pi N} + o\left (\frac{1}{N} \right)$ (15.1)

For large values of $N$, a sufficiently accurate formula is also obtained by neglecting the term $\ln \sqrt{2 \pi N}$ in [*], which leads to the familiar expression used in statistical physics:

$\displaystyle \ln N \simeq N \ln N - N.$ (15.2)

The origin of this expression can be understood by expressing:

$\displaystyle \ln N! = \sum_{n=1}^N \ln n.$ (15.3)

The value of this sum is the shaded area in Fig. [*], which can be approximated by the integral of $\ln x$:

$\displaystyle \int_1^N dx \ln x = N \ln N - N + 1.$ (15.4)

Figure: Approximation of $\ln N!$ (shaded area) by the integral of $\ln x$ between 1 and $N$.
\includegraphics[width=8cm]{nfact.pdf}

The Stirling formula [*] is quite accurate also for relatively small values of N. The error in Eq. [*] is of order $\ln N$, which becomes completely negligible when compared to $N \ln N - N$ for $N \simeq 10^{23}$.


  (r)1-2 $N$ $\ln N!$ $N \ln N - N + \ln \sqrt{2 \pi N}$ $N \ln N - N$    
 2 0.6931 0.6518      
 3 1.7918 1.7641      
 4 3.1781 3.1573      
 $\dots$ $\dots$ $\dots$      
 10 15.1044 15.0961 13.0258    
 $\dots$ $\dots$ $\dots$      
 100 363.7394 363.7385 360.5170