import numpy as np
import matplotlib.pyplot as plt
import scipy as spPoisson Distribution
Examples on webpage
# 1
X = sp.stats.poisson(3.5)# 1a
X.pmf(2)0.18495897346170082
# 1b
1 - np.sum(X.pmf(np.arange(3)))0.6791528011378659
np.sum(X.pmf(np.arange(3, 1000)))0.679152801137866
# made up question
# what's the probability of an even number of earthquakes
np.sum(X.pmf(np.arange(1000) * 2))0.5004559409827773
x = np.arange(1000)
ind = x % 2 == 0
np.sum(X.pmf(x[ind]))0.5004559409827773
# 1c
Y = sp.stats.poisson(3.5 * 7)
np.sum(Y.pmf(np.arange(6)))2.091682196839196e-06
3.5 * 724.5
# 2
X = sp.stats.poisson(5)# 2a
X.pmf(7)0.10444486295705395
# 2b
np.sum(X.pmf(np.arange(4)))0.26502591529736164
# 2c
Y = sp.stats.poisson(5 * 2)1 - np.sum(Y.pmf(np.arange(11)))0.4169602498070133