Wave Mechanics: a wavefunction in a finite Hilbert space

Particle in a box, ψn(x) = √(2/L) sin(nπx/L). The box is split into N equal cells of width Δx = L/N. Each cell gets one coefficient ci with |ci| = √(∫cell|ψ|² dx).

Wavefunction ψ(x) · √L

The exact wavefunction, sampled at least every 0.001 L. Thin vertical lines mark the cell boundaries. With the density shown, the red bars are ci / √Δx, which approaches ψ(x) as N grows.

Probability amplitudes ci using finite Δx

One bar per cell, |ci| = √(∫cell|ψ|² dx), with the sign of ψ in that cell. The sum of the squares of these coefficients is the total probability.

About this page

This is an HTML + JavaScript port of WaveMechanicsApp, a Java program written by Larry Engelhardt in 2010 with the Open Source Physics library. For each cell, |ψ|² is integrated by the midpoint rule with sub-steps no wider than 0.001 L, and the square root gives |ci|; the sign is that of ψ in the cell. The original Java stepped by exactly 0.001 L and overshot each cell edge, which inflated the sum of squares for most N; this version fixes that. Defaults are N = 2, n = 1, as in the original.

See also Quantum Dynamics in a 1D Box, a companion simulation.

Created by Larry Engelhardt, Francis Marion University, with Claude (Anthropic), 2026. Licensed under CC BY-NC-SA 4.0. Source: github.com/lengelhardt/wavefunction_finite_hilbert_space.