Stirling’s approximation formula
Posted on September 22, 2007
I don’t know what Stirling was drinking but this
is just beautiful!
Filed Under Uncategorized |
9 Comments so far
Leave a Comment
If you would like to make a comment, please fill out the form below.
CRAZY SH*T MAN!!
Woow
hold it, does this mean its faster to calculate n! by this approximation? instead of recursion or w/e?
Yes, for large values of n, you can get n! in constant time O(1).
That is just amazing…
this is amazing…. wtf, does this mean, by any chance, that there might be such solutions (approximations) for other recursive calculations?
lets say, fabonati…(i cant come up with any other one off the top of my head)
I remember in one of our classes we converting sequences to functions that took n^th element of the sequence and computed the value without recursion.
But I need to check the book.
I’m not sure if any such problem can be solved in a constant time, but I’m pretty sure that any recursive algorithm can be computer iteratively (in a loop).
But loops, as recursion, take none constant time.
In practical situations when program requires some long computations, it’s possible to precompute the all or some results on the working interval,
For example every n^th value, so that you can compute any m^th > n^th starting from n^th (not from 0) thus saving some time.
Althought it does not metter it theory, in practice we often work within reasonable small numeric interval.
i see
I remember, once I saw a CD-ROM full of precomputed integers, it was used for some physics simulator.
Oh nice man, i didnt know they’d do that!
Good idea indeed!