Spanish Primera Division (Atletico Madrid @ Barcelona): Will Lionel Messi SCORE in the 1st Half?
4:00 PM
Yes: Messi scores in 1st Half
No: Messi doesn’t score in 1st Half
Inputs to Solve
##### User Estimates #####
p_anytime_goal = 1/2.05
print("The probability of a Lionel Messi scoring a GOAL is ~%s" % round(p_anytime_goal,3))
The probability of a Lionel Messi scoring a GOAL is ~0.488
Method to Solve
[1] Assume the probability of Messi scoring a goal in the 1st Half is approximately the same as the probability of Messi scoring a goal in the 2nd Half (p).
[2] Break Messi scoring down into halves:
1st Half | 2nd Half |
---|---|
GOAL | GOAL |
NO GOAL | GOAL |
GOAL | NO GOAL |
1st Half | 2nd Half | odds |
---|---|---|
p | p | p^2 |
1-p | p | (1-p)*p |
p | 1-p | p*(1-p) |
The sum of the odds of the above must equal p_anytime_goal
[3] Solve the quadratic equation p^2 - 2p + p_anytime_goal = 0 to estimate the probability Messi scores in the 1st Half
## [3]
import math
a = 1
b = -2
c = p_anytime_goal
d = b**2-4*a*c # discriminant
if d < 0:
print ("This equation has no real solution")
elif d == 0:
x = (-b+math.sqrt(b**2-4*a*c))/2*a
print ("This equation has one solutions: "), x
else:
x1 = (-b+math.sqrt((b**2)-(4*(a*c))))/(2*a)
x2 = (-b-math.sqrt((b**2)-(4*(a*c))))/(2*a)
print ("This equation has two solutions: ", round(x1,3), " or", round(x2,3))
This equation has two solutions: 1.716 or 0.284
Solution
print("The probability that Lionel Messi scores a GOAL in the 1st HALF is ~%s" % round(x2,3))
The probability that Lionel Messi scores a GOAL in the 1st HALF is ~0.284
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/30/2020