PGA Rocket Mortgage Classic (Detroit, MI): How many BIRDIES will C. Reavie, D. Johnson and P. Reed record on Holes 1-4?
1:05 PM
2 or Fewer
3 or More
Inputs To Solve
Detroit Golf Club Course Stats
##### User Estimates #####
p_bird_1 = 18/(18+33+3)
p_bird_2 = 7/(7+32+9)
p_bird_3 = 10/(10+30+4)
p_bird_4 = 14/(14+24+2)
print("The probability of a PLAYER scoring BIRDE on hole 1 is ~%s" % round(p_bird_1,3))
print("The probability of a PLAYER scoring BIRDE on hole 2 is ~%s" % round(p_bird_2,3))
print("The probability of a PLAYER scoring BIRDE on hole 3 is ~%s" % round(p_bird_3,3))
print("The probability of a PLAYER scoring BIRDE on hole 4 is ~%s" % round(p_bird_4,3))
The probability of a PLAYER scoring BIRDE on hole 1 is ~0.333
The probability of a PLAYER scoring BIRDE on hole 2 is ~0.146
The probability of a PLAYER scoring BIRDE on hole 3 is ~0.227
The probability of a PLAYER scoring BIRDE on hole 4 is ~0.35
## Inputs Defined in the Problem
num_birdies = 2
Method to Solve
- Compute the probability of 0, 1 or 2 Birdies being scored on each hole (1-4) by the 3 golfers
- Enumerate all the possible combinations of 0, 1 or 2 BIRDIES being scored on holes 1-4.
- The probability that 0, 1 or 2 BIRDIES are scored by both golfers on holes 1-4 is the sum of the probabilities for all the outcomes where the total number of BIRDIES is less than or equal to 2.
import numpy as np
import pandas as pd
golfers = ['1','2','3']
# Hole 1
p_other = 1 - p_bird_1
prob = (p_bird_1,p_other)
bird = (1,0)
a = {}
y = np.array([(x,y,z) for x in bird for y in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,y,z) for x in prob for y in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
a[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
# Hole 2
p_other = 1 - p_bird_2
prob = (p_bird_2,p_other)
bird = (1,0)
b = {}
y = np.array([(x,y,z) for x in bird for y in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,y,z) for x in prob for y in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
b[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
# Hole 3
p_other = 1 - p_bird_3
prob = (p_bird_3,p_other)
bird = (1,0)
c = {}
y = np.array([(x,y,z) for x in bird for y in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,y,z) for x in prob for y in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
c[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
# Hole 4
p_other = 1 - p_bird_4
prob = (p_bird_4,p_other)
bird = (1,0)
d = {}
y = np.array([(x,y,z) for x in bird for y in bird for z in bird])
birdies = pd.DataFrame(y)
birdies.columns = golfers
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(x,y,z) for x in prob for y in prob for z in prob])
probability = pd.DataFrame(x)
probability.columns = golfers
probability['p'] = probability.product(axis=1)
for i in set(birdies.total_birdies):
d[i] = round(probability['p'][birdies['total_birdies']==i].sum(),2)
print("The number of possible birdies on hole 1 for 3 golfers and their respective probabilities are: %s" % a)
print("The number of possible birdies on hole 2 for 3 golfers and their respective probabilities are: %s" % b)
print("The number of possible birdies on hole 3 for 3 golfers and their respective probabilities are: %s" % c)
print("The number of possible birdies on hole 4 for 3 golfers and their respective probabilities are: %s" % d)
The number of possible birdies on hole 1 for 3 golfers and their respective probabilities are: {0: 0.3, 1: 0.44, 2: 0.22, 3: 0.04}
The number of possible birdies on hole 2 for 3 golfers and their respective probabilities are: {0: 0.62, 1: 0.32, 2: 0.05, 3: 0.0}
The number of possible birdies on hole 3 for 3 golfers and their respective probabilities are: {0: 0.46, 1: 0.41, 2: 0.12, 3: 0.01}
The number of possible birdies on hole 4 for 3 golfers and their respective probabilities are: {0: 0.27, 1: 0.44, 2: 0.24, 3: 0.04}
holes = ['1','2','3','4']
outcomes = (0,1,2,3)
y = np.array([(w,x,y,z) for w in outcomes for x in outcomes for y in outcomes for z in outcomes])
birdies = pd.DataFrame(y)
birdies.columns = holes
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(w,x,y,z) for w in a.values() for x in b.values() for y in c.values() for z in d.values()])
probability = pd.DataFrame(x)
probability.columns = holes
probability['p'] = probability.product(axis=1)
birdies.head()
1 | 2 | 3 | 4 | total_birdies | |
---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 1 | 1 |
2 | 0 | 0 | 0 | 2 | 2 |
3 | 0 | 0 | 0 | 3 | 3 |
4 | 0 | 0 | 1 | 0 | 1 |
probability.head()
1 | 2 | 3 | 4 | p | |
---|---|---|---|---|---|
0 | 0.3 | 0.62 | 0.46 | 0.27 | 0.023101 |
1 | 0.3 | 0.62 | 0.46 | 0.44 | 0.037646 |
2 | 0.3 | 0.62 | 0.46 | 0.24 | 0.020534 |
3 | 0.3 | 0.62 | 0.46 | 0.04 | 0.003422 |
4 | 0.3 | 0.62 | 0.41 | 0.27 | 0.020590 |
Solution
p = round(probability['p'][birdies['total_birdies']<=num_birdies].sum(),3)
print("The probability that C. Reavie, D. Johnson and P. Reed record 2 or less BIRDIES on holes 1-4 is ~%s" % p)
The probability that C. Reavie, D. Johnson and P. Reed record 2 or less BIRDIES on holes 1-4 is ~0.339
Posted on 6/27/2019