Last active
October 16, 2022 00:45
-
-
Save galenseilis/86310855b530d0deb5440798d4863724 to your computer and use it in GitHub Desktop.
This file contains 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
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.stats import binom | |
n, p = 100, 0.5 | |
x = np.arange(n) | |
fig, ax = plt.subplots(1, 1) | |
ax.plot(x, binom.pmf(x, n, p), 'bo', ms=1, label='binom pmf') | |
ax.vlines(x, 0, binom.pmf(x, n, p), colors='b', lw=1, alpha=0.5) | |
plt.title(f'binomial(52 | {n}, {p}) = {binom.pmf(52, n, p)}') | |
plt.xlabel('n') | |
plt.ylabel('$\\operatorname{binomial}\\left(n|100,\\frac{1}{2}\\right)$') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment