Harmonic Oscillator Spectrum
How accurately can a finite matrix recover a quantum system on the whole real line? This experiment computes the first five harmonic-oscillator states and checks their energies and alternating parity. It varies the mesh and the enclosing interval independently, so agreement at one grid cannot conceal a boundary error. The physical solution remains in Quantum Harmonic Oscillator.
Required background. Use the oscillator spectrum and interpret the eigenvectors of a symmetric matrix. Eigenvalues and Eigenvectors supplies the matrix language.
The oscillator on a finite grid
Section titled “The oscillator on a finite grid”In oscillator units, and
Place interior points between and , with , and impose zero values at the two endpoints. The centered second derivative gives
The finite-interval problem differs from the whole-line oscillator; the matrix adds a second approximation. Dense diagonalization makes the construction transparent but uses memory proportional to and work that scales approximately as . The experiment is intended for low states and modest grids, not large production calculations.
The eigensolver returns vectors normalized with an ordinary sum. Their wavefunction samples are , so the discrete probability is . An arbitrary overall eigenvector sign has no physical meaning.
Run and inspect the calculation
Section titled “Run and inspect the calculation”Download the complete oscillator package, extract it, and follow Running an Experiment. The package contains the notebook, a command-line runner, an environment specification, and checks. The runner executes the notebook’s code cells; there is one implementation of the Hamiltonian.
python -m pip install -r requirements.txtpython run.py --output-dir resultsNo Jupyter installation is needed for this command. Open the same notebook in Jupyter if an interactive cell-by-cell session is preferable. The tested environment and the results of the actual package execution are recorded in the verification report.
The output summary.json contains the computed energies, parity overlaps, normalization and residual errors, grid-refinement values, boundary-refinement values, and named acceptance checks. The notebook also prints the main quantities. Read the numerical values alongside the Boolean checks.
Distinguish the two refinement limits
Section titled “Distinguish the two refinement limits”The reference run uses , . Its first five exact targets are ; the notebook requires maximum energy error below . A symmetric interval and potential make the parity overlap
approach . Norms and eigenpair residuals diagnose algebraic implementation errors but do not measure the finite-domain error.
For the grid study, keep and use . The ground-state error must decrease and the measured refinement order must lie between and , consistent with a centered second derivative before roundoff or boundary effects dominate.
For the domain study, keep and use . The last two intervals must agree in the first five energies to . This is a check of the retained states and parameters, not a guarantee for highly excited states, whose turning points extend farther from the origin.
Explore the failure modes
Section titled “Explore the failure modes”Raise the number of states. Compare states near and above the classical turning point at the boundary. Explain why the same test ceases to justify their whole-line interpretation.
Refine the wrong variable. Keep a small interval fixed and make the grid arbitrarily fine. Determine whether the energies converge to the whole-line oscillator or the oscillator confined by hard walls.
Change the potential. Add a positive quartic term. Keep normalization, parity and residual checks, but replace the exact-spectrum criterion with an appropriate independent comparison. A passing oscillator fixture does not validate the new potential automatically.
References
Section titled “References”- D. J. Griffiths and D. F. Schroeter, Introduction to Quantum Mechanics, 3rd ed., Cambridge University Press, 2018 — oscillator energies, wavefunctions and parity.
- L. N. Trefethen and D. Bau III, Numerical Linear Algebra, SIAM, 1997 — symmetric eigenproblems, residuals and conditioning.
- NumPy developers, numpy.linalg.eigh — normalization, ordering and implementation contract of the symmetric eigensolver.