PGA Charles Schwab Challenge - 2nd Rd: How many BIRDIES will Harold Varner III record on Holes 3-9?
Inputs to Solve
##### User Estimates #####
p_bird = [32/378, 40/378, 34/378, 70/378, 72/378, 39/378, 37/378]
count = 3
for p in p_bird:
print("The probability that a golfer BIRDIES hole " + str(count) + " is %s" % round(p,3))
count +=1
The probability that a golfer BIRDIES hole 3 is 0.085
The probability that a golfer BIRDIES hole 4 is 0.106
The probability that a golfer BIRDIES hole 5 is 0.09
The probability that a golfer BIRDIES hole 6 is 0.185
The probability that a golfer BIRDIES hole 7 is 0.19
The probability that a golfer BIRDIES hole 8 is 0.103
The probability that a golfer BIRDIES hole 9 is 0.098
## Inputs Defined in the Problem
total_birdies = 1
Method to Solve
- [1] Enumerate all the possible combinations BIRDIES and NON-BIRDIES being scored on holes 3-9 (2^7 combinations).
- [2] The probability that 0 or 1 BIRDIES are scored by Varner III on holes 3-9 is the sum of the probabilities for all the outcomes where the total number of BIRDIES is less than or equal to 1 (p_0or1).
## [1]
import numpy as np
import pandas as pd
holes = ['3','4','5','6','7','8','9']
outcomes = (1,0)
y = np.array([(a,b,c,d,e,f,g) for a in outcomes for b in outcomes for c in outcomes
for d in outcomes for e in outcomes for f in outcomes for g in outcomes])
birdies = pd.DataFrame(y)
birdies.columns = holes
birdies['total_birdies'] = birdies.sum(axis=1)
x = np.array([(a,b,c,d,e,f,g) for a in (p_bird[0],1-p_bird[0]) for b in (p_bird[1],1-p_bird[1])
for c in (p_bird[2],1-p_bird[2]) for d in (p_bird[3],1-p_bird[3])
for e in (p_bird[4],1-p_bird[4]) for f in (p_bird[5],1-p_bird[5])
for g in (p_bird[6],1-p_bird[6])])
probability = pd.DataFrame(x)
probability.columns = holes
probability['p'] = probability.product(axis=1)
birdies
3 | 4 | 5 | 6 | 7 | 8 | 9 | total_birdies | |
---|---|---|---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 7 |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 6 |
2 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 6 |
3 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 5 |
4 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 6 |
… | … | … | … | … | … | … | … | … |
123 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
124 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 2 |
125 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
126 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
127 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
128 rows × 8 columns
probability
3 | 4 | 5 | 6 | 7 | 8 | 9 | p | |
---|---|---|---|---|---|---|---|---|
0 | 0.084656 | 0.10582 | 0.089947 | 0.185185 | 0.190476 | 0.103175 | 0.097884 | 2.870405e-07 |
1 | 0.084656 | 0.10582 | 0.089947 | 0.185185 | 0.190476 | 0.103175 | 0.902116 | 2.645427e-06 |
2 | 0.084656 | 0.10582 | 0.089947 | 0.185185 | 0.190476 | 0.896825 | 0.097884 | 2.495044e-06 |
3 | 0.084656 | 0.10582 | 0.089947 | 0.185185 | 0.190476 | 0.896825 | 0.902116 | 2.299487e-05 |
4 | 0.084656 | 0.10582 | 0.089947 | 0.185185 | 0.809524 | 0.103175 | 0.097884 | 1.219922e-06 |
… | … | … | … | … | … | … | … | … |
123 | 0.915344 | 0.89418 | 0.910053 | 0.814815 | 0.190476 | 0.896825 | 0.902116 | 9.352892e-02 |
124 | 0.915344 | 0.89418 | 0.910053 | 0.814815 | 0.809524 | 0.103175 | 0.097884 | 4.961890e-03 |
125 | 0.915344 | 0.89418 | 0.910053 | 0.814815 | 0.809524 | 0.103175 | 0.902116 | 4.572985e-02 |
126 | 0.915344 | 0.89418 | 0.910053 | 0.814815 | 0.809524 | 0.896825 | 0.097884 | 4.313027e-02 |
127 | 0.915344 | 0.89418 | 0.910053 | 0.814815 | 0.809524 | 0.896825 | 0.902116 | 3.974979e-01 |
128 rows × 8 columns
## [2]
p_0or1 = probability['p'][birdies['total_birdies']<=total_birdies].sum()
Solution
print("The probability that Harold Varner III records 0 or 1 BIRDIES on holes 3-9 is ~ %s" % round(p_0or1,3))
The probability that Harold Varner III records 0 or 1 BIRDIES on holes 3-9 is ~ 0.793
Info
download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs
import sys
print(sys.version)
3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
Posted on 6/12/2020