Drop grains, trigger avalanches, and watch self-organised criticality generate fractal patterns from a single rule.
h[x,y] ≥ 4 the cell is unstable and topples:h[x,y] -= 4 and h[x±1, y], h[x, y±1] += 1No external tuning is needed: the sandpile spontaneously evolves to a critical state between order and disorder, producing avalanches at every scale.
Avalanche size s follows P(s) ∝ s^{−1.2} in 2D. There is no characteristic scale — tiny and enormous avalanches follow the same statistical rule. Contrast with normal (Gaussian) distributions.
Millions of drops at a single point produce astonishing fractal geometry: triangular regions, diamond lattices, and self-similar colour bands that recur at finer and finer scales.
The set of stable configurations on a finite grid forms an Abelian group under grain addition. Every stable configuration has an additive inverse — the "identity sandpile" is itself a fractal!
| System | Avalanche | Power law | Notes |
|---|---|---|---|
| Earthquakes | Magnitude M energy | Gutenberg-Richter: N ∝ 10^{−bM}, b≈1 | Classic SOC candidate |
| Forest fires | Area burned | P(A) ∝ A^{−τ}, τ≈1.3–2.2 | Clearing = open boundary |
| Solar flares | X-ray energy released | P(E) ∝ E^{−1.8} | Bak-Chen model, 1991 |
| Brain avalanches | Neuronal firing cascade | P(s) ∝ s^{−1.5} (mean-field) | Critical brain hypothesis |
| Stock markets | Price change |Δp| | Lévy-stable tail ∝ |Δp|^{−4} | Related but disputed as SOC |
| Level | Topics |
|---|---|
| GCSE / A-Level Statistics | Power-law vs Gaussian distributions, log-log plots, heavy tails |
| A-Level Further Maths / IB HL | Cellular automata, sequences and series, discrete dynamical systems |
| University Physics / Maths | Phase transitions, renormalisation group, self-similarity, critical exponents |
| Computer Science | BFS / queue algorithms, grid simulations, ImageData pixel rendering |
The spiral-fractal structure arises because the toppling dynamics obey a discrete PDE — the toppled chips function (odometer) minimises a discrete energy. The competition between the underlying square lattice symmetry and the isotropic equations of motion produces non-trivial interference patterns. The boundaries between regions of different grain heights follow quadratic curves related to the burning algorithm on the lattice, giving the characteristic triangular and diamond fractal motifs.
The identity element of the sandpile group is the unique stable configuration that, when added to any other stable configuration, reproduces that configuration after toppling. It is not the empty grid — rather, it is itself a beautiful and non-trivial fractal pattern. For a 200×200 grid, computing the identity requires adding 3×cols×rows grains and allowing the system to fully relax — a process used in theoretical combinatorics and algebraic geometry.
Large avalanches can involve millions of toppling events. This simulator uses a BFS (breadth-first search) queue and a dirty-set to process topples efficiently in O(topples) time, painting pixels incrementally. Frames are flushed to the canvas every ~16 ms so the browser stays responsive. For the "Giant Pile" preset, adding 50 grains/frame generates sustained large cascades — the safety cap of 10 million iterations per frame prevents browser lockup at the cost of occasional multi-frame spreading of very large avalanches.