in reply to Stirling Approx to N! for large Number?
I hope you miscopied your "reasonable approximation" because it's off by an order of magnitude . . . (4.0e5 vs 4.1e6). Also IMSMR log(n*m) should be log(n) + log(m) so the commented out example should be log(2) + log(PI) rather than log(2 + log(PI)) (which might explain any inacurracy).
Addendum: If you have access to a copy of Numerical Recipies In C (ISBN 0521431085), chapter 6 has a factorial approximation using ln(Γ(x)) which should be easily translated into Perl (or use it unaltered via Inline::C).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Stirling Approx to N! for large Number?
by jimbojones (Friar) on Mar 25, 2005 at 14:45 UTC |