Last active
August 29, 2015 14:26
-
-
Save matsuken92/904970b5daf9dc679ec3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as st | |
from matplotlib import animation as ani | |
plt.style.use('ggplot') | |
plt.rc('text', usetex=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = st.poisson.rvs(5, size=30) # 平均=5のポアソン分布に従う乱数を30個生成 | |
print x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lam = 3 # 平均値 | |
n = 10000 # 生成する乱数の数 | |
x = st.poisson.rvs(5, size=n) | |
plt.figure(figsize=(9,7)) | |
plt.title("Poisson distribution. $\lambda=5$, n={}".format(n)) | |
plt.hist(x, bins=np.max(x), color="lightblue") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment