Comparison between exact and numerical eigenfunctions

We now compare exact and numerically calculated eigenfunctions for a couple of low lying levels and consider the case where \( N_{\mathrm{grid}}= 128 \).

Ngrid = 128
xmin, xmax = -10, 10
x = np.linspace(xmin, xmax, Ngrid)
v = ho.getPotential(x)
es = Eigenstates1D(mass=1.0, grid=x, potential=v)
es.compute_hamiltonian()
energies, psi = es.get_eigenstates()
f, ax = ho.plot(np.linspace(-3.5, 3.5, 1000))
phase = [-1, 1, 1, 1, -1]
for s in range(5):
    ax.plot(x, energies[s] + phase[s] * psi.real[:,s] / np.sqrt(es.deltax),
            'o', color = "magenta")

plt.xlim(-3.5, 3.5)

Comparison of numerical and exact eigenfunctions