Platform Stats
Wave 29 at a Glance
Taylor Series Visualiser
Watch sin, cos, ex, ln(1+x), arctan, sinh, cosh, 1/(1−x) approximate their targets term by term. Adjustable expansion centre, N up to 20 terms, live error panel, radius-of-convergence label.
Try it →Hodgkin–Huxley Neuron
The Nobel 1963 conductance-based model of the squid axon. Inject a current pulse and watch Na+ / K+ gating variables m, h, n drive the action potential spike, refractory period, and repetitive firing.
Try it →Ising Model — Phase Transition
2D Metropolis–Hastings Monte Carlo on an N×N spin lattice. Tune temperature, external field and coupling constant. Watch spontaneous magnetisation snap in below Tc = 2.269 J/kB.
Try it →Taylor Series Visualiser
A Taylor series expands any smooth function as an infinite polynomial centred at a point a:
f(x) = Σ f(n)(a) · (x − a)n / n!
The visualiser supports eight functions and lets you slide the expansion centre a anywhere on the axis — not just the Maclaurin origin. Each added term is highlighted on the graph and listed below the canvas, making it easy to see how quickly (or slowly) the partial sum converges to the true curve.
- Main panel — true function (white) and partial sum (cyan) overlaid; the gap between them is filled to show the instantaneous error.
- Error panel — toggleable sub-plot of |f(x) − PN(x)| on a log scale, making divergence at the boundary of convergence immediately visible.
- Term list — scrollable list of the current coefficients with the highest-order term highlighted as it is added.
- Radius of convergence — displayed per function (e.g. R = 1 for ln(1+x) and arctan, R = ∞ for sin/cos/exp).
Controls: function selector, expansion centre a (−3 to 3), number of terms N (1–20), x-range zoom, error panel toggle, animate button (steps N from 1 upward automatically).
Hodgkin–Huxley Neuron
The Hodgkin–Huxley model (1952, Nobel Prize 1963) describes the ionic mechanism of the action potential in the squid giant axon. The membrane potential V obeys the ODE:
Cm dV/dt = Iext − gNa m3h(V − ENa) − gK n4(V − EK) − gL(V − EL)
with gating variables m, h (sodium activation/inactivation) and n (potassium activation) each obeying first-order kinetics dx/dt = αx(V)(1−x) − βx(V)x.
The simulation uses original Hodgkin & Huxley 1952 squid-axon parameters (Cm = 1 μF/cm², gNa = 120, gK = 36, gL = 0.3 mS/cm²) and integrates the full ODE system with Euler at dt = 0.01 ms. The canvas draws V(t) in blue plus three gating-variable traces (m red, h yellow, n green), and a purple Iext bar. An info panel reports spike count, peak voltage, and firing frequency.
- Presets — single spike, repetitive firing, sub-threshold, short pulse, high-frequency burst.
- Sliders — Iext (0–20 μA/cm²), pulse start and duration, simulation window (10–200 ms).
- Animate mode — reruns the simulation in a real-time scrolling view at 60 fps so you can watch the spike train build up.
Ising Model — Phase Transitions
The 2D Ising model is the simplest system that undergoes a continuous phase transition. Spins si = ±1 on a square lattice interact via nearest-neighbour coupling; the Hamiltonian is:
H = −J Σ⟨i,j⟩ si sj − H Σi si
The Metropolis–Hastings algorithm samples the Boltzmann distribution: a random spin-flip is accepted unconditionally if ΔE ≤ 0, or with probability e−ΔE/kBT otherwise. Below the exact 2D critical temperature kBTc = 2J/ln(1+√2) ≈ 2.269J, spontaneous magnetisation appears and large ferromagnetic domains grow. Above Tc thermal fluctuations disorder the lattice completely.
The canvas colour-codes each spin (warm red = up, cool blue = down)
and renders at full resolution via ImageData, enabling
smooth real-time animation even at N = 80 (6400 spins). A live
magnetisation history plot tracks |〈m〉| over time. Controls
expose T/Tc, external field H, coupling J, lattice size N,
and initial conditions (random, all-up, all-down).
Engineering Notes
Taylor series: analytic nth-derivative evaluation + L’Hôpital regularisation
Evaluating the Taylor coefficient cn = f(n)(a)/n! requires the exact nth derivative at the expansion centre. For sin, cos, sinh, cosh the derivatives cycle with period 4 or 2 respectively, so a simple modulo dispatch suffices. For ln(1+x) the pattern is cn = (−1)n+1(n−1)!/(1+a)n. For 1/(1−x) the closed form is n!/(1−a)n+1. For arctan, whose higher derivatives have no clean closed form, the implementation falls back to a centred finite-difference stencil of order n. Factorials are memoised up to n = 170 (the double-precision overflow boundary). The αm and αn rate functions in Hodgkin–Huxley apply the same L’Hôpital rule pattern: when |V + 40| < 10−5 (resp. |V + 55|) the limit value 1.0 (resp. 0.1) is returned directly to avoid 0/0 by cancellation.
Hodgkin–Huxley: full solve then render for glitch-free animation
Rather than stepping the ODE inside the animation loop (which risks
frame-rate jitter causing visible numerical noise), the simulation
runs the entire Euler integration synchronously on the main thread
whenever a slider changes, storing the complete V(t), m(t), h(t), n(t)
arrays. The requestAnimationFrame
loop then simply scrolls a window over the pre-computed arrays and
redraws the visible segment, guaranteeing that the waveform shape is
identical regardless of display frame rate. A 200 ms window at dt
= 0.01 ms is 20 000 points — fast enough to compute in
<2 ms on any modern device.
Ising model: random-access Metropolis vs. checkerboard sweep
The canonical textbook implementation uses a
checkerboard (red-black) sweep to avoid data-race issues in
parallel implementations, but this introduces a subtle correlation:
the “black” sublattice feels the influence of
all updated red spins simultaneously, creating a small
systematic bias near Tc. The simulation instead uses
random-access Metropolis: each sub-step picks a uniformly
random spin index, computes ΔE from four periodic-boundary
neighbours, and applies the acceptance criterion. One sweep consists
of N² such single-flip proposals, so each sweep is statistically
equivalent to one Monte Carlo step per spin (MCS).
Int8Array stores spins compactly (±1 in 1 byte
each) and ImageData renders the lattice in a single
putImageData call per frame.
What’s Next — Wave 30 Preview
Planned topics for Wave 30 include:
- Fourier Series Builder — decompose square, sawtooth, triangle waves into harmonics; add/remove terms interactively; see Gibbs phenomenon at discontinuities
- Gravitational Lensing — Schwarzschild light deflection, Einstein ring radius, point-mass and extended-mass lenses, retro-lensed source images
- Epidemic Wavefront (SIR-PDE) — reaction-diffusion SIR model on a 2D grid, spatial propagation speed, wavefront curvature, population heterogeneity
All Wave 30 simulations will ship with EN + UK pages on launch day.