MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Formula Stirlinga


It works correctly.

Try this

n = 1000

Log[n!] // N

n Log[n] - n // N

n Log[n] - n + 1 // N

Sqrt[2 \[Pi] n] (n/E)^n // N

n! // N

%% - %

n!/(Sqrt[2 \[Pi] n] (n/E)^n) // N

The proportional error at n=1000 is

(n! - Sqrt[2*Pi*n]*(n/Exp[1])^n)/n! // N = -0.000083329858430


and check out http://en.wikipedia.org/wiki/Stirling%27s_approximation

where the ratio n!/(Sqrt[2 \[Pi] n] (n/E)^n) is given limits.

Cheers

Barrie

>>> On 02/05/2013 at 11:43 am, in message <20130502014311.555F56A80 at smc.vnet.net>,
<karchevskymi at gmail.com> wrote:
> n = 1000;
> N[n! - Sqrt[2*Pi*n]*(n/Exp[1])^n] = 3.35308734163*10^2563
> Why does Stirling's formula works incorrect?




  • Prev by Date: Re: Formula Stirlinga
  • Next by Date: Re: Formula Stirlinga
  • Previous by thread: Re: Formula Stirlinga
  • Next by thread: Re: Formula Stirlinga