Sandpile Fractal
Pile grains of sand on one square of a grid. As soon as a square holds four grains it topples: it gives one grain to each of its four neighbours, which may then topple too. Keep going until every square holds three grains or fewer, and the heap of sand turns out not to be a heap at all, but an intricate fractal with eight-fold symmetry. Watch it happen live with up to 1,048,576 grains, try other lattices, and see the avalanches that made Bak, Tang and Wiesenfeld's sandpile famous. Pile puts the number of grains you enter on one cell and topples them live: a cell with as many grains as it has neighbours gives one grain to each of them. Enter up to 1,048,576 grains (2^20 works too) or pick an example; the bar shows how far the toppling is, and a million grains on the square lattice take about half a minute. Lattice and Start height change the pattern. Identity computes the identity element of the sandpile group of an n × n grid. Avalanches drops grains one at a time on a grid whose edge loses them; click or hold the grid to pour grains in one place, and the chart counts the avalanches by size. Scroll or pinch to zoom, drag to move and double-click to fit the whole pile; zoomed in, every cell shows its number. Turn Speed down to follow the toppling step by step.
How it works
- Enter a number of grains, up to 1,048,576, or pick an example such as 2^18 = 262,144, and watch the pile topple outward from the centre.
- Change the lattice to a square with diagonals or a triangular lattice, or start on a floor of 1 or 2 grains per cell, and compare the patterns.
- Switch to Identity or Avalanches, zoom in until every cell shows its number, and save the picture.
How a sandpile topples
Every cell of the grid holds a number of grains. A cell with as many grains as it has neighbours, four on a square grid, is unstable: it topples and passes one grain to each neighbour. Those neighbours may now be unstable in turn, so one toppling can set off a whole avalanche. The rule is applied until no cell can topple. Starting from 1,024 grains on one cell, that takes 20,384 topplings and leaves a pile 25 cells wide; 262,144 grains take more than 1.2 billion topplings and spread over 375 cells; and 1,048,576 grains, as many as the app allows, take about 19.1 billion topplings and make a pile 747 cells across. Four times the grains give a pile twice as wide.
Why the order does not matter
When several cells are unstable at once, it does not matter which one topples first. Deepak Dhar showed in 1990 that the final stable pile, and even the number of times each cell topples, are always the same: the sandpile is abelian, like addition. This app uses that freedom twice. It lets a cell with many grains give them away in one go instead of four at a time, and because a pile on one cell is as symmetric as its lattice, it computes only one wedge, an eighth of the square lattice or a twelfth of the triangular one, and mirrors the rest.
A fractal that remembers its lattice
The stable pile is far from random. Regions with a regular pattern of 1s, 2s and 3s are bordered by thin lines and filled with smaller copies of themselves. Wesley Pegden and Charles Smart proved in 2013 that the pattern settles to a definite limit as the pile grows, and together with Lionel Levine they showed that the regular regions are linked to Apollonian circle packings. The shape also remembers its grid: on a square lattice with diagonals or on a triangular lattice the same rule draws a different fractal with a different symmetry.
Avalanches and self-organized criticality
Per Bak, Chao Tang and Kurt Wiesenfeld invented the sandpile in 1987 to explain how nature can tune itself to a critical point. Drop grains at random on a grid whose edges lose them, and after a while the grid reaches a steady state: most grains cause nothing, a few start an avalanche that sweeps across the whole grid, and the sizes in between follow a power law, a straight line on a log-log chart. In Avalanches mode you can watch that state form, pour grains in one place, and see the mean height approach 17/8 = 2.125, the value proved for an infinite square grid.
Frequently asked questions
What is the abelian sandpile model?
A cellular automaton introduced by Per Bak, Chao Tang and Kurt Wiesenfeld in 1987. Each cell of a grid holds grains of sand; a cell with at least as many grains as it has neighbours topples and gives one grain to each neighbour. It is called abelian because the order of the topplings does not change the final result, a property Deepak Dhar proved in 1990.
Why does a pile of sand make a fractal?
Toppling spreads the grains in waves that interfere with each other, and the cells settle into regions with a regular pattern of 1s, 2s and 3s, separated by thin lines. Smaller copies of the same regions appear between the larger ones, at every scale the grid allows. The pattern is deterministic: the same number of grains always gives exactly the same picture.
How long does a million grains take?
In the app, 1,048,576 grains on the square lattice take about half a minute on a fast computer, for more than 19 billion topplings, and the progress bar shows how far it is. The triangular lattice and the lattice with diagonals are quicker, and smaller piles are ready almost at once. Lower Speed to watch the topplings slowly.
What is the identity of the sandpile group?
The stable piles that can be reached again and again on a finite grid form a group, where adding means pouring two piles together and letting them topple. Its identity element is the pile that changes nothing when added. On an n × n grid it can be found by stabilizing 6 grains per cell, subtracting the result from 6, and stabilizing again, and it looks like a fractal of its own.
Why can the start height only be 0, 1 or 2?
On a square lattice where every cell already holds 3 grains, a single extra grain never stops toppling: the avalanche grows forever. With 2 grains or fewer on every cell, any pile stabilizes, as Anne Fey, Lionel Levine and Yuval Peres proved, but the higher the floor, the larger and slower the pile.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor