Skip to content

Instantly share code, notes, and snippets.

@aplund
Last active September 11, 2017 01:53
Show Gist options
  • Save aplund/25f0a73923601a256a1359b33153c830 to your computer and use it in GitHub Desktop.
Save aplund/25f0a73923601a256a1359b33153c830 to your computer and use it in GitHub Desktop.
from numpy import arange, exp, sqrt
from scipy.special import hermite as H
from scipy.misc import factorial
import matplotlib
font_size=8
matplotlib.rcParams['font.size'] = font_size
matplotlib.rcParams['axes.labelsize'] = font_size
matplotlib.rcParams['axes.linewidth'] = font_size / 12.
matplotlib.rcParams['lines.linewidth'] = font_size / 12.
matplotlib.rcParams['axes.titlesize'] = font_size
matplotlib.rcParams['legend.fontsize'] = font_size
matplotlib.rcParams['xtick.labelsize'] = font_size
matplotlib.rcParams['ytick.labelsize'] = font_size
import matplotlib.pyplot as plt
def p(n,a,mu):
nu = sqrt(mu**2-1)
beta = mu*a + nu*a
exppart = exp(-beta**2 + (nu/mu/2)*beta**2 + (nu/mu/2)*beta**2)
coeff = (1/factorial(n)/mu)*(nu/mu/2)**n
return coeff * (H(n)(beta/sqrt(2*mu*nu)))**2 * exppart
plt.figure(figsize=(3.333,2.5))
r = arange(0,3.0,0.01)
linestyles=['-','--','-.',':','steps']
for i in range(0,4):
plt.plot(r,p(i,r,2.0),linestyles[i])
plt.xlabel(r'$\alpha$')
plt.ylabel('Probability')
plt.legend(range(0,4))
plt.tight_layout()
plt.savefig('displacing-1mode.pdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment