Wavefunction evolution advances a complex state through time. A display of probability density is useful, but it is a derived view: two states can have the same |ψ|² while differing in phase, and that phase can change later interference. A simulator must preserve enough data to reproduce both views.
{ real, imaginary } or parallel typed arrays. Treat probability density, phase, norm, and energy diagnostics as derived data. A render loop may read a density chart every frame, but the model owns the initial state, potential, grid spacing, time step, boundary policy, and integrator used to create it.Ideal closed-system evolution is written
\[|\psi(t)\rangle=e^{-i\hat Ht/\hbar}|\psi(0)\rangle\]For a position sample, the displayable probability density is
\[\rho(x,t)=|\psi(x,t)|^2=\operatorname{Re}(\psi)^2+\operatorname{Im}(\psi)^2\]Multiplying the entire state by a constant phase exp(iφ) changes neither ρ nor the norm. That gives a sharp unit test: construct a state, rotate every complex sample by the same angle, and compare the two density arrays. In contrast, a position-dependent phase can change momentum information and later interference even when the density initially looks identical.
const probability = state.map((sample) => sample.real ** 2 + sample.imaginary ** 2);
const norm = probability.reduce((sum, value) => sum + value * dx, 0);
Log norm - 1 rather than silently rescaling every animation frame. A rescale may be appropriate at a clearly stated algorithm boundary, but blind per-frame normalization can hide instability. Compare a fixed physical duration at Δt and Δt / 2; a simulation that only looks smooth has not passed a convergence check.
Prediction: A global phase rotation changes the real and imaginary traces but leaves every probability-density sample unchanged.
Imagine a complex state with one nonzero sample1 + 0i. Multiply it by i. Predict its real component, imaginary component, and density before calculating. Then explain what extra experiment would reveal a relative phase difference between two paths.Wavefunction evolution is complex-state evolution, not a succession of probability pictures. Retain phase-carrying state, derive density deliberately, monitor norm and refinement, and use global-phase invariance as a focused regression test.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Wavefunction Evolution, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Quantum Beginnings, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Wavefunction Evolution as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Evolve complex state with replayable settings and expose both phase and probability diagnostics.