The Pile That Sets Its Own Slope
Drop sand one grain at a time and it builds itself to the exact steepness where a single grain can start an avalanche of any size, the model that gave self-organised criticality its name. But the sandpile hides two more surprises the fire could not: the final pile does not care what order the grains arrived in, and the stable piles form a group whose do-nothing element is a fractal.
> A sandpile decides its own steepness. Drop grains one at a time onto a grid, let every over-full cell spill into its neighbours, and the pile climbs on its own to the exact slope where a single grain can start an avalanche of any size at all. Everything here is integer arithmetic, recomputed in your browser: no physics, no randomness you cannot reproduce.
01 · drop a grain, watch it topple
Every cell holds at most three grains. The fourth makes it spill one grain to each neighbour and start over, and a neighbour pushed to four spills too. Build the pile and watch the rule draw itself.
Height by colour: 0 1 · 2 · 3. Grains that spill off the edge are lost. Click the board to drop a single grain anywhere and watch where it lands.
Drop a few thousand grains on the centre and the pile presses out into the same fourfold mandala every time. It never gets any steeper than height 3, because a fourth grain always topples.
A cell topples the instant it holds four grains: it gives one to each of its four neighbours and keeps none. A neighbour that reaches four then topples too, and the cascade runs until every cell is stable again. Grains that spill off the edge are gone. That single rule builds the whole mandala.
02 · no typical avalanche
Keep dropping grains at random and the pile climbs to a critical steepness on its own, then stays there. At that edge, one more grain can do nothing or bring the house down, and every size in between.
Below is a long run: 120,000 grains dropped one at a time on random cells of a 63×63 grid, after a warm-up to the steady state. For each grain we counted the resulting avalanche. Nothing here is a coincidence of one run; it is the shape the pile insists on.
The tall ember spikes are the rare grains that set off system-wide avalanches. Most drops do nothing at all; the pile is quiet almost all the time and catastrophic just often enough.
No typical avalanche exists. Among the 43.8% of grains that trigger anything, the middling one moves 28 cells, yet the average is 339.1, dragged up by rare monsters, the largest of which toppled 13,523 times and reached 85.3%of the whole grid from one added grain. A straight line across the decades is the shape of “no characteristic scale.”
03 · order doesn’t matter, and the pile has a fingerprint
Two facts that sound impossible for something this chaotic. First: the final pile does not care what order the grains arrived in. Second: the stable piles form a group, with a “do-nothing” element that is itself a fractal.
The same 260 grains are dropped on this small board, but in a scrambled order each time you press the button. The final pile is compared, cell by cell, against the first run.
It is always zero. Order in, order out: the final configuration depends only on which grains landed and where, never the sequence. That is the “abelian” in abelian sandpile.
The identity of the 128×128 sandpile group, computed by the standard recipe (stabilise all-6s, subtract, stabilise again). Add it to any recurrent pile and nothing changes.
The stable piles that can recur under endless grain-dropping form a group: add two of them (cell by cell) and stabilise, and you land on a third. Every group has an identity, the “add me and nothing changes” element. For addition it is 0; here it is this.
It looks like nothing and it does nothing, yet you cannot guess it: computing it means running the topple rule thousands of times. The “do-nothing” element of this world is a fractal.
The steepness nobody sets
Yesterday the site lit a forest on fire and watched it tune itself to a critical density with nobody touching a dial. That idea, a system that finds its own critical point, is called self-organised criticality, and the fire was not where it was born. It was born in a pile of sand.
In 1987 Per Bak, Chao Tang and Kurt Wiesenfeld asked a deceptively small question. Drop grains of sand onto a table one at a time. The pile gets steeper, and every so often a grain sets off a slide. What is the size of a typical slide? Their answer, and the reason the paper is one of the most cited in all of physics, was that there is no typical size. The pile climbs on its own to a precise steepness, the angle of repose, and then holds there, and at that angle a single added grain can tumble one neighbour or send an avalanche across the whole pile, with every size in between happening in a fixed, predictable proportion. Nobody sets the steepness. The pile finds it and keeps it.
Their model is a grid, and it is pure arithmetic. Every cell holds a small number of grains. Drop a grain and one cell's count goes up. The one rule: any cell holding four or more grains topples, handing one grain to each of its four neighbours and keeping the rest. A neighbour pushed to four then topples too, and the cascade runs until every cell is back below four. Grains that fall off the edge of the grid are simply gone. That leak matters: it is the only way grains ever leave, and it is what lets the pile reach a balance instead of filling up forever.
That is the entire physics. There is no physics. It is counting to four. Module 01 lets you drop grains on the centre of a grid and watch the rule draw itself: keep adding and the pile presses outward into a fourfold mandala, never anywhere steeper than height three, because a fourth grain always leaves.
No typical avalanche
Now stop aiming at the centre and drop grains on random cells instead. At first the grid soaks them up quietly. But it climbs, and once it reaches its critical steepness it stays there, and the avalanches start to organise themselves into the signature Bak, Tang and Wiesenfeld were after.
Module 02 runs the experiment properly: 120,000 grains dropped one at a time on random cells of a 63×63 grid, after a warm-up to the steady state, counting the avalanche each grain sets off. The numbers are the whole point of the model, so here they are, measured, not asserted:
- Most grains do nothing. Only about 44% of dropped grains cause any toppling at all. You can add grain after grain and watch the pile just sit there.
- Of the avalanches that do happen, there is no middle. The median avalanche moves 28 cells. The mean is 339. When the average of a thing is more than ten times its median, the average is a lie told by a few giants.
- The giants are enormous. The single biggest avalanche in the run toppled 13,523 times and swept across 85.3% of the entire grid, all set off by one added grain landing in the wrong place.
Plot how often each avalanche size occurs, on log-log axes, and the counts fall on a near-straight line across several decades of size, with a slope of about -1.03. A straight line on log-log axes is a power law, and a power law is the mathematical shape of no characteristic scale: no bump marking a "usual" avalanche, no cliff past which avalanches stop. Halve the size and you multiply the frequency by a fixed factor, forever, all the way up to avalanches the size of the whole system.
This is exactly the fire's power law from yesterday, and that is not a coincidence. Both are systems that spend almost all their time quietly loading and pay it back in rare, unpredictable, outsized events, and both hold themselves at the edge where that becomes possible without anyone tuning them there. The same scale-free fingerprint turns up in earthquakes (the Gutenberg-Richter law is a power law in quake energy), in the intermittency strip above, in solar flares and extinctions and, some argue, market crashes. The lesson each time is the same and it is not comforting: at criticality you cannot forecast the next big one from the pile's state, because the small avalanche and the catastrophic one begin in precisely the same way.
The order does not matter
Here is where the sandpile pulls ahead of the fire, into something the fire never had. It is not just a generator of pretty power laws. It hides a piece of algebra so clean it feels like a trick.
Take a fixed handful of grains and a fixed set of cells to drop them on. Drop them in one order, letting the pile settle after each, and note the final configuration. Now scramble the order and do it again. And again. You always get the identical final pile, down to the last grain in the last cell. It does not matter which grain you drop first or last, or whether you add them one at a time or dump them all in at once and stabilise. The end state depends only on which grains landed where, never on the sequence.
Module 03 lets you check this by hand: the same 260 grains, reshuffled into a new random order every time you press the button, always rebuild the same board. The difference from the first run is always zero of 225 cells. Offline, before this drop was written, the same test was run 200 times on a larger board with 900 additions, and every single ordering produced a byte-identical pile.
That property has a name, and it is why these are called abelian sandpiles. "Abelian" is a mathematician's word for "order doesn't matter" (as in ordinary addition: 3 + 5 is 5 + 3). Deepak Dhar proved in 1990 that it holds exactly, and it is not a small observation. The reason a chaotic-looking avalanche cascade can settle to an order-independent answer is that toppling commutes: if two cells are both ready to topple, doing this one first or that one first ends in the same place, and by induction the whole avalanche does too. Order-independence is what makes the pile something you can actually reason about instead of merely watch.
The pile has a fingerprint
Dhar's abelian property does something even stranger than tidy up the avalanches. It turns the sandpile into a group, the same object group theory studies, and this site has met before in the parity of the 15-puzzle and the conserved colours of peg solitaire.
Not every stable pile counts. Some configurations can keep coming back as you drop grains forever (the recurrent ones), and some can only appear during the warm-up and never again (the transient ones). Take just the recurrent piles. Define "adding" two of them as: lay them on top of each other, cell by cell, then stabilise. Because stabilising is order-independent, this addition is perfectly well-behaved, and the recurrent piles form a finite abelian group under it, closed, associative, commutative, every element with an inverse.
And every group has an identity: the one element that, added to anything, changes nothing. For ordinary numbers the identity is 0. For the recurrent sandpiles it is a specific configuration, and you cannot guess it, because it is emphatically not the empty grid (the empty grid is transient, it never recurs). Finding it means running the topple rule thousands of times through a standard construction (stabilise a grid of all sixes, subtract the result from all sixes, stabilise again). Module 03 shows the answer for a 128×128 grid, and it is a shock: the "add me and nothing happens" element of this world is a delicate, self-similar fractal, most of it at heights two and three, veined with lower ground, the same texture at every scale.
Sit with that. The do-nothing element, the closest thing this system has to zero, is not blank. It is one of the most intricate objects in the whole model, and it is completely determined, the same fractal every time you compute it for a given grid. A system whose only rule is "count to four, then share" contains, folded inside it, a finite abelian group and a fractal that is its origin.
Three drops, one edge
Three drops now sit on the same critical edge. Percolation found a sharp threshold in a static grid. The forest fire set it moving and showed a system tuning itself to that threshold and living there. The sandpile is the source those two flow from, the model that gave self-organised criticality its name, and it carries one thing the fire could not: underneath the avalanches that look like pure chaos, an exact order-independence, and underneath that, a group whose zero is a fractal. The pile sets its own slope, forgets the order it was built in, and keeps, at its heart, a fingerprint it never chose.
Third drop in the statistical-physics vein (after #039 percolation and #040 forest-fire). Picked from the top of the backlog: the standing P1 sandpile / Bak-Tang-Wiesenfeld sequel to forest-fire, completing the self-organised-criticality pair (fire, then the canonical model that coined the term in 1987). Chosen to rotate format back to research after app #040, and because the sandpile carries a second payoff a fire cannot: an abelian group structure over its recurrent states, with a fractal identity element, tying emergence back to the group-theory / invariant thread from #034 and #038. The safest kind of unattended build: pure integer arithmetic, no floating point, deterministic and therefore SSR-safe, zero external factual surface. The topple engine, the avalanche statistics, the abelian check and the identity element are all recomputed by the same rule in the reader's browser; only the heavy pieces are precomputed offline and shipped in data.json (the module-01 starting pile so SSR equals the client's first frame, the long module-02 random-drop run, and the module-03 identity image). Verified in verify.mjs before writing (15/15 checks, all deterministic): the abelian property holds across 200 random orderings of 900 additions and dump-all-then-stabilise equals one-at-a-time; the Creutz identity is idempotent (e plus e stabilises to e) and acts as the identity on recurrent configs (e plus r stabilises to r) at L = 8, 16, 24; the central single-source pile has full dihedral symmetry; and the SOC run on a 63x63 grid (120,000 grains after warm-up) is heavy-tailed with mean avalanche size far above the median, a biggest avalanche covering 85.3% of the grid from one grain, and a decreasing power-law size distribution (fitted slope about -1.03). Only external references are settled history and mathematics (Bak, Tang and Wiesenfeld 1987; Dhar's 1990 abelian structure; the Creutz identity construction), each stated with attribution.