Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can determine dice sum probabilities? [closed]

Tags:

math

In trying to solve a particular Project Euler question, I ran into difficulties with a particular mathematical formula. According to this web page (http://www.mathpages.com/home/kmath093.htm), the formula for determining the probability for rolling a sum, T, on a number of dice, n, each with number of sides, s, each numbered 1 to s, can be given as follows:

alt text http://www.freeimagehosting.net/uploads/8294d47194.gif

After I started getting nonsensical answers in my program, I started stepping through, and tried this for some specific values. In particular, I decided to try the formula for a sum T=20, for n=9 dice, each with s=4 sides. As the sum of 9 4-sided dice should give a bell-like curve of results, ranging from 4 to 36, a sum of 20 seems like it should be fairly (relatively speaking) likely. Dropping the values into the formula, I got:

alt text http://www.freeimagehosting.net/uploads/8e7b339e32.gif

Since j runs from 0 to 7, we must add over all j...but for most of these values, the result is 0, because at least one the choose formulae results are 0. The only values for j that seem to return non-0 results are 3 and 4. Dropping 3 and 4 into this formula, I got

alt text http://www.freeimagehosting.net/uploads/490f943fa5.gif

Which, when simplified, seemed to go to:

alt text http://www.freeimagehosting.net/uploads/603ca84541.gif

which eventually simplifies down to ~30.75. Now, as a probability, of course, 30.75 is way off...the probability must be between 0 and 1, so something has gone terribly wrong. But I'm not clear what it is.

Could I misunderstanding the formula? Very possible, though I'm not clear at all where the breakdown would be occuring. Could it be transcribed wrong on the web page? Also possible, but I've found it difficult to find another version of it online to check it against. Could I be just making a silly math error? Also possible...though my program comes up with a similar value, so I think it's more likely that I'm misunderstanding something.

Any hints?

(I would post this on MathOverflow.com, but I don't think it even comes close to being the kind of "postgraduate-level" mathematics that is required to survive there.)

Also: I definitely do not want the answer to the Project Euler question, and I suspect that other people that my stumble across this would feel the same way. I'm just trying to figure out where my math skills are breaking down.

like image 724
Beska Avatar asked Dec 10 '22 17:12

Beska


2 Answers

According to mathworld (formula 9 is the relevant one), the formula from your source is wrong.

The correct formula is supposed to be n choose j, not n choose T. That'll really reduce the size of the values within the summation.

The mathworld formula uses k instead of j and p instead of T:
formula from mathworld

like image 106
Welbog Avatar answered Dec 12 '22 07:12

Welbog


Take a look at article in wikipedia - Dice. The formula here looks almost similar, but have one difference. I think it will solve your problem.

like image 42
woo Avatar answered Dec 12 '22 05:12

woo