Matter waves associate a wavelength with a particle's momentum. This does not mean a tiny ball wiggles along the drawn curve. The curve is a component of a complex probability amplitude: it carries phase, and its squared magnitude can predict where repeated measurements are likely to occur.
re * re + im * im after normalization. Keep momentum in kilogram metres per second and wavelength in metres until the display boundary; unit conversions belong in one visible function.De Broglie's relation is
\[\lambda=\frac{h}{p}\]λ is wavelength in metres, h = 6.62607015 × 10⁻³⁴ J·s is Planck's constant, and p is momentum. For p = 6.62607015 × 10⁻²⁴ kg·m/s, the result is λ = 10⁻¹⁰ m, or 0.1 nm. That inverse relationship is a strong unit and direction test: larger positive momentum must make the wavelength shorter.
const PLANCK_CONSTANT = 6.626_070_15e-34; // J·s
function deBroglieWavelength(momentum: number) {
if (momentum <= 0 || !Number.isFinite(momentum)) throw new RangeError("positive momentum required");
return PLANCK_CONSTANT / momentum;
}
Change an electron-like particle's momentum. The line plots the real part of a plane-wave amplitude over three nanometres; it is not a path through space.
Momentum 5.0e-24 kg·m/s; de Broglie wavelength 0.133 nm.
The plotted line is deliberately labelled as the real component of an ideal plane-wave amplitude. A global phase shift can change this particular line without changing its probability density. In code, preserve both components before reducing to an observable:
\[P(x)=\frac{|\psi(x)|^2}{\sum_j |\psi(x_j)|^2}=\frac{\operatorname{Re}(\psi)^2+\operatorname{Im}(\psi)^2}{\sum_j |\psi(x_j)|^2}\]Use the denominator as a test oracle. If a finite-grid approximation produces a total far from one after the normalization step, inspect the boundary policy, grid spacing, or complex arithmetic before interpreting the picture.
Prediction: Increasing momentum makes more phase cycles fit in the same three-nanometre view, while the plotted amplitude scale itself does not report a particle's location.
Set the momentum to2 × 10⁻²⁴ kg·m/s, predict the wavelength, then change it to 8 × 10⁻²⁴ kg·m/s. Compare the displayed values and count the phase cycles. Explain why neither curve alone tells you where a single detection will occur.Matter-wave code begins with a typed inverse relationship: momentum determines wavelength. Keep the complex state long enough to model interference, normalize its squared magnitude before treating it as a probability, and never mistake an amplitude plot for a particle trajectory.
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 Matter Waves, 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 Matter Waves 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.
Use normalized complex wave state to relate momentum, phase, interference, and probability density.