Skip to Content
 

Dice Probabilities

6 replies [Last post]
omni989
Offline
Joined: 04/30/2011

Hello

Hope some1 can help. Its probably quite simple but Im not having much fun working it out.

Firstly I need to calculate the probability of rolling X number of successes on multiple D6 where 1-3 are failures, 4 & 5 are one success each and 6 is two successes. I will need to map out the probability of exactly 1 success, 2 success, 3 success etc on 2D6, 3D6, 4D6 up to 6 D6.

I'll put up secondly if the above gets sorted, want to make sure this is the right place to post this kind of stuff first

I hope I have explained that clearly and that someone will offer some solutions.

Thanks in advance

Maaartin
Offline
Joined: 05/15/2011
It's simple with a script

I can only offer a recursive formula: Let p(s, t) denote the probability of s successes in t tries.

  • p(0, 0) = 1
  • p(s, 0) = 0 for s!=0
  • p(s, t) = 1/2 * p(s, t-1) + 1/3 * p(s-1, t-1)+ 1/6 * p(s-2, t-1) for t>0

I wrote a python script which I can't paste here due to formatting problems, but here are the results:

      successes      0      1      2      3      4      5      6      7      8      9     10     11
               0  1.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
               1  0.500  0.333  0.167  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
               2  0.250  0.333  0.278  0.111  0.028  0.000  0.000  0.000  0.000  0.000  0.000  0.000
               3  0.125  0.250  0.292  0.204  0.097  0.028  0.005  0.000  0.000  0.000  0.000  0.000
               4  0.062  0.167  0.250  0.241  0.165  0.080  0.028  0.006  0.001  0.000  0.000  0.000
               5  0.031  0.104  0.191  0.231  0.204  0.135  0.068  0.026  0.007  0.001  0.000  0.000
SilentFury
Offline
Joined: 10/23/2011
He needs the numbers to work

He needs the numbers to work up to 6 dice, but otherwise this is solid, and it'll be easy for you to modify it to generate the extra row.

Maaartin
Offline
Joined: 05/15/2011
OK

So the corrected script and the results:

p  0      1      2      3      4      5      6      7      8      9      10     11
0  1.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
1  0.500  0.333  0.167  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
2  0.250  0.333  0.278  0.111  0.028  0.000  0.000  0.000  0.000  0.000  0.000  0.000
3  0.125  0.250  0.292  0.204  0.097  0.028  0.005  0.000  0.000  0.000  0.000  0.000
4  0.062  0.167  0.250  0.241  0.165  0.080  0.028  0.006  0.001  0.000  0.000  0.000
5  0.031  0.104  0.191  0.231  0.204  0.135  0.068  0.026  0.007  0.001  0.000  0.000
6  0.016  0.062  0.135  0.197  0.211  0.174  0.113  0.058  0.023  0.007  0.002  0.000

Btw., I spent much more time by formatting the output than by programming.

pelle
pelle's picture
Offline
Joined: 08/11/2008
...and I installed python

...and I installed python on my phone about an hour ago and this was a first opportunity to test it. Your script ran fine. :)

Maaartin
Offline
Joined: 05/15/2011
Cool

I'm adding a short explanation for the formula p(s, t) = 1/2 * p(s, t-1) + 1/3 * p(s-1, t-1)+ 1/6 * p(s-2, t-1):

There are three possibilities how to get s successes using t tries:

  • Roll 1, 2, or 3, after having obtained s successes using t-1 tries, the probability is 3/6=1/2.
  • Roll 4 or 5, after having obtained s-1 successes using t-1 tries, the probability is 2/6=1/3.
  • Roll 6, after having obtained s-2 successes using t-1 tries, the probability is 1/6.

That's all.

omni989
Offline
Joined: 04/30/2011
Thanks very much. Thats very

Thanks very much. Thats very helpful. perhaps i should look into Python

Syndicate content


forum | by Dr. Radut