Using the Shooting Method to Solve the Time-Independent Schrödinger Equation for a 1D Quantum Well¶
Authors: Dou Du, Taylor James Baird and Giovanni Pizzi
Source code: https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/quantum-mechancis/shooting_method.ipynb
This notebook demonstrates the use of the shooting method to search for the eigenfunctions (wavefunctions) and eigenvalues of the time-independent Schrödinger equation in the case of a one-dimensional quantum well potential.
Goals¶
- Understand the mathematical formalism underlying the numerical approach to solving the Schrödinger equation with boundary conditions in the case of a 1D quantum well.
- Learn how to use the shooting method with a numerical integrator to obtain eigenvalues and eigenfunctions of the Schrödinger equation.
- Appreciate how the accuracy of the solutions can be improved by including higher-order corrections in the numerical integration scheme.
Background theory¶
Tasks and exercises¶
Move the sliders which control the width and depth of the quantum well. Do you understand the concept of quantum confinement? Can you think of any numerical method that can be used to solve the Schrödinger equation for a 1D quantum well?
Solution
Please check the previous notebook which looks at solving the time-independent Shrödinger equation for the 1D quantum well. In that notebook, the phenomenon of quantum confinement was investigated for the 1D quantum well and the Shrödinger equation was solved by numerical matrix diagonalization.The goal of this task is to obtain the value of the lowest energy eigenvalue. With the default width (1.20) and depth (0.20), move the sliders (on the left side) to target the energy of the lowest state. There are multiple sliders to allow specification of very high precision for the trial eigenvalue. You can also use the "auto search" button to get the eigenvalues, which searches for the next solution in order of increasing energy. Report the value of the energy when the tail of the wavefunction on the right converges to zero. Comparing visually, is the energy the same as the eigenvalue shown in the plot on the right?
Solution
The 1st eigenvalue is about 0.00919429. Check the exact eigenvalue by clicking on the eigenfunction in the plot.Follow the same steps to get the 2nd, 3rd and 4th eigenvalues (you may have to use the "flip eigenfunction" button to match up the trial and target wavefunctions). Report the resulting values of the energy eigenvalues in a table with the full precision outputted in the "Current value" field after convergence. Compare the results with the target eigenvalues from the figure. Repeat the the procedure now without using the 4th order correction (uncheck the "incl. 4th derivative" checkbox). Which of the eigenvalues is most affected by removal of the 4th order correction? Why do you think this is?
Solution
When higher-order terms are included in the construction of the numerical integration scheme, the error in our approximation of the derivatives in the Shrödinger equation decreases accordingly. In the present case, the improvement in accuracy is small but still numerically measurable. In other systems, the need for higher-order integrators is necessary to avoid pathological behaviour and even obtain reasonable results (the quantum harmonic oscillator is one such example). A typical higher-order integration scheme that is used to solve the Shrödinger equation is the Numerov method. You can have a read of the background theory notebook for additional information and references. You should find that the highest energy eigenvalue is that which is most affected by the accuracy of the numerical integration scheme (what order of approximation to the derivative we are using). Intuitively this makes sense as the wavefunctions corresponding to higher energy eigenvalues possess more nodes and therefore have a more oscillatory nature than lower energy wavefunctions. Consequently, the curvature of these wavefunctions is greater and our ability to correctly capture this is reliant on the accuracy of our approximation to the second derivative.As you will have seen in the previous task, we sometimes have to flip our trial wavefunction in order to get it to match up with the target eigenfunction. Firstly, what part of the algorithm causes the need for this flipping to obtain the target wavefunction? Secondly, why is is acceptable for us to do this flipping?
Solution
As is mentioned in the background theory notebook, the initial two values of the trial wavefunction used in our iterative ODE solver at the left-hand-side boundary are chosen to be zero and a small number (in our implementation this small number is chosen to be positive). The exact value of $\epsilon$ is irrelevant as it just leads to a different normalization factor for the wavefunction. In other words, we have $\psi(x_0)=0$ and $\psi(x_1)=\epsilon > 0$. This forces the derivative at $x_0$, $\psi'(x_0)$, to be positive. The reason why it is alright for us to flip $\psi\to - \psi$ is due to the fact the time-independent Shrödinger equation equation is symmetric under a sign-flip of the solution wavefunction. Consequently, the negative of a solution is also a solution.In comparison with the previous method of solving the time-independent Schrodinger equation we have seen (matrix diagonalization), how does this approach fare in terms of computational expense?
Solution
Solving for the eigenvalues and eigenfunctions of the time-independent Shrödinger equation equation via matrix diagonalization requires diagonalization of a full matrix on a grid representing our system. This incurs a large cost with regard to required to the memory required. Note also that if we wish to use higher order approximations to the derivative in the matrix diagonalization method, this memory requirement is further increased as bands of nonzero elements in the Hamiltonian matrix shall be wider for these methods (more points are used to approximate the derivatives). On the other hand, the approach discussed in this notebook (shooting method + numerical integration scheme) ultimately let's us solve the time-independent Shrödinger equation by keeping only the values of the trial wavefunction at two previous points plus the current point.Set the width and depth of the quantum well:
Legend¶
(How to use the interactive visualization)
Interactive figures¶
In the interactive figure, the solid lines show the wavefunctions and their corresponding eigenvalues, which are obtained via matrix diagonalization. There is a red dash line at the bottom of the figure, which shows the eigenfunction obtained via use of the shooting method.
Controls¶
There are four vertical sliders to control the trial eigenvalue, E, used in the shooting method. Multiple slides are necessary in order to affect precise control over the value of the trial eigenvalue. The first slider controls the precision for tenths ($10^{-1}$) and hundredths ($10^{-2}$). The second slider controls thousandths ($10^{-3}$) and ten thousandths decimal ($10^{-4}$). The third slider controls hundred thousandths ($10^{-5}$) and millionths ($10^{-6}$). The last slider controls ten millionths ($10^{-7}$) and hundred millionths ($10^{-8}$). The current value is also displayed under the sliders.
You need to slowly move the 1st slider and observe the tail of the dashed line on the right edge. Once you see the tail change directions (up or down), the true value of the eigenvalue should be between these two values. You need to go back to a smaller value and start to tune the 2nd slider. Then the same procedure is used for the 3rd and 4th sliders. When the absolute value at the right edge is smaller than 0.001, the dashed red line will turn green. At this point it has reached the desired accuracy for the wavefunction. You can then read out the current targeted value, which is the corresponding eigenvalue.
You can also use the
Auto search
button, which finds the closest eigenvalue and eigenfunction to that currently targeted by the sliders (the search is performed in the upward direction). In order to make a comparison between the true eigenfunction and that obtained via solution of the Shrödinger equation with the guess eigenvalue, you may also need to click theFlip eigenfunctions
button (see task 4).