Stirling's Approximation, etc.

LA home
Computing
Algorithms
 glossary
 Numerical
  Num'Errors
  Polynomials
  Stirling
  Mean&S.D.
  Integration
  Stirling
Stirling's approximation for N!:
N! ~ sqrt(2 π N).(N/e)N + ...
hence
loge(N!) ~ N.loge(N) - N + 0.5 loge(N) + 0.5 loge(2 pi) +...
 
function Stirling(N) // JavaScript
 { return
    (N+0.5)*Math.log(N) - N + Math.log(2*Math.PI)/2;
 }
L
.
A
.
N=

Factorial is generalized by the Γ function to real, and even complex, values. For a positive integer, n, Γn=(n-1)!.

Notes

D. E. Knuth in The Art of Computer Programming, Fundamental Algorithms, Vol.1, p.46, (1969), gives the reference as:
James Stirling. Methodus Differentialis, p.137, (1730).
On page 111 of his book, Knuth derives a more accurate approximation:
N! = sqrt(2 π N) (N/e)N {1 + 1/12N + 1/288N2 - 139/51840N3 - 571/2488320N4 + O(1/N5)}
-- L.A., 1999, 2000, 2007, Australia.
www

free:
Linux operating-sys
OpenOffice office-suite, ver. 3.1+
The GIMP ~photoshop
Firefox web browser
FlashBlock flash on/off

© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Friday, 03-Sep-2010 13:33:30 EST.