Solution of the Schrödinger equation using Ritz method
In this post, we describe the solution of the Schrödinger equation using the Ritz method and Hermite functions basis. This basis seems to be a good choice for the 1D Schrödinger equation since its an orthogonal basis over \((-\infty, \infty)\).
Transforming the equation to an algebraic one
We want so solve the time-independent Schrödinger equation
where we are using natural units since they are a good choice for numeric calculations.
Solving this equation is equivalent to solve the following variational equation
with
being \(\psi\) the wave function, \(V(x)\) the potential and \(E\) the energy. This variational formulation is equivalent to the time-independent Schrödinger equation, and \(E\) works as a Lagrange multiplier to enforce that the probability over the whole domain is 1.
We can expand the wave function in an orthonormal basis, namely
where \(u_n(x) \equiv \mu_n H_n(x) e^{-x^2/2}\) is a normalized Hermite function, \(\mu_n\) is the inverse of magnitude of the \(n\)-th Hermite polynomial
and \(c_n\) are the coefficients of the expansion. This representation is exact in the limit \(N \rightarrow \infty\).
If we replace the expansion in the functional, we obtain
The integrand of the integral involving the two derivatives reads
Thus, the kinetic energy term reads
with
and
The functional is rewritten as
Taking the variation
that in this case is equivalent to
yields to
where the components of the matrix \([H]\) are given by
The last integral can be computed using Gauss-Hermite quadrature. And we will need more Gauss points if we want to integrate higher-order polynomials. This method would work fine for functions that can be approximated by polynomials.
Examples
A Python implementation of this method is presented in this repo.
For all the examples we use the following imports
Quantum harmonic oscilator
In this case the (normalized) potential is given by
and the exact normalized eigenvalues are given by
The following snippet computes the first 10 eigenvalues and plot the corresponding eigenstates
potential = lambda x: 0.5*x**2 vals, vecs = eigenstates(potential, nterms=11, ngpts=12) print(np.round(vals[:10], 6)) fig, ax = plt.subplots(1, 1) plot_eigenstates(vals, vecs, potential);
with results
Absolute value potential
potential = lambda x: np.abs(x) vals, vecs = eigenstates(potential) print(np.round(vals[:10], 6)) fig, ax = plt.subplots(1, 1) plot_eigenstates(vals, vecs, potential, lims=(-8, 8));
with results
Cubic potential
potential = lambda x: np.abs(x/3)**3 vals, vecs = eigenstates(potential) print(np.round(vals[:10], 6)) fig, ax = plt.subplots(1, 1) plot_eigenstates(vals, vecs, potential, lims=(-6, 6));
with results
Harmonic with quartic perturbation
potential = lambda x: 0.5*x**2 + 0.1*x**4 vals, vecs = eigenstates(potential, nterms=20, ngpts=22) print(np.round(vals[:10], 6)) fig, ax = plt.subplots(1, 1) plot_eigenstates(vals, vecs, potential, lims=(-5, 5))
with results
A Jupyter Notebook with the examples can be found here.
Comments
Comments powered by Disqus