The expected value E satisfies the following equation:CalCat 写了: 2023年 2月 3日 14:52 如下是我的第五个问题,希望你能帮助模拟。我已经学习了Colab,发现功能非常的强大,所以,如果可能的话,你也贴一下code。感谢在先。
同时投掷两个6面体的骰子,记录它们的结果总和点数,每次可能得到如下的点数:2, 3, 4, 5, 6, 7, 8, 9, 10 , 11, 12。 一直投掷,直到点数是三个7 连续出现或者被12间隔的出现。请问, 平均来说,需要投掷多少次使得这个结果发生?(更加详细的解释:7-7-7出现可以,7-12-7-7 出现也可以,7-12-12-7-12-7出现也可以。只要三个7不被12以外的任何点数隔断就行)
E = P(1st not 7)*(1+E) + \sum_{n = 3}^{\infty} n*P(lucky with the 3rd 7 at the nth) + \sum_{n = 2}^{\infty} P(lucky until the nth)*(29/36)*(n+E),
in which P(1st not 7) = 5/6 is the probability of not getting 7 at the 1st roll of dice, P(lucky with the 3rd 7 at the nth) is the probability of getting 7 at the first roll then then followed by 12's or 7's only and then getting the 3rd 7 at the nth roll of dice, P(lucky until the nth) is the probability of getting 7 at the first roll followed by 12's and at most one 7 by (and including) the (n-1)st roll, and 29/36 is the probability of getting neither 12 nor 7 at the nth roll. Both P(lucky with the 3rd 7 at the nth) and P(lucky until the nth) can be computed explicitly.
This may not be the cleverest way to compute E. Just a thought...