I'm trying to figure out how to plot a displaced harmonic oscillator in position space. The solution of the wavefunction in coordinate basis is $$\psi_n(x) = \frac{1}{\sqrt{2^n n!}} e^{-x^2} H_n(x), n=0, 1, 2, .. $$ And what I'm trying to do is calculate the coefficient in front of the Hermite function, which should be dependant on $x$. What I've been trying to do is: Put the Hamiltonian in the position basis (I'm not sure if I'm doing this correctly?) Get the eigenstates of $\ket{\psi_n}$ evaluate $\braket{x}{\psi_n}$ for each position, which should give the coefficients Multiply $\braket{x}{\psi_n}$ by $H_n(x)$ function at the corresponding $x$ value I should also be able to sum all the $\psi_n(x)$ values to get a displaced Gaussian. Code below: disp = qt.displace(N, alpha) x_op = (a_dag + a) x_val, x_st = x_op.eigenstates() h = (a1_dag * a1 + 1/2) h_val, h_st = h.eigenstates() h_st = [disp * i for i in h_st] hx = (h_st[n].transform(x_st)) wv_coeff = [i.dag() * hx for i in x_st] wf_coeff should be the coefficients for $\psi_n$, which can then be multiplied by the hermite polynomial $H_n(x)$, with $x$ coming from x_val. Continue reading...