Re: Formula Stirlinga

• To: mathgroup at smc.vnet.net
• Subject: [mg130696] Re: Formula Stirlinga
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Fri, 3 May 2013 03:51:49 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <20130502014311.555F56A80@smc.vnet.net>

```It works fine in the ratio form. The difference form appears to be
numerically unstable unless you use Log.

\$Version

"9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"

Clear[n];

Limit[
n!/(Sqrt[2*Pi*n]*(n/E)^n),
n -> Infinity]

1

With[{n = 1000},
N[n!/(Sqrt[2*Pi*n]*(n/E)^n)]]

1.00008

Limit[
Log[n!] - Log[Sqrt[2*Pi*n]*(n/E)^n],
n -> Infinity]

0

With[{n = 1000},
N[Log[n!] - Log[Sqrt[2*Pi*n]*(n/E)^n]]]

0.0000833333

Bob Hanlon

On Wed, May 1, 2013 at 9:43 PM, <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: How to set Mathematica not return huge float numbers
• Previous by thread: Re: Formula Stirlinga
• Next by thread: Re: Formula Stirlinga