Created
November 5, 2019 17:52
-
-
Save willzeng/4fee8a2f52e7db3429a77305d048b5cb 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
| rand_bitstrings = random_bitstrings(n_qubits, 10_000) | |
| yspace = xspace*(dim**2)*np.exp(-dim*xspace) | |
| # plot both empirical and theoretical calculations | |
| plt.figure(figsize=(9, 6)) | |
| plt.hist(rand_bitstrings, bins=50, density=True, label='Empirical') | |
| plt.plot(xspace, yspace, label='Theoretical') | |
| # plot the uniform distribution for reference | |
| plt.axvline(x=1/dim, linestyle='dotted', color='r', label='Uniform Distribution') | |
| plt.xlabel("Probability p") | |
| plt.ylabel("Probability that the random bistring occurs with probability p") | |
| plt.legend(loc='best') | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment