# Q 2B
import numpy as np
from math import factorial
from scipy.special import hermite as H
from scipy.integrate import quad
import matplotlib.pyplot as plt
x =np.linspace(-5,5, 1001)
def psi(n):
return 1/np.sqrt(2**n * factorial(n)) * (1/np.pi)**(1/4) * np.exp(-x**2/2) * H(n)(x)
fig, ax = plt.subplots(1,3, sharex=True)
ax[0].plot(x, psi(2),'r')
ax[0].set_title("$\psi_2$")
ax[0].axhline()
ax[1].plot(x, psi(1),'b')
ax[1].set_title("$\psi_1$")
ax[1].axhline()
ax[2].plot(x, psi(0),'orange')
ax[2].set_title("$\psi_0$")
ax[2].axhline()
plt.show()
Comments
Post a Comment