Skip to content

Instantly share code, notes, and snippets.

@nathanshammah
Created January 13, 2020 09:27
Show Gist options
  • Save nathanshammah/bb00b2adceb5098745a25454315db02a to your computer and use it in GitHub Desktop.
Save nathanshammah/bb00b2adceb5098745a25454315db02a to your computer and use it in GitHub Desktop.
from qutip import *
import matplotlib.pyplot as plt
import numpy as np
N = 20
rho_coherent = coherent_dm(N, np.sqrt(2))
rho_thermal = thermal_dm(N, 2)
rho_fock = fock_dm(N, 2)
fig, axes = plt.subplots(1, 3, figsize=(12,3))
plot_fock_distribution(rho_coherent, fig=fig, ax=axes[0], title="Coherent state");
plot_fock_distribution(rho_thermal, fig=fig, ax=axes[1], title="Thermal state");
plot_fock_distribution(rho_fock, fig=fig, ax=axes[2], title="Fock state");
plt.axvline(x=2,linestyle="dashed")
fig.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment