Last active
November 23, 2020 18:53
-
-
Save niklasbuschmann/44467229e6feddc37c90aa9876a106e5 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
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.special import binom | |
from scipy.stats import norm | |
q = 100 | |
NA = 100 | |
NB = 60 | |
qA = np.arange(0, q + 1, 1) | |
qB = np.arange(q, -1, -1) | |
OA = binom(3 * NA - 1 + qA, qA) | |
OB = binom(3 * NB - 1 + qB, qB) | |
sm = np.sum(OA * OB) | |
plt.bar(qA, OA * OB) | |
mean = np.sum(qA * OA * OB / sm) | |
variance = np.sum((qA - mean)**2 * OA * OB / sm) | |
plt.plot(sm * norm.pdf(qA, mean, np.sqrt(variance)), color = 'r') | |
plt.xlabel("qA") | |
plt.ylabel("Ω tot") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment