Skip to content

Numerical notebooks should make the canonical systems reproducible. A notebook is not just a plot generator: it should state the analytic result being checked, the numerical method, the parameters, the validation tolerance, and the known limitations.

The source notebooks are in the repository directory notebooks/wave-mechanics-canonical-systems/; paths in the table are relative to that directory. Open a chosen .ipynb file in a notebook application with Python and NumPy 2.0 or newer available, then run its cells from the beginning. Plotting is optional: the comparison cells test numerical results directly. See Benchmark Problems to interpret convergence and finite-domain errors.

Notebook Path Model Method What to Compare
one-dimensional-bound-systems/infinite-square-well.ipynb Infinite Square Well finite-difference Hamiltonian diagonalization eigenvalues approach n2π2ℏ2/(2mL2)n^2\pi^2\hbar^2/(2mL^2) and eigenvectors are orthonormal
one-dimensional-bound-systems/finite-square-well-bound-states.ipynb Finite Square Well matrix diagonalization bound-state count changes with depth and edge leakage is negligible
free-motion/gaussian-wave-packet-spreading.ipynb Wave Packet Spreading spectral time evolution norm is conserved and width follows the analytic Gaussian result
scattering-tunneling/barrier-scattering-wave-packet.ipynb Wave Packets and Scattering, Rectangular Barrier Tunneling split-step time evolution transmission approaches the momentum-averaged stationary result under mesh, time-step, box, and observation-time checks; norm is checked separately
harmonic-oscillator/harmonic-oscillator-eigenstates.ipynb Quantum Harmonic Oscillator finite-difference diagonalization eigenvalues approach ℏω(n+1/2)\hbar\omega(n+1/2) and eigenfunctions show expected parity
two-level-systems/two-level-system-dynamics.ipynb Two-State Hamiltonians exact matrix evolution probability oscillations match the analytic two-state formula
hydrogenic/hydrogen-radial-wavefunctions.ipynb Hydrogen Atom analytic radial functions on quadrature grids radial functions normalize with r2drr^2dr measure and energies scale as −1/n2-1/n^2
three-dimensional/spherical-harmonics-gallery.ipynb Spherical Harmonics analytic angular functions on quadrature grids angular normalization and orthogonality are checked numerically
electromagnetic-fields/landau-levels.ipynb Landau Levels Landau-gauge oscillator discretization equally spaced levels and degeneracy scaling with flux are verified

The NumPy requirement comes from numpy.trapezoid, used in quadrature checks and available since NumPy 2.0. The oscillator and barrier notebooks include separate refinement studies; the shorter examples demonstrate their stated checks rather than a general convergence guarantee.

Analytic checks should be explicit. Examples:

For the infinite square well,

Enexact=n2π2ℏ22mL2.E_n^{\mathrm{exact}} =\frac{n^2\pi^2\hbar^2}{2mL^2}.

For a normalized one-dimensional wave packet on a grid,

∣1−∑j∣ψj∣2Δx∣<ϵnorm.\left\lvert 1-\sum_j \lvert\psi_j\rvert^2\Delta x \right\rvert \lt\epsilon_{\mathrm{norm}}.

For Landau-level degeneracy in area AA,

Nϕ=∣q∣BAh=A2πℓB2.N_\phi =\frac{\lvert q\rvert BA}{h} =\frac{A}{2\pi\ell_B^2}.

The notebook should state whether the comparison is exact, asymptotic, finite-grid, or finite-size. A failure to match an exact formula is not always a bug; it may be a boundary effect, a coarse grid, or an invalid parameter regime. The notebook should make that distinction visible.

  • Publishing a plot without a validation check.
  • Treating agreement by eye as a numerical test.
  • Hiding boundary conditions in code rather than stating them in markdown.
  • Comparing finite-box numerics directly with infinite-line formulas without explaining the approximation.
  • Reporting an eigenvalue without specifying grid spacing and convergence behavior.
  • Using a gauge-dependent wavefunction plot as if it were a gauge-invariant observable.
  1. Design the validation cell for an infinite-square-well diagonalization notebook. What two quantities should be checked?
Solution

Check eigenvalues against

En=n2π2ℏ22mL2E_n=\frac{n^2\pi^2\hbar^2}{2mL^2}

for the lowest few states, and check numerical orthonormality of the eigenvectors with the grid inner product. A good notebook should also show convergence as the grid spacing is reduced.

  1. A wave-packet notebook conserves norm to high precision but its packet width disagrees with the analytic Gaussian formula. List two likely causes.
Solution

The initial state may not match the analytic Gaussian convention used in the formula, or the propagation may be affected by finite-box boundaries, grid dispersion, or time-step error. Norm conservation is necessary but not sufficient to validate the full evolution.

  • D. J. Griffiths and D. F. Schroeter, Introduction to Quantum Mechanics, 3rd ed., Cambridge University Press, 2018.
  • R. J. LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations, SIAM, 2007.
  • R. Shankar, Principles of Quantum Mechanics, 2nd ed., Springer, 1994.
  • L. N. Trefethen and D. Bau III, Numerical Linear Algebra, SIAM, 1997.