pyplotを試してみる
pyplotを試してみる
確率分布等、見た方がわかると思いpyplotを試してみました。
とりあえず、二項分布で実験です。
import math
import matplotlib.pyplot as plt
def comb(n, x):
return math.factorial(n) / (math.factorial(n - x) * math.factorial(x))
n = 10
p = 0.2
xlist = range(0, 10)
ylist = []
for x in xlist:
y = comb(n, x) * p ** x * (1 - p) ** (n - x)
ylist.append(y)
plt.bar(xlist, ylist)
plt.show()
やはり、慣れた言語が扱いやすいですね。