Platform Numbers
Wave 32 Simulations
Diffusion-Limited Aggregation
Particles perform random walks until they touch the growing cluster and permanently stick. The resulting branching tree has fractal dimension ~1.71.
Open →Phase Portrait
2D ODE phase-plane visualiser. Click to trace RK4-integrated trajectories. Overlays show vector field arrows, nullclines, and fixed points.
Open →Turing Patterns
Gray-Scott reaction-diffusion system. Five presets β Spots, Stripes, Labyrinth, Mitosis, Worms β each corresponding to distinct (F, k) parameters.
Open →πΏ Diffusion-Limited Aggregation
The Witten-Sander Algorithm
Witten and Sander introduced DLA in their 1981 paper "Diffusion-Limited Aggregation, a Kinetic Critical Phenomenon". The algorithm is deceptively simple: one particle is fixed at the origin (the seed). New particles are repeatedly spawned at a random point on a circle just outside the current cluster radius, then perform a random walk (Β±1 on x or y per step). The moment a particle lands adjacent to any cell already in the cluster, it freezes permanently and becomes part of the cluster. Repeat.
The branches arise because particles performing random walks far from the cluster are equally likely to approach from any direction β but particles deep in a concave crevice are unlikely to diffuse all the way in before touching a branch tip. The tips therefore grow fastest and shade the interior, creating the characteristic dendritic structure.
Implementation Details
-
Grid: 500×500
Uint16Array. Cell value 0 = empty; value ≥1 = the order in which the particle joined the cluster. The order is used to drive the colour gradient (early particles darker, recent particles brighter). -
Spawn radius: walkers spawn on a circle of radius
maxRadius + 5.maxRadiusis the Euclidean distance from the origin to the outermost cluster cell, updated each time a particle freezes. -
Kill condition: walkers that stray beyond
SIZE/2 − 2(half the grid edge) are discarded and respawned. This prevents walkers from wandering for astronomically long times on large grids. - Stickiness slider (0.1 β 1.0): when a walker is adjacent to the cluster, it only freezes with probability p = stickiness. Lower stickiness produces denser, less branchy structures because walkers have multiple chances to walk away from thin tips.
-
Seed shapes: Point, Line, Ring, Cross β all work by
calling the same
addToCluster(x,y)function; the seed cells seed the initial cluster before walkers begin. -
Multiple walkers/frame: 1β40 walkers are active
simultaneously. Each is stepped once per sub-frame; four sub-frames
run per
requestAnimationFrame. This gives ~60×4×40 = 9,600 walker-steps per second on a typical display. -
Fractal dimension estimate: displayed as
Df =ln(N) / ln(R)where N is particle count and R ismaxRadius. Theoretically ~1.71 in 2D; the live readout converges towards this as the cluster grows.
Colour Palettes
Six palettes map the cluster-entry index (normalised 0β1 against
maxParticles) to an RGB triplet: Emerald, Gold, Ice,
Flame, Violet, and Mono. Switching palette triggers a full redraw of
all N×N ImageData pixels from the
stored grid, so no particle data is lost.
What to Try
- Set stickiness to 0.2 and compare the denser cluster to stickiness 1.0 β the fractal dimension decreases noticeably.
- Use the Cross or Ring seed to grow symmetric clusters; the seed shape is preserved in the branching topology.
- Raise max particles to 20,000 and let it run to see the fractal dimension converge towards the theoretical 1.71.
π Phase Portrait
Why Phase Planes?
A two-dimensional autonomous ODE system αΊ = f(x,y), αΊ = g(x,y) cannot be solved analytically for most interesting f and g β but its behaviour can be completely characterised geometrically. The phase plane is the (x, y) coordinate system; at every point we draw a small arrow in the direction (f, g). Trajectories are curves that flow along these arrows. Fixed points (where arrows vanish) categorise as nodes, spirals, saddles, or centres β a classification that requires only the eigenvalues of the Jacobian.
Six Classic Systems
- Lotka-Volterra β predator-prey; neutrally stable closed orbits around the coexistence equilibrium, no spiral sink because the system is conservative.
- Van der Pol β ΞΌ = 2; a stiff relaxation oscillator with one unstable fixed point at the origin surrounded by a unique stable limit cycle.
- Pendulum β nonlinear ΞΈΜ + 0.25ΞΈΜ + sin ΞΈ = 0; damped stable spirals at integer multiples of 2Ο, saddle points at odd multiples of Ο.
- Hopf Bifurcation β αΉ = r(1βrΒ²), Cartesian form; a perfect circular limit cycle at r = 1 with all trajectories converging to it.
- Saddle-Node β αΊ = xΒ²−1, αΊ = βy; a stable node at (β1, 0) and a saddle at (+1, 0) with the y-axis as the separatrix.
- Spiral Sink β linear system with eigenvalues β0.2 Β± i; all trajectories spiral inward with the same angular frequency.
Implementation: RK4 Integration
Trajectories are integrated with the classical 4th-order Runge-Kutta
method. Each call to rk4(x, y, dt) evaluates f
and g four times (at the current point, two midpoints, and the
predicted endpoint) and combines them with weights 1/6, 1/3, 1/3, 1/6.
The time step is dt = 0.03 and up to 6 RK4
steps are taken per requestAnimationFrame call.
Trajectories are automatically terminated if they leave a kill radius
of 3Γ the view range.
Nullclines
The x-nullcline (red) is the set of points where αΊ = 0 β trajectories cross it moving vertically. The y-nullcline (blue) is where αΊ = 0 β trajectories cross it moving horizontally. Their intersections are always fixed points. Both are computed by scanning a 300×300 grid of the phase plane and identifying sign changes column by column (for x-nullcline) or row by row (for y-nullcline), with linear interpolation to sub-grid precision.
What to Try
- Click "Auto-seed" to flood the phase plane with trajectories and immediately see the global flow structure.
- On the Lotka-Volterra system, click near the fixed point at (2, 1.5) and observe the closed orbit; move further out for a larger orbit.
- On Van der Pol, click near the origin (unstable) and watch the spiral expand outward to the limit cycle.
- Toggle nullclines off to reduce visual noise when studying trajectory shapes.
π Turing Patterns
Turing’s 1952 Insight
In his paper "The Chemical Basis of Morphogenesis" (1952), Alan Turing showed mathematically that two chemical species with different diffusion coefficients could spontaneously break translational symmetry β starting from a nearly uniform distribution, the system would amplify small spatial fluctuations and settle into a stable spatially periodic pattern.
The key mechanism is local self-activation with long-range lateral inhibition. The activator species U catalyses its own production and also produces the inhibitor V, but V diffuses faster than U. So a small bump in U creates a local excess of V that suppresses U in the surrounding region, carving out the characteristic wavelength of the pattern.
The Gray-Scott Model
Gray and Scott (1984) introduced a clean reaction scheme that exhibits a wide variety of Turing patterns depending on two parameters:
∂U/∂t = DU∇²U − UV² + F(1−U)
∂V/∂t = DV∇²V + UV² − (F+k)V
Here UVΒ² is the autocatalytic term (U and V react to
produce more V), F(1βU) feeds U from a reservoir, and
(F+k)V removes V. The fixed parameters are
DU = 0.16 and DV = 0.08 (so
U diffuses twice as fast as V). The presets span the
parameter map first documented by Pearson (1993):
- Spots (F=0.035, k=0.065) β isolated high-V regions in a low-V sea, analogous to leopard spots or orca patterns.
- Stripes (F=0.060, k=0.062) β parallel bands, analogous to zebra stripes or tiger markings.
- Labyrinth (F=0.040, k=0.060) β connected maze-like channels, a common pattern in fingerprint ridges.
- Mitosis (F=0.028, k=0.053) β spots that periodically divide and multiply, mimicking cell division.
- Worms (F=0.078, k=0.061) β wriggling elongated spots that drift slowly across the grid.
Implementation: 9-point Laplacian, Euler Integration
The simulation runs on a 200×200 periodic grid using pairs of
Float32Array double buffers. The discrete Laplacian uses
a 9-point stencil with weights 0.05 for the four diagonal neighbours
and 0.20 for the four cardinal neighbours (summing to 1 minus the
centre weight of β1), which provides better isotropy than the standard
5-point stencil. Integration is forward Euler with
dt = 1.0; this is numerically stable because
DU ≤ 0.16 < 0.25 (the CFL stability limit
for this stencil).
Five colour palettes (Amber, Ocean, Plasma, Jade, Mono) map the U
concentration field linearly from background to foreground. The render
loop writes directly to a ImageData pixel buffer for
maximum throughput β no intermediate CSS colour strings.
Initialisation: Seeded Blobs
The grid starts at U ≈ 1, V ≈ 0 everywhere (the trivial fixed point), with tiny random noise to break symmetry. Twelve small circular blobs of radius 4 are seeded with U = 0.5, V = 0.25. These act as nucleation sites; without them the noise alone would take much longer to seed the pattern. The final pattern is independent of the seed positions β only (F, k) determines which pattern type ultimately emerges.
What to Try
- Switch between presets and watch the existing pattern dissolve and a new one form β the transient is often more interesting than the steady state.
- Try the Mitosis preset: you can see individual spots split into two daughters and drift apart.
- Raise speed to 20 steps/frame to reach steady state in seconds; lower it to 1 to watch the pattern evolve in slow motion.
- Hitting Reset on the Labyrinth preset will produce a different labyrinth every time β the steady state is unique in type but not in microscopic detail.
Technical Notes
-
DLA ImageData painting β every time a new particle
sticks, only its single pixel is painted into the
ImageDatabuffer; the entireputImageDatacall is still O(NΒ²) but avoids garbage-collected string operations per pixel. - Phase portrait β nullcline detection scans a 300×300 sub-grid separately for each column (x-nullcline) and each row (y-nullcline) looking for zero-crossings of f or g respectively; sign change ⇒ linear interpolation to sub-cell precision.
- Gray-Scott stability β forward Euler is conditionally stable for the diffusion part when D < 1/(4 × dt), i.e. D < 0.25 at dt = 1. Both DU = 0.16 and DV = 0.08 satisfy this; the reaction terms are bounded and do not threaten stability.
-
All Wave 32 simulations ship with full EN + UK pages and are
registered in
simulations.json.
Tags
DLA Fractals Random Walk Fractal Dimension Phase Portrait Dynamical Systems Van der Pol Lotka-Volterra RK4 Turing Patterns Reaction Diffusion Gray-Scott Morphogenesis Wave 32
Wave 33 Preview
Three simulations planned for Wave 33:
- Voronoi Diagram — interactive computational geometry; add seed points and watch Voronoi cells and Delaunay triangulation update in real time.
- Double Pendulum — chaotic dynamics of a two-link pendulum; visualise the sensitivity to initial conditions with multiple simultaneous trajectories.
- Hodgkin-Huxley Neuron — the Nobel-Prize-winning model of action potential generation; adjust ion channel conductances and watch the spike pattern change.
All Wave 33 simulations will ship with EN + UK pages on launch day.