Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I saw this approximation for the factorial given by Ramanujan as $$\log(n!) \approx n \log n - n + \frac{\log(n(1+4n(1+2n)))}{6} + \frac{\log(\pi)}{2}$$ in wikipedia, which claims the approximation is superior to Stirling's approximation. I tried to locate the reference but unfortunately I could not.

I would appreciate if someone can throw light on how this asymptotic is obtained and the order of the error.

share|improve this question
2  
Nobody knows how any of Ramanujan's results were obtained. – Gerry Myerson Jun 1 '12 at 6:20
1  
@Marvis: A good thing would be to email Bruce Berndt. – user9413 Jun 1 '12 at 6:42

1 Answer

up vote 10 down vote accepted

$$\eqalign{\log(n!) &\approx \left( \ln \left( n \right) -1 \right) n+\ln \left( \sqrt {2 \pi } \right) +\dfrac{\ln \left( n \right)}{2} +\dfrac{1}{12} n^{-1}-{\dfrac {1}{ 360}}\,{n}^{-3}+O \left( {n}^{-5} \right)\cr n\ln \left( n \right) &-n+\frac{\ln \left( n \left( 1+4\,n \left( 1+2 \,n \right) \right) \right)}{6} +\frac{\ln \left( \pi \right)}{2}\cr &= \left( \ln \left( n \right) -1 \right) n+\ln \left( \sqrt {2 \pi } \right) +\frac{ \ln \left( n \right)}{2} +\frac{1}{12}{n}^{-1}-{ \frac {1}{288}}\,{n}^{-3}+{\frac {1}{768}}\,{n}^{-4}+O \left( {n}^{-5} \right) \cr} $$

So the error in Ramanujan's approximation is asymptotic to $\left(\dfrac{1}{288} - \dfrac{1}{360}\right) n^{-3} = \dfrac{1}{1440} n^{-3}$.

EDIT: an even better approximation, then, would be

$n\ln \left( n \right) -n+\dfrac{\ln \left(1/30 + n \left( 1+4\,n \left( 1+2 \,n \right) \right) \right)}{6} +\dfrac{\ln \left( \pi \right)}{2}$

where the error is asymptotic to $-\dfrac{11}{11520} n^{-4}$. Thus at $n=10$ we have $\ln 10! \approx 15.1044125730755$, Ramanujan's approximation $\approx 15.1044119983597$ and the improved approximation $\approx 15.1044126589476$.

share|improve this answer
Nice. Thanks! I suspected that by matching the first few coefficients in the error term of Stirling's and rewriting them as log one could get this approximation. I was wondering if there was an inherently new way of coming up with this asymptotic directly instead of comparing with Stirling and then matching coefficients. – user17762 Jun 1 '12 at 17:11
1  
The Ramanujan approximation can equivalently be written as $\dfrac{n!(e/n)^n}{\sqrt{2\pi n}} = \left(1 + \dfrac{1}{2n} + \dfrac{1}{8n^2} + \ldots \right)^{1/6}$, compared to the standard Stirling series $1 + \dfrac{1}{12n} + \dfrac{1}{288n^2} + \ldots$. I don't know what is so special about the exponent $1/6$ in this context. – Robert Israel Jun 1 '12 at 18:41
On the other hand, you could write this as $\left(1 + \dfrac{1}{\sqrt{5}n} + \dfrac{1}{10 n^2} + \ldots\right)^{\sqrt{5}/12}$, which has the advantage that the coefficient of $1/n^3$ is $0$. – Robert Israel Jun 1 '12 at 18:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.