Platform Numbers
Wave 30 Simulations
Fourier Series Builder
Decompose square, sawtooth, triangle, pulse, and half-rectified waves into rotating epicycles. Watch harmonics add up in real time and inspect the frequency spectrum.
Open →Gravitational Lensing
Reverse ray-trace every pixel through three lens models — point mass (Einstein ring), SIS, and NFW profile — and watch a galaxy or quasar distort into arcs.
Open →Epidemic Wavefront
FTCS reaction-diffusion SIR model on a 150×150 grid. Tune β, γ and diffusivity D; observe how R₀ = β/γ governs whether a wavefront ignites or fizzles.
Open →🎵 Fourier Series Builder
The Mathematics
Any periodic signal can be written as a sum of sinusoids: f(x) = ∑ cn cos(nx + φn). The Fourier Series Builder computes analytic coefficients for five classic waveforms at the press of a button — no numerical integration required.
- Square wave — odd harmonics only; amplitude 4/(πn), all in phase.
- Sawtooth — all harmonics; amplitude 2/(πn), alternating signs.
- Triangle — odd harmonics; amplitude 8/(π²n²), phase cycling with floor((n−1)/2).
- Pulse — all harmonics via sinc envelope; duty cycle 20%.
- Half-rectified sine — special-case formula for n=1 and even n.
Epicycle Animation
The drawEpicycles(t) function chains rotating arms of decreasing
length, one per harmonic. The tip of the last arm traces the reconstructed
waveform. The live frequency-spectrum bar chart below the canvas shows
amplitude vs. harmonic number, updating as the number of terms changes.
What to Try
- Add terms one at a time to a square wave and watch Gibbs phenomenon at the discontinuity.
- Switch to triangle wave — higher harmonics decay as 1/n², so convergence is much faster.
- Set N=1 or N=3 for a pulsating single-arm to show phase relationships clearly.
🔭 Gravitational Lensing
Reverse Ray-Tracing
For each pixel (i, j) in the image plane, the deflect(ix, iy)
function computes the angular position on the sky where light actually came from.
The canvas is filled by sampling the off-screen source image at those redirected coordinates.
Three lens models are implemented:
- Point mass — exact GR result: β = θ − θE²/|θ|. Produces the iconic Einstein ring when source and lens are perfectly aligned.
- SIS (singular isothermal sphere) — constant deflection angle α = θE · θ̂; models galaxy-scale lenses with roughly flat rotation curves.
- NFW (Navarro-Frenk-White) — radially-varying profile α(r/rs) with a logarithm/arc-secant formula, describing cold dark-matter halos.
What to Try
- Point mass with a quasar source — align source with the lens to complete the Einstein ring.
- Switch to SIS and note how the tangential arcs are more extended than the radial ones.
- Drag the Einstein-radius slider to see how the entire lensing geometry scales.
🦠 Epidemic Wavefront
Reaction-Diffusion SIR
The classic SIR compartmental model is extended to 2D space by adding a diffusion term for the infected population:
- dS/dt = −β·S·I
- dI/dt = β·S·I − γ·I + D·∇²I
- dR/dt = γ·I
Spatial spread enters through the Laplacian term D·∇²I, discretised with a 5-point finite-difference stencil and Neumann (no-flux) boundary conditions. Integration uses forward Euler (FTCS) with Δt = 0.25, running 1–20 steps per animation frame depending on the speed slider.
Fisher-KPP Wavefront Speed
Far ahead of the wavefront, S ≈ 1 and the infected density is small. In this limit the equation for I linearises to Fisher’s equation, whose minimum wavefront speed is v = 2&sqrt;(D·(β−γ)). The simulation displays R₀ = β/γ in large type, colour-coded green (R₀ < 1, epidemic fades) through orange to red (R₀ > 2, rapid spread).
Initial Conditions
- Center — single circular seed at the grid centre; wavefront expands symmetrically.
- 4 Foci — four corner seeds; wavefronts collide and interfere in the middle.
- Edge — full bottom row infected; planar wavefront sweeps straight across.
- Random — ~2% of cells seeded at low density; multiple simultaneous nucleation events.
What to Try
- Set β = 0.07, γ = 0.08 (R₀ < 1) — the infection seed collapses without spreading.
- Raise D to maximum with a centre seed — wider, faster wavefront; fewer recovered cells in the wake.
- Use “4 Foci” and watch counter-propagating fronts merge and extinguish.
- Switch to “Edge” to measure wavefront speed visually against the Fisher-KPP prediction.
Technical Highlights
-
Fourier —
getCoeffs(type, maxN)returns a plain array of{n, amp, phase}objects computed in closed form; zero numerical integration;drawEpicycles(t)renders the rotating-arm animation via Canvas 2D with a trailing waveform trace. -
Lensing —
deflect(ix, iy)operates in normalised angular coordinates; the full canvas is filled with a singleImageDatawrite per frame; the source pattern is drawn once to an off-screen canvas and sampled by bilinear-like integer lookup. -
Epidemic — three
Float32Arraypairs for double-buffering S, I, R; the inner loop touches each of 150×150 = 22 500 cells per step; the grid is rendered to a 600&x600 pixelImageDatawith colour blending S→blue, I→red, R→grey. - All Wave 30 simulations ship with full EN + UK pages and are registered in
simulations.json.
Tags
Fourier Series Epicycles Harmonic Analysis Gravitational Lensing General Relativity Dark Matter SIR Model Reaction-Diffusion Epidemiology Fisher-KPP Wave 30
Wave 31 Preview
Three simulations are being designed for the next release:
- Newton's Fractal — Newton's method on z^n−1 in the complex plane; coloured basins of attraction revealing stunning fractal boundaries.
- Sand Pile — Bak–Tang–Wiesenfeld self-organised criticality; avalanche power-law statistics emerge from a simple topple rule.
- Complex Functions — domain-colouring of f(z): hue encodes argument, brightness encodes magnitude; visualise poles, zeros, branch cuts.
All Wave 31 simulations will ship with EN + UK pages on launch day.