Factorials and Stirling's Formula
By Paul on Saturday, December 22, 2001 -
12:17 pm:
Is there any way of calculating n! without encountering the
large number created by the factorial?
By Nicholas Dean on Thursday, June 06,
2002 - 03:16 pm:
On a calculator I approximate
. When
the error is less
than 0.03%.
By Graeme Mcrae on Thursday, June 06, 2002
- 06:06 pm:
Nicholas, it's a good approximation. In fact, for n=60, it's
perfect!
Your expression can be simplified to:
The constant (1.519...) can be adjusted to make any particular
"n" come out exact, and the others will be wrong by only a few
percent at the most. It's a pretty good approximation.
By Graeme Mcrae on Thursday, June 06, 2002
- 10:07 pm:
Nicholas, just fooling around with an Excel spreadsheet, I
noticed that some adjustments can be made that make the formula
fit even better:
gives
to the nearest
integer for
up to 7, and the nearest multiple of 10 for
up to 10.
After 10, the formula gives
with an error less than 0.002%.
Here's another thought:
gives a close approximation for all
.
The error is less than 1% when
, less than 0.1% when
, less than
0.01% when
, approaching zero (up to rounding error of Excel) as
increases.
By the way, the gammaln function in Excel gives the natural log
of (n-1)! which is very useful for evaluating formulas like this
for large n.
Does anyone know the limit as
of
?
It seems to be about 1.52034683, but is there an exact answer,
or does this number have a name?
Here's another one:
is exactly equal to
when
is 1, and less than 0.1% off for all other
, approaching a
limit of 0% error as
approaches infinity.
--Graeme
By Arun Iyer on Thursday, June 06, 2002 -
10:41 pm:
the answer of the required limit is
love arun
By Graeme Mcrae on Thursday, June 06,
2002 - 11:05 pm:
Oh, thanks Arun,
is 1.52034690, proving that my
numerical fooling around came very close to the right answer. Thanks for the
info!
This means that a fairly good approximation of
, for large
, is
.
--Graeme
By Arun Iyer on Friday, June 07, 2002 -
06:52 am:
Oh!!so you require an approximation of n!....
Why don't you use Stirlings formula..
is asymptotic to
as
tends to infinity.
This is what i used to evaluate your limit actually.
love arun
[Editor: Here's an interesting thread on
large
factorial calculations . ]