## Poll

6 votes (54.54%) | |||

1 vote (9.09%) | |||

1 vote (9.09%) | |||

3 votes (27.27%) |

**11 members have voted**

November 18th, 2015 at 5:26:11 PM
permalink

A while ago it was asked what is the expected number of rolls with two dice to achieve every total from 2 to 12. I just created an Expected Trials Calculator to answer such questions. Just put in the probability or number of combinations for up to 19 different outcomes (as many as JavaScript would take), click the calculate button, and viola -- your answer.

Please check it out. As always I welcome questions, comments, and especially corrections.

The question for the poll is what do you think?

Please check it out. As always I welcome questions, comments, and especially corrections.

The question for the poll is what do you think?

It's not whether you win or lose; it's whether or not you had a good bet.

November 18th, 2015 at 6:54:09 PM
permalink

I put in ten 2's and a 1

You know, for the number of ways for at least one of the dice to be a certain number.

The answer was 36, which I think makes sense, you might expect to have to cycle through all 36 possibilities to see each of those 11 possibilities once.

You know, for the number of ways for at least one of the dice to be a certain number.

The answer was 36, which I think makes sense, you might expect to have to cycle through all 36 possibilities to see each of those 11 possibilities once.

November 18th, 2015 at 8:55:26 PM
permalink

Quote:Dalex64I put in ten 2's and a 1

You know, for the number of ways for at least one of the dice to be a certain number.

The answer was 36, which I think makes sense, you might expect to have to cycle through all 36 possibilities to see each of those 11 possibilities once.

It isn't that there are 36 possibilities. There are an infinite number.

It's not whether you win or lose; it's whether or not you had a good bet.

November 18th, 2015 at 11:19:22 PM
permalink

