1、泊松分布
独立随机事件X,在某段时间内发生次数的期望lambda已知,求发生次数为k的概率
例如:某医院平均每天出生10个婴儿,我们现在想知道明天出生多少婴儿(明天出生k个婴儿的概率)
2、指数分布
独立随机事件X,在某段时间内发生次数的期望lambda已知,事件下一次发生的时间间隔为x的概率
例如:某医院平均每天出生10个婴儿,我们现在想知道下一个婴儿什么时候出生(x小时后有婴儿出生的概率)
3、泊松分布与指数分布的关系
泊松分布:在某段时间内事件发生的概率
指数分布:事件发生时间间隔为t的概率
事件发生的时间间隔大于t,就相当于从现在开始t小时内,该事件不会发生
4、exp(x)的Taylor展开
5、泊松分布中,P随k、lambda变化的关系
import math
import numpy as np
import matplotlib.pyplot as plt
def fac(x):
if x == 0:
return 1
if x == 1:
return 1
return x*fac(x-1)
#固定k,变化lambda
plt.figure()
x = np.arange(0,10,0.05)
for i in range(5):
y = [math.exp(-a)*a**i/fac(i) for a in x]
plt.plot(x,y,linewidth=2,label='k='+ str(i))
plt.grid(True)
plt.legend(loc='upper right')
plt.xlabel('lambda')
plt.ylabel('P')
#固定lambda,变化k
plt.figure()
x = np.arange(0,10,1)
for i in range(1,6):
y = [i**a/fac(a)*math.exp(-i) for a in x]
plt.plot(x,y,linewidth=2,label='lambda='+ str(i))
plt.grid(True)
plt.legend(loc='upper right')
plt.xlabel('k')
plt.ylabel('P')