Roulette Probability Formula
Thread Rating:
- Roulette Probability Statistics
- Roulette Probability Formula
- Probability
- Roulette Probability Formula Cheat
The odds for a random event, like a die toss or a roulette spin, denote the likelihood of this event taking place. To calculate the odds for winning with a given roulette bet, you need to figure out what its probability is. Then you can use the following formula: Odds for Winning = Probability of Winning / (1 – Probability of Winning). The calculation of roulette wheel probabilities is very simple. Let us take the classic example of a dice with the numbers one to six. How large is the probability that the next throw is the number five? To calculate the odds for winning with a given roulette bet, you need to figure out what its probability is. Then you can use the following formula: Odds for Winning = Probability of Winning / (1 – Probability of Winning).
I'm trying to solve the question, what is the probability of x hits of a certain number on a 37-slot roulette wheel over a certain number of spins?
e.g.:
p = 1/37 (probability of success of one trial)
q = 1-p (probability of failure of one trial)
x = 1 (number of successes)
n = (number of spins)
Binomial formula: n! ÷ ( x! * (n-x)! ) * px * q(n-x)
With n=170, I get 0.0448 in both LibreOffice Calc (spreadsheet) and my Javascript code.
With n=171, LibreOffice gives a '#VALUE!' error and JS says the answer is Infinity.
Surely I haven't gone from 4.5% to Infinity from just one additional spin!
With n=200, JS returns 'NaN' (not a number).
I'm confused.
Administrator
My software is giving me unexpected results for binomial probabilities.
I'm trying to solve the question, what is the probability of x hits of a certain number on a 37-slot roulette wheel over a certain number of spins?
e.g.:
p = 1/37 (probability of success of one trial)
q = 1-p (probability of failure of one trial)
x = 1 (number of successes)
n = (number of spins)
Binomial formula: n! ÷ ( x! * (n-x)! ) * px * q(n-x)
With n=170, I get 0.0448 in both LibreOffice Calc (spreadsheet) and my Javascript code.
With n=171, LibreOffice gives a '#VALUE!' error and JS says the answer is Infinity.
Surely I haven't gone from 4.5% to Infinity from just one additional spin!
With n=200, JS returns 'NaN' (not a number).
I'm confused.
170! is pretty big at 7.257416e+306
The biggest/largest integer that can be stored in a double without losing precision is the same as the largest possible value of a double. That is, DBL_MAX or approximately 1.8 × 10^308 (if your double is an IEEE 754 64-bit double).
You are close to that limit.
The problem is you ask the software to compute a huge number (171!) to get a much smaller one.
Note: Excel computes COMBIN(171,x) without problem.
No need to use excel for something that can be done by any calculator or even by hand or slide rule.
(36/37)^169 * 170/37 = 0.0448 = a
a * 36/37 * 171/170 = 0.0438
In 171 spins you expect to hit your 1/37 number 4.62 times. You have a 1 - (36/37)^171 = 99.08 % chance of hitting it at least once, a 4.38% chance of hitting it exactly once and a 94.7 % chance of hitting it twice or more
It avoids getting huge numbers because most terms cancel.
@OnceDear, yes, I should have figured out that one of my variables besides the actual result was going out of bounds. (Duh.)
@CrystalMath, your solution is perfect and exceptionally helpful. Thanks so much!
So, my understanding of canceling the factorials doesn't jibe with CrystalMath's Java/C code above. (CrystalMath, I'm referring to you in the third person not out of disrespect, but because other people might be helping besides you.)
So I must be missing something. Here's my understanding:
Binomial coefficient:
n = 10
x = 7
So, to do the most cancelation, I should cancel n! with x!, not with (n-x)!
The binomial coefficient formula can be rewritten as:
So, I'll calculate the factorials after canceling, then divide by the factorial of n-x, then multiply by the rest of the binomial probability formula.
After cancelation, I'll be multiplying 8 x 9 x 10. So, my code starts with:
CrystalMath's code is:
So, that's the first thing that doesn't make sense to me. I'm guessing he's taking a shortcut.
However, if I use his code, looking for the probability of at least one hit of a single number over 37 spins, I get 38%. That does jibe with what I get in my spreadsheet. But it's not intuitive (seems low, seems like it should be >50%), and it doesn't jibe with the formula:
1 - (ways to win / total ways) ^ trials = 1 - (36/37)^37 = 64%.
So, that's the second thing I'm confused about.
Finally, when I use my own JS code, my results are even farther off. My understanding for 'at least' is that I find the probability for exactly x matches, then multiply it by the number of trials.
That gives me probability of <0.1%, which is clearly wrong. That's the third thing I'm lost on.
There is a symmetry : Cnx = Cnn-x
So you could put some code like x:= max(x,n-x)?
2d thing and 3d thing.
P(at least) is not P(exactly), but it is also not [1-P(exact)]^n or *n. You need to compute P(exact) for all the x’s from x to n, then sum it.
Looking at this example:
Roulette Probability Statistics
We can simplify this to 10 x 9 x 8/(3 x 2 x 1). So, the loop should just do three steps.I've modified my code below.
If you want 'at least,' you will need to loop through all possibilities and sum them.
Roulette Probability Formula
This gives the cumulative distribution from 0 hits up to x. If you want x or greater, then calculate 1 - cumulativeBinomDist(x-1,n,p).
Probability
The problem with blocking members is that you end up posting redundant info!
I sometimes feel nobody reads my posts.
Roulette Probability Formula Cheat
- Page 1 of 3