为什么计算概率问题时不同的方法会导致不同的结果

问题描述 投票:0回答:1

问题是

“每张彩票的中奖概率为0.005。您可以免费获得25张彩票。免费彩票后,您需要支付9.6美元才能购买一张彩票。

抽到250张就保证中奖(也就是说,如果有人很倒霉,买了249张票,却没有得到任何奖励。那么当他买了第250张票时,商店可以直接给他奖励)。

请计算您中奖时的平均费用。”

方法1(最终得到-->525.48):

for i in range(26, 250):
        probability_win = (0.995 \*\* (i - 1)) \* 0.005  #win at this draw
        cost_this_draw = 9.6 \* (i - 25)  # the overall cost at this time
        revised_total_cost += probability_this_draw \* cost_this_draw
return revised_total_cost

方法2(最终得到-->1014.5):

max_draws = 250  
free_draws = 25  
cost_per_draw = 9.6
win_probability = 0.005
cumulative_probability_not_winning = 1.0
expected_total_cost = 0.0

for draw in range(1, max_draws + 1):
    if draw > free_draws:
    # only add cost when over the free draws
        expected_total_cost += cost_per_draw \* (1 - cumulative_probability_not_winning)

    # update the probability of not win at next time
    cumulative_probability_not_winning *= (1 - win_probability)
return expected_total_cost

我知道第一种方法是通过概率分布来计算。每次都是单独的。 但我不明白为什么第二种方法不同。 有人可以帮我解答这个问题吗? 非常感谢。

algorithm math probability
1个回答
0
投票

您的第一种方法是错误的,因为它确实将“恰好 250 次抽奖后获胜”视为特殊情况。

“恰好 250 张彩票中奖”的概率是 不是

0.005 * (1 - 0.005)^249

由于“250 次抽奖免费获胜”,概率计算为

1 - P("You didn't already win a previous draw")
© www.soinside.com 2019 - 2024. All rights reserved.