In a certain British soccer pool,
the objective is to pick games
that end in a tie. The ticket buyer
picks 8 games from a list of 45 or
more. For each of these games,
if the teams tie, the player gets 3
points, if the visiting team wins,
they get 2 points, and if the home
team wins, they get 1.5 points. The
entry with the highest point total
wins.
Assume that for each game,
the probability of the home team’s
winning is 0.5, the probability of
the visiting team’s winning is 0.4,
and the probability of a tie is 0.1.
Determine the probability that the total
points for an entry will be 22 or
higher.
W = Home team wins
L = Home team loses
T = Tie
Consider all the ways 8 nonnegative integers can sum to 8.
Identify specific numbers for W, L, T which result in >= 22.
Final answer: 5.210000000000003e-06
= 0.00000521
My check sum for the sum of all probabilities was slightly less than 1 by about 1/2 of 1 percent, I assume from rounding/truncation math errors.
------------------
facs = [1,1,2,6,24,120,720,5040,40320]
def score(wlt):
""" wlt is a string formed by concatenating the wins, losses, ties from any set of games picked """
W = int(wlt[0])
L = int(wlt[1])
T = int(wlt[2])
return 3*T + 2*L + 1.5*W
def prob(wlt):
W = int(wlt[0])
L = int(wlt[1])
T = int(wlt[2])
factor = facs[8] / (facs[W]*facs[L]*facs[T])
return (.1**T * .4**L * .5**W) * factor
sumOfAllProbs = 0
prob_ge_22 = 0
for W in range(8):
for L in range(8):
if W + L > 8:
continue
T = 8 - W - L
pattern = str(W) + str(L) + str(T)
print(W,L,T,
' ', pattern,
' ', score(pattern),
' ', prob(pattern))
sumOfAllProbs += prob(pattern)
if score(pattern) >= 22:
prob_ge_22 += prob(pattern)
print('\n', 'probabilities should sum to 1.0 ')
print(sumOfAllProbs,'\n')
print(prob_ge_22)
------ output ------
0 0 8 008 24.0 1.0000000000000005e-08
0 1 7 017 23.0 3.200000000000001e-07
0 2 6 026 22.0 4.480000000000002e-06
0 3 5 035 21.0 3.5840000000000016e-05
0 4 4 044 20.0 0.00017920000000000007
0 5 3 053 19.0 0.0005734400000000003
0 6 2 062 18.0 0.0011468800000000005
0 7 1 071 17.0 0.0013107200000000005
1 0 7 107 22.5 4.0000000000000014e-07
1 1 6 116 21.5 1.1200000000000005e-05
1 2 5 125 20.5 0.00013440000000000007
1 3 4 134 19.5 0.0008960000000000004
1 4 3 143 18.5 0.0035840000000000017
1 5 2 152 17.5 0.008601600000000004
1 6 1 161 16.5 0.011468800000000005
1 7 0 170 15.5 0.006553600000000002
2 0 6 206 21.0 7.0000000000000024e-06
2 1 5 215 20.0 0.00016800000000000007
2 2 4 224 19.0 0.0016800000000000007
2 3 3 233 18.0 0.008960000000000003
2 4 2 242 17.0 0.02688000000000001
2 5 1 251 16.0 0.04300800000000002
2 6 0 260 15.0 0.02867200000000001
3 0 5 305 19.5 7.000000000000002e-05
3 1 4 314 18.5 0.0014000000000000004
3 2 3 323 17.5 0.011200000000000005
3 3 2 332 16.5 0.04480000000000002
3 4 1 341 15.5 0.08960000000000003
3 5 0 350 14.5 0.07168000000000002
4 0 4 404 18.0 0.00043750000000000006
4 1 3 413 17.0 0.007000000000000002
4 2 2 422 16.0 0.042000000000000016
4 3 1 431 15.0 0.11200000000000003
4 4 0 440 14.0 0.11200000000000002
5 0 3 503 16.5 0.0017500000000000005
5 1 2 512 15.5 0.021000000000000005
5 2 1 521 14.5 0.08400000000000002
5 3 0 530 13.5 0.11200000000000003
6 0 2 602 15.0 0.004375
6 1 1 611 14.0 0.035
6 2 0 620 13.0 0.07
7 0 1 701 13.5 0.00625
7 1 0 710 12.5 0.025
probabilities should sum to 1.0
0.9954383900000003
5.210000000000003e-06
|
Posted by Larry
on 2024-12-08 09:49:51 |