If I have 2 sets of dice, 2 red and two blue, and throw all four at the same time, but only evaluate the totals by color, would it take ~62 "trials" to hit all the totals from 2 through 12, or only ~32 (since I am doubling my chance of hitting each number each "trial"? Doubling the combinations to 2,4,6, etc. Still returns 61.###

Simplicity is the ultimate sophistication - Leonardo da Vinci

November 19th, 2015 at 12:10:16 AM
permalink

Quote:Dalex64I put in ten 2's and a 1

You know, for the number of ways for at least one of the dice to be a certain number.

The answer was 36, which I think makes sense, you might expect to have to cycle through all 36 possibilities to see each of those 11 possibilities once.

The Wizard's program isn't set up to handle your question, but it should be easy to modify it so it can. His current program assumes that you are giving it all of the possible outcomes. If you put in ten 2's and a 1, his program will assume that there are 21 possible outcomes each with probability 1/21, whereas you want there to be 36 possible outcomes each with probability 1/36. A separate input would need to be provided for the total number of outcomes. Also, you don't want ten 2's and a 1 if you want the average number of rolls to get all 11 combinations that give you a certain number, say a six, on at least one die. You would want eleven 1's, and you'd need the separate input to specify 36 total outcomes. However, since all 11 events of interest have the same probability, it is easy to do this by hand as it is simply

36*(1/11 + 1/10 + 1/9 + 1/8 + 1/7 + 1/6 + 1/5 + 1/4 + 1/3 + 1/2 + 1/1)

≈ 108.71558 rolls.

That is, the probability of rolling the first qualifying outcome is 11/36, so it takes an average of 36/11 rolls to get it. Once you get it, the probability of rolling the second outcome is 10/36, so the average number of additional rolls to get the second after getting the first is 36/10. The third will take an additional 36/9, and so on. This is called the coupon collector problem.

Now perhaps you didn't want to distinguish the 2 dice, so for example, maybe you wanted (1,6) and (6,1) to be the same event, and you only need one of these. In that case you would want to enter five 2's and a 1 for a total of 6 events, and you'd still need the Wizard to provide the additional input for 36 total outcomes. This one is harder to do by hand since the probabilities of each event are not the same. The answer to that one comes to about 54.398701 rolls. This is called the generalized coupon collector problem, and it can be solved with the inclusion-exclusion principle. The Wizard has a good discussion of the method here.

I have written the R function below to answer all these questions.

gccp = function(total.outcomes, outcomes.per.event) {

E = total.outcomes/outcomes.per.event

L = length(outcomes.per.event)

T = E[1]

if (L > 1) T = T + outcomes.per.event[1]/(outcomes.per.event[1] + outcomes.per.event[2])*E[2]

if (L > 2) {

for (n in 3:length(outcomes.per.event)) {

p = 0

for (j in 1:(n-1)) {

terms = combn(outcomes.per.event[1:(n-1)],j)

for (k in 1:(length(terms)/j)) {

p = p + (-1)^(j+1) * outcomes.per.event[n]/(outcomes.per.event[n] + sum(terms[1:j,k]))

}

}

T = T + (1-p)*E[n]

}

}

cat("\nExpected trials for all events = ",T,"\n")

if (L > 1) {

cat("Probability of all before last = ",1-p,"\n")

cat("Odds against all before last = ",1/(1-p)-1,"to 1\n")

}

}

The first input is the total number of outcomes, and the second input is like the Wizard's - an array of numbers indicating how many outcomes there are per event. Additionally, it gives the probability and odds of getting all of the events except the final event before you get the final event, so you can use it to evaluate the Wynn bet (all numbers before a seven), all tall, all small, etc. If you only want the average number of rolls, then the order of the event inputs don't matter in either my script or the Wizard's. If you want the probability of getting all the other events before the final one, then place the number for the last event last, and the order of the others doesn't matter. For example, to evaluate the average number of rolls to get all of the numbers 2-12 in any order, and also the probability of getting the seven last, enter

> gccp(36,c(1,2,3,4,5,5,4,3,2,1,6))

For which the output is

Expected trials for all events = 61.217385

Probability of all before last = 0.0052577041

Odds against all before last = 189.19709 to 1

The expected trials is in agreement with the Wizard's example, and the probability and odds are correct for the Wynn bet. Note that the expected value is for rolling all of the numbers in any order - the seven doesn't have to be last. The seven being last only applies to the probability and odds.

If you want the average number of rolls to get all 11 outcomes that have a six on at least one die, enter

> gccp(36,c(1,1,1,1,1,1,1,1,1,1,1))

Expected trials for all events = 108.71558

Probabilty of all before last = 0.090909091

Odds against all before last = 10 to 1

In agreement with what we calculated above. If you don't want to distinguish the two dice so (1,5) = (5,1), etc., enter

> gccp(36,c(2,2,2,2,2,1))

Expected trials for all events = 54.398701

Probabilty of all before last = 0.36940837

Odds against all before last = 1.7070312 to 1

November 19th, 2015 at 3:36:47 AM
permalink

Actually we can use the Wizard's program for the problem Dalex64 asked where we want the average number of rolls for some subset of the outcomes instead of all the outcomes. We just need to scale the result. So for the average number of rolls to get all 11 dice combinations that contain a six, we would enter eleven 1's in the program which produces 33.218651, and then multiply by 36/11 to get 108.71559. If we don't want to distinguish the dice, then enter 5 twos and 1 one into the program to get 16.621825, then multiply that by 36/11 to get 54.3987. Both of these agree with the results from my function above.

The Wizard's program could apply this scaling automatically by providing a separate input for total possible outcomes, and then multiply by this number divided by the sum of the input combinations.

The Wizard's program could apply this scaling automatically by providing a separate input for total possible outcomes, and then multiply by this number divided by the sum of the input combinations.

November 19th, 2015 at 5:29:13 AM
permalink

Thanks, BruceZ, that was enlightening.

November 19th, 2015 at 6:16:34 AM
permalink

BruceZ, that was an amazing post! Welcome to the forum. My program uses the same technique you described at 2+2.

BTW, here is a link to the original discussion of the problem of rolling every total from 2 to 12.

BTW, here is a link to the original discussion of the problem of rolling every total from 2 to 12.

It's not whether you win or lose; it's whether or not you had a good bet.

November 19th, 2015 at 1:07:40 PM
permalink

I typed in 5500 thirteen times and it gave me the answer of ~41?

Oh nvm. This thing's mad confusing.

Oh nvm. This thing's mad confusing.

November 19th, 2015 at 1:27:29 PM
permalink

What's really amazing is that you can solve this using the Poisson "magic trick" similar to what I described in my first post on this forum. For rolling all numbers 2-12, we pretend that the dice are rolled at instants in time determined by a continuous Poisson points process of rate 1. Then the 11 numbers form 11 separate independent Poisson points processes of rate p

E(T) = integral {0 to infinity} P(T > t) dt.

The waiting times for each number will be exponentially distributed, so P(T > t) will be 1 minus the product of the terms like (1 - exp(-p

integrate from 0 to infinity 1 - (1-exp(-t/36))^2*(1-exp(-2t/36))^2*(1-exp(-3t/36))^2*(1-exp(-4t/36))^2*(1-exp(-5t/36))^2*(1-exp(-t/6))

and it will give you the exact result

769767316159 / 12574325400 ≈ 61.217385

You could carry out this integral by hand since it is just a product of exponential terms, and if you did, you would end up with the same terms we got from inclusion-exclusion.

_{n}the probabilities of each number. We can compute the expected value of the number of rolls to get them all fromE(T) = integral {0 to infinity} P(T > t) dt.

The waiting times for each number will be exponentially distributed, so P(T > t) will be 1 minus the product of the terms like (1 - exp(-p

_{n}*t)). You could type the following into wolframalphaintegrate from 0 to infinity 1 - (1-exp(-t/36))^2*(1-exp(-2t/36))^2*(1-exp(-3t/36))^2*(1-exp(-4t/36))^2*(1-exp(-5t/36))^2*(1-exp(-t/6))

and it will give you the exact result

769767316159 / 12574325400 ≈ 61.217385

You could carry out this integral by hand since it is just a product of exponential terms, and if you did, you would end up with the same terms we got from inclusion-exclusion.