Given a world that consist of bunch random events (2 coins for simplicity) we are interested in quantifying the probability of different combinations of the world state.
The combination of all possible outcomes is called the state space $\Omega$, in our example
| Coin 1 | Coin 2 |
|---|---|
| H | H |
| H | T |
| T | H |
| T | T |
An event is a subset of the state space, denoted as $A \subseteq \Omega$, the following are examples of events
The probability measure is a function $P: \mathbb{R}\rightarrow[0,1]$ that satisfies 3 axioms
if we have two events $A$ and $B$
In [2]:
#Your code here
In [47]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
radius = 1
N = 10000
X = np.random.uniform(low=-radius, high=radius, size=N) # Random numbers from -1 to 1
Y = np.random.uniform(low=-radius, high=radius, size=N)
is_point_inside = np.sqrt(X**2 + Y**2) < radius
plt.scatter(X,Y, c=is_point_inside, s=5.0, edgecolors='none', cmap=plt.cm.Accent)
plt.axis('equal')
Out[47]:
In [46]:
p_inside = np.sum(is_point_inside) / N
circle_area = box_area * p_inside
print ("Area of the circle = ", circle_area)
print ("pi = ", circle_area/radius**2)
In [1]:
#Your code here