01 Intro to theoretical probability#

%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/uzkc-qNVoOk/" frameborder="0" allowfullscreen></iframe>
import sympy as sp
from sympy.stats import Coin, Die
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns

khanacademy

Intro to theoretical probability fig 1Intro to theoretical probability fig 2

C = Coin('C')
sp.stats.density(C).dict
{H: 1/2, T: 1/2}
D = sp.stats.Die('D', 6)
sp.stats.density(D).dict
{1: 1/6, 2: 1/6, 3: 1/6, 4: 1/6, 5: 1/6, 6: 1/6}
sp.stats.P(sp.Eq(D, 1))
\[\displaystyle \frac{1}{6}\]
sp.stats.P(sp.Eq(D, 1)) + sp.stats.P(sp.Eq(D, 3))
\[\displaystyle \frac{1}{3}\]
sp.stats.P(sp.Eq(D, 1), sp.Eq(D, 3)) # rewrite: and instead of given
\[\displaystyle 0\]