Quote:
Originally Posted by Steen
This confused me a bit. The Wizard's page which you referenced steps through each number 2 through 12 (including the 7) so how can it be called the average number of rolls to get all numbers other than a 7?
Sorry, 61.2 was the average number of rolls to get all numbers in any order, not all numbers without a 7. I did that original computation before I even knew that there was such a thing as a Wynn bet. The only reason I put them in the order I did with the least likely numbers first was so that you could break off the computation early and have an approximation with an upper and lower bound which is how inclusion-exclusion usually works. Then later when someone wanted the probability of winning the Wynn bet, I only had to output the final value of 1-p for the 7 which was already last.
I don't think anyone ever asked for the average number of rolls to get all numbers with no 7 when you win. However, it is easy to use my code to compute that by only changing the 2 lines for E and T. Change them from
E = c(36,36,18,18,12,12,9,9,7.2,7.2,6)
T = 36
to
E = c(30,30,15,15,10,10,7.5,7.5,6,6,0)
T = 30
and that will give you an average number of about 50.9882 rolls, in agreement with your sim. We are computing the conditional expectation given that you do not roll a 7, so instead of 36 rolls to get a 2, it's only 30. Same for a 12. Then for 3, instead of 1/(2/36) = 18, it is 1/(2/30) = 15, etc. Then initialize T to 30 instead of 36 for the first one.
For the all small, in addition to changing E and T, you would need to change the in_36 numbers, and additionally change the for loop to go from 2:length(E) which will work for the other cases as well. Change the parameters to
in_36 = c(1,2,3,4,5,6)
E = c(30,15,10,7.5,6,0)
T = 30
That gives you an average number of about 37.34707 rolls, again in agreement with your sim.
Below I have included code that makes these changes automatically if you just change 1 number for the mode at the top. T is always initialized to the first value of E, so I just do that in one place for all cases.
Quote:
Just one more thing I need to address. The formula you mentioned for the average number of rolls per decision:
6 - 6*p(win)
works great but breaks down when the probability of a 7 is zero. In this case, p(win) = 100% (assuming non-zero probabilities for the remaining significant numbers) and the answer should derive from the average number of rolls to achieve all the other numbers. This is affected not only by the absense of 7's but also the resulting increase in the frequency of the other numbers.
That formula is only valid when the probability of making a 7 is 1/6. If the probability is p for p > 0, it would be
1/p - 1/p * p(win).
When p = 0, then you can compute the average value as I have done with the modified code. The above formula should still be correct in the limit as p-> 0 because you get
lim {p -> 0} 1/p * (1 - p(win))
where 1 - (pwin) -> 0.
Code:
############# Set Mode Here ########################################
mode = 2
# 1 = All numbers
# 2 = All numbers w/no 7
# 3 = All small w/no 7
####################################################################
if (mode == 1) {
in_36 = c(1,1,2,2,3,3,4,4,5,5,6)
E = c(36,36,18,18,12,12,9,9,7.2,7.2,6)
} else if (mode == 2) {
in_36 = c(1,1,2,2,3,3,4,4,5,5,6)
E = c(30,30,15,15,10,10,7.5,7.5,6,6,0)
} else {
in_36 = c(1,2,3,4,5,6)
E = c(30,15,10,7.5,6,0)
}
####################################################################
T = E[1]
for (i in 2:length(E)) {
p = 0
for (j in 1:(i-1)) {
terms = combn(in_36[1:(i-1)],j)
for (k in 1:(length(terms)/j))
p = p + (-1)^(j+1) * in_36[i]/(in_36[i] + sum(terms[1:j,k]))
}
T = T + (1-p)*E[i]
}
T
1/(1-p)
Last edited by BruceZ; 05-22-2014 at 03:52 AM.