The SchrΓΆdinger operator only ever touches neighbouring points. That locality is why its matrix has three diagonals, why the energies come out real, and why the whole thing runs in a browser.
Here is the single most valuable thing on this site.
Chapters 3 through 6 of Phillips work out the energy levels of a particle in a box, then a finite well, then a barrier, then a harmonic oscillator β each with its own boundary conditions, its own transcendental equation, its own special functions. It is worth following that algebra, and the site will follow it.
But all four are the same computation, and it is four lines long:
Put on a grid. Build as a matrix β a finite-difference second derivative plus down the diagonal. Diagonalize it. The eigenvalues are the energy levels and the eigenvectors are the stationary states.
Learn it once here and every later chapter becomes a check on something you can already compute. Every interactive plot on this site is produced by this recipe, running live in your browser.
Where the matrix comes from
A state of definite energy β a stationary state stationary state Ξ¨ = Ο(r)e^(βiEt/Δ§): definite energy, ΞE = 0, and no observable property changes with time β ever. The wave function keeps rotating in the complex plane while nothing measurable moves. defined in ch. 4 β open in glossary β satisfies the time-independent SchrΓΆdinger equation, in which the Hamiltonian hamiltonian The total-energy operator Δ€ = β(Δ§Β²/2m)dΒ²/dxΒ² + V(x). Discretized on a grid it is a real symmetric tridiagonal matrix, and its eigenvalues are the allowed energies. defined in the toolkit β open in glossary is the total-energy operator operator A rule that takes a function and returns a function β d/dx, or "multiply by x". Written with a hat, Γ. Discretize space and it becomes literally a matrix, so every question about an operator is a linear-algebra question. defined in the toolkit β open in glossary :
That is already an eigenvalue eigenvalue A value an observable can actually be measured to have β a solution Ξ» of ΓΟ = Ξ»Ο. Hermitian operators have real eigenvalues, which is exactly what lets them stand for measurement outcomes.
defined in the toolkit β open in glossary
equation β it says
βapplying to
gives back , scaledβ. The only obstacle is that contains a
derivative, and you cannot hand a derivative to numpy.linalg.eigh. So we
replace it with something we can.
Substitute the stencil and the operator becomes a matrix. Writing , the row for grid point reads
which is one row of with
Almost every entry is zero. Only three diagonals survive, and that is the whole shape of the problem:
The discretized Hamiltonian. Three diagonals carry everything: the potential sits on the main one, the kinetic coupling on its two neighbours.
The four lines
To solve a different problem, change one line. Replace V = np.zeros(N)
with V = np.where(abs(x) < w/2, -V0, 0) and you have the finite well of
chapter 5. Replace it with V = 0.5*m*omega**2*x**2 and you have the harmonic
oscillator of chapter 6. Nothing else moves.
Try it
Every curve below is computed by exactly the recipe above, live, as you drag.
Things worth doing before you move on:
- Shrink the finite wellβs depth. Watch the top level climb towards zero and then vanish. The counter tells you how many bound states are left. Chapter 5 derives the condition for this; you can find it here by dragging.
- Switch to the infinite well. Levels go as β the gaps get wider.
- Switch to the harmonic oscillator. Levels are evenly spaced, and the lowest one is not at the bottom of the well. That leftover is the zero-point energy, and chapter 6 shows it is forced by the uncertainty principle.
- Switch to the barrier and raise it. The levels pair up into doublets. The splitting inside each pair is a direct measure of the tunnelling rate through the wall.
- Count the nodes of any selected state. State crosses zero exactly times, in every potential. That is a theorem, not a coincidence.
Natural units, and how to get back
You will have noticed every number above is of order 1, with no in sight. That is deliberate: we set and measure lengths in a unit we choose. Doing arithmetic with and in floating point is a good way to lose precision for nothing.
The conversion back is one line. With and lengths in units of , one unit of energy is
Two things you get for free
The widget above reports βbound states: 3β the instant you move a slider, and it does so without computing a single eigenvalue. Both of the tricks behind that are worth knowing.
Counting without solving. For a symmetric tridiagonal matrix, one sweep β a Sturm sequence β counts how many eigenvalues lie below any energy you name. Since a bound state is precisely an eigenvalue below the potential at infinity, βhow many bound states does this well have?β is one cheap pass, no eigensolver required. It is also what makes the sliders feel instant: the siteβs solver finds each level by bisecting on that count, which is per level instead of for the whole matrix.
The node theorem. The -th eigenfunction eigenfunction A function an operator returns unchanged apart from a multiplying constant: Δ€Ο = EΟ. The continuous analogue of an eigenvector, and the constant E is the eigenvalue. defined in ch. 4 β open in glossary of a one-dimensional problem crosses zero exactly times, always, in any potential. Count the wiggles and you know which level you are looking at. It is also a debugging tool: if your βground stateβ has a node in it, your solver has converged to the wrong thing.
Check yourself
0 / 7 answered
1.In the discretized Hamiltonian, where does the potential energy end up?
2.Why does leaving the two endpoints out of the grid impose at the walls?
The stencil is accurate to .
3.You compute with and get 4.9347; with you get 4.9348. What should you conclude?
4.A finite well has a bound state at in natural units. You solve it in a box running from to . What is the risk?
5.Why are the eigenvalues of this matrix guaranteed to be real?
Try it above.
6.In the explorer, switching from the infinite well to the harmonic oscillator changes the level spacing. How?
7.What does the Sturm-sequence count give you that an eigensolve does not?