Python 代码实现 二项分布
import numpy as np
import matplotlib.pyplot as plt
import math
from scipy import stats
n = 100
p = 0.05
k = np.arange(0,n)
binomial = stats.binom.pmf(k,n,p)
plt.plot(k,binomial,'o-')
plt.title('binomial:n=%i,p=%.2f'%(n,p),fontsize=15)
plt.xlabel('number of sucess',fontproperties='SimHei')
plt.ylabel('probalility of sucess',fontsize=15)
plt.grid(True)
plt.show()
转载于:https://www.cnblogs.com/vercont/p/10210232.html