Trouble with Stirling's formula

  • Thread starter stepheckert
  • Start date
  • Tags
    Formula
In summary: Thus, the probability equation can be simplified as: (499,500)(1/2)^1000In summary, the conversation discusses the use of Stirling's formula to calculate probabilities in systems with a large number of elements. However, the problem arises when trying to input the approximation into the probability equation, resulting in overflows on the calculator. The solution is to simplify the equation by reducing the factor (1000!/(2! 998!)) to 499,500.
  • #1
stepheckert
6
0
I am trying to solve for probabilities in systems with a large number of elements. To deal with the large factorials that appear in these formulas, I use Stirling's formula, lnm!=mlnm-m+(1/2)ln(2πm). My problem is that after I get the approximation and try to plug it into the probability formula, N!/(n!(N-n)!)(p^n)(q^(N-n)), I get overflows on my calculator. How can I get around this?

Here is an example problem:

Using Stirling's formula, calculate the probability of getting exactly 500 heads and 500 tails when flipping 1000 coins.

The probability equation looks like: (1000!/(2!998!))(1/2)^2(1/2)^998

I used lnm!=mlnm-m+(1/2)ln(2πm) to get: ln998!=5898.3 and ln1000!=5912.2

I wound up with somehting that looked like this: (e^5912.2/2e^5898.3)(1/2)^2(1/2)^998

How do I get my calculate to work with these kind of numbers??

Thanks for any help!
 
Physics news on Phys.org
  • #2
stepheckert said:
Here is an example problem:

Using Stirling's formula, calculate the probability of getting exactly 500 heads and 500 tails when flipping 1000 coins.

The probability equation looks like: (1000!/(2!998!))(1/2)^2(1/2)^998

Looks like you switched from 500 heads and 500 tails to 998 heads and 2 tails (or 2 heads and 998 tails).
I used lnm!=mlnm-m+(1/2)ln(2πm) to get: ln998!=5898.3 and ln1000!=5912.2

I wound up with somehting that looked like this: (e^5912.2/2e^5898.3)(1/2)^2(1/2)^998

How do I get my calculate to work with these kind of numbers??

If you collect all of your factors of 2, you get 21001 in the denominator. Can you write that as e raised to some power? If so, you should be able to combine all of the exponential factors and express the answer as e raised to a large negative power.
 
  • #3
The factor (1000!/(2! 998!)) can be reduced as follows:

1000! = 1000 * 999 * 998!

therefore (1000!/(2! 998!)) = 1000 * 999 * 998! / (2 * 998!) = 999000 / 2 = 499,500
 

1. What is Stirling's formula and why is it important?

Stirling's formula is a mathematical approximation used to estimate the factorial of a large number. It is important because it allows us to quickly calculate the value of factorials without having to manually multiply all of the numbers.

2. What are some common issues or problems with using Stirling's formula?

One of the main issues with Stirling's formula is that it is only an approximation and not an exact value. This means that it may not always give the most accurate result, especially for smaller numbers. Additionally, it may not work well for extremely large numbers or numbers with decimal values.

3. How does Stirling's formula compare to other methods of calculating factorials?

Stirling's formula is generally faster and easier to use compared to other methods such as the factorial formula or the gamma function. However, other methods may provide more accurate results for certain values.

4. Can Stirling's formula be used for non-integer values?

No, Stirling's formula is only applicable for positive integers. Attempting to use it for non-integer values may result in inaccurate or undefined results.

5. Are there any real-life applications of Stirling's formula?

Yes, Stirling's formula has various applications in fields such as statistics, physics, and computer science. It is commonly used in probability and combinatorics to estimate the number of possible outcomes in a given scenario.

Similar threads

  • Advanced Physics Homework Help
Replies
7
Views
2K
  • Advanced Physics Homework Help
Replies
10
Views
3K
Replies
1
Views
793
  • Advanced Physics Homework Help
Replies
1
Views
2K
  • Advanced Physics Homework Help
Replies
15
Views
2K
  • Advanced Physics Homework Help
Replies
9
Views
1K
  • Advanced Physics Homework Help
Replies
2
Views
1K
Replies
16
Views
516
  • Advanced Physics Homework Help
Replies
3
Views
905
  • Calculus and Beyond Homework Help
Replies
3
Views
938
Back
Top