THE EXPERIMENT
A wave meets a wall with two openings. Each opening becomes a new source (Huygens’ principle), the two wavelets overlap, and where they arrive in phase they reinforce; out of phase, they cancel. The result on a distant screen is not two bright stripes but a comb of fringes. Light does this (Young, 1801), electrons do it (Jönsson, 1961), and it works even when particles are sent one at a time (Merli 1974, Tonomura 1989) — which is where it stops being a story about waves and becomes the central mystery of quantum mechanics.
WAVE · THE SIMULATION
The WAVE view integrates the two-dimensional wave equation in real time on your GPU:
discretised leapfrog-style on a pixel grid: ut+1 = 2ut − ut−1 + c²Δt²∇²ut, with the Laplacian as the 4-neighbour stencil. Each texel of a floating-point texture is one grid point; a fragment shader advances the whole field every frame (ping-pong between two textures), with c²Δt²/Δx² = ¼ for stability. A plane wave is driven at the left edge, the barrier forces u = 0 except in the slits, and a sponge layer at the borders soaks up outgoing waves so nothing reflects back. The brightness ramp on the right is the time-averaged intensity 〈u²〉 — the interference pattern, accumulating live.
QUANTA · ONE AT A TIME
The QUANTA view fires individual particles. Each one lands at a single random point — but the probability of landing at angle θ is given by the Born rule, |ψ|², which for N identical slits of width a, spacing d, is the Fraunhofer pattern:
β = πd sinθ/λ α = πa sinθ/λ
The page samples that law by rejection sampling and plots each arrival as one dot. Watch the first dozen: pure noise. By a few hundred, fringes condense out of randomness — each particle interfered with itself, having in some sense taken every path through both slits at once.
THE OBSERVER
The OBSERVE toggle “measures” which slit each particle passes through (watch them flash). Knowing the path destroys the superposition: the amplitudes no longer add before squaring, the cross terms vanish,
and the fringes melt into a single featureless mound — even though nothing touched the particles but information. This is complementarity: which-path knowledge and interference are mutually exclusive, and you can trade one for the other continuously. Flip the toggle mid-run and watch the histogram remember both regimes.
THE RENDERING
WebGL2 float textures, three shader passes (integrate, accumulate 〈u²〉, display) at half resolution, three integration steps per frame. The particle view is canvas 2D with additive glow sprites and a 128-bin histogram; the theory curve is drawn once enough counts arrive. Everything runs locally in your browser — the server only delivered this file.