How Big Must N Be for Stirling's Formula to Achieve 2% Accuracy?

  • Thread starter Thread starter Physgeek64
  • Start date Start date
  • Tags Tags
    Accuracy Formula
Click For Summary

Homework Help Overview

The discussion revolves around determining the minimum value of N for which Stirling's formula achieves an accuracy of within 2%. Participants are exploring the implications of using different versions of Stirling's formula and the mathematical expressions involved in this context.

Discussion Character

  • Exploratory, Assumption checking, Conceptual clarification

Approaches and Questions Raised

  • Participants discuss the starting point of the problem, which involves the expression ##\frac{N lnN-N}{lnN!} =\alpha##. There are attempts to substitute values for N to evaluate the expression's accuracy. Some participants suggest using inequalities derived from Stirling's formula to assess the accuracy of the approximation.

Discussion Status

The discussion is active, with various interpretations of what constitutes the "simple version" of Stirling's formula being explored. Some participants have raised concerns about the accuracy of certain formulations and the implications of using logarithmic approximations. Guidance has been offered regarding the use of inequalities to approach the problem, but no consensus has been reached on the best method to determine N.

Contextual Notes

There is mention of the limitations of the simple version of Stirling's formula and the necessity of including certain factors for achieving the desired accuracy. Participants are also questioning the assumptions made regarding the logarithmic transformations and their effects on the original function.

Physgeek64
Messages
245
Reaction score
11

Homework Statement


How big must N be for the simple version of stirlings formula to be accurate to within 2%

Homework Equations

The Attempt at a Solution


So I think the starting point is

##\frac{N lnN-N}{lnN!} =\alpha ## where ##\alpha=0.98##

But i have no idea how to solve this expression for N

Many thanks
 
Physics news on Phys.org
Physgeek64 said:

Homework Statement


How big must N be for the simple version of stirlings formula to be accurate to within 2%

Homework Equations

The Attempt at a Solution


So I think the starting point is

##\frac{N lnN-N}{lnN!} =\alpha ## where ##\alpha=0.98##

But i have no idea how to solve this expression for N
You can't solve it algebraically, but you can substitute values of N. With N = 100, ##\alpha \approx 0.991##
 
  • Like
Likes   Reactions: Charles Link
One thing that can aid in the computation is ## \ln{ N!}=\ln{N}+\ln(N-1)+... +\ln{2}+\ln{1} ##, but otherwise, this simply needs to be computed with the computer doing the work.
 
Physgeek64 said:

Homework Statement


How big must N be for the simple version of stirlings formula to be accurate to within 2%

Homework Equations

The Attempt at a Solution


So I think the starting point is

##\frac{N lnN-N}{lnN!} =\alpha ## where ##\alpha=0.98##

But i have no idea how to solve this expression for N

Many thanks

What, exactly, do you regard as the "simple version" of Stirling's formula? The simplest version that actually works is
$$N! \sim \sqrt{2 \pi} \, N^{N+ (1/2)} \, e^{-N},$$
and without the factors ##\sqrt{2 \pi}## and ##\sqrt{N}## the formula can never, ever get within 2% of ##N!##, no matter how large is ##N##.

However, in pp. 52--54 of his beautiful probability book, Feller gives a surprisingly simple derivation of the following:
$$\sqrt{2 \pi} N^{N+ (1/2)} e^{-N} < N! < \sqrt{2 \pi} \, N^{N+ (1/2)} \, e^{-N\:+\: 1/(12N)},$$
and this works for all ##N \geq 1##. (For clarity:the exponent is ##-N + \frac{1}{12N}##.) For example, even when ##N## is as small as ##N=1## the inequalities read as ##0.9221< 1 < 1.002##.

The inequalities should allow you to figure out when ##\sqrt{2 \pi}\, N^{N+ (1/2)} \, e^{-N}## comes within 2% of ##N!##.

See, eg., https://www.amazon.com/dp/0471257087/?tag=pfamazon01-20 for more information on Feller's book. I understand that free versions are now available on-line as pdf files.
 
Last edited:
Ray Vickson said:
What, exactly, do you regard as the "simple version" of Stirling's formula? The simplest version that actually works is
$$N! \sim \sqrt{2 \pi} \, N^{N+ (1/2)} \, e^{-N},$$
and without the factors ##\sqrt{2 \pi}## and ##\sqrt{N}## the formula can never, ever get within 2% of ##N!##, no matter how large is ##N##.

However, in pp. 52--54 of his beautiful probability book, Feller gives a surprisingly simple derivation of the following:
$$\sqrt{2 \pi} N^{N+ (1/2)} e^{-N} < N! < \sqrt{2 \pi} \, N^{N+ (1/2)} \, e^{-N\:+\: 1/(12N)},$$
and this works for all ##N \geq 1##. (For clarity:the exponent is ##-N + \frac{1}{12N}##.) For example, even when ##N## is as small as ##N=1## the inequalities read as ##0.9221< 1 < 1.002##.

The inequalities should allow you to figure out when ##\sqrt{2 \pi}\, N^{N+ (1/2)} \, e^{-N}## comes within 2% of ##N!##.

See, eg., https://www.amazon.com/dp/0471257087/?tag=pfamazon01-20 for more information on Feller's book. I understand that free versions are now available on-line as pdf files.
I think the 'simplest formula' is meant to be ##NlnN-N## in this case
 
Physgeek64 said:
I think the 'simplest formula' is meant to be ##NlnN-N## in this case

It is simple for sure; it is also wrong. You must beware of assuming that an accurate formula for ##\ln (f(n)## produces an accurate formula for ##f(n)## via exponentiation. It generally does not, and Stirling's formula is a perfect example of that.
 
Ray Vickson said:
It is simple for sure; it is also wrong. You must beware of assuming that an accurate formula for ##\ln (f(n)## produces an accurate formula for ##f(n)## via exponentiation. It generally does not, and Stirling's formula is a perfect example of that.
Okay, but how would i go about working out for which N gives an answer to within 2% of the true value? Thanks :)
 
Physgeek64 said:
Okay, but how would i go about working out for which N gives an answer to within 2% of the true value? Thanks :)

Use the two inequalities I wrote in #4.
 
Ray Vickson said:
Use the two inequalities I wrote in #4.
Can you solve for N in these, or just plug in values of N?
 
  • #10
Ray Vickson said:
You must beware of assuming that an accurate formula for ##\ln (f(n)## produces an accurate formula for ##f(n)## via exponentiation. It generally does not, and Stirling's formula is a perfect example of that.
If the accuracy of ln( f(n) ) is in terms of abs( trueValue - estimatedValue ) and the desired accuracy is in terms of percentage, I think this should be possible.
 
  • #11
FactChecker said:
If the accuracy of ln( f(n) ) is in terms of abs( trueValue - estimatedValue ) and the desired accuracy is in terms of percentage, I think this should be possible.
Unfortunately, not. If ##f(n) \sim g(n) \to \infty## as well as ## \ln f(n), \ln g(n) \to \infty##, then we have ##\ln f(n) \sim \ln g(n)##. However, we also have ##\ln f(n) \sim \ln 2 + \ln g(n)##, and yet we do not have ##2 g(n)## asymptotic to ##f(n)##. And that is the problem right there: an additive constant in the logarithm (whose importance goes to zero in the limit) becomes a constant mutliplicative factor in the original function, whose importance never goes away.
 
  • #12
Physgeek64 said:
Can you solve for N in these, or just plug in values of N?

You can do it either way, but solving directly for N is easier.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
Replies
3
Views
2K
Replies
10
Views
3K