applets.

Sandpile

← All apps

About Sandpile

A tray of squares, each holding a few grains of sand, and one rule: a square with 4 or more grains topples, sending one grain to each of its four neighbours. A grain pushed over the edge of the tray is gone. That is the whole model. The shades show how many grains a square holds: bare floor for 0, then rust, ochre and pale sand for 1, 2 and 3, lighter as the grains pile up; a white square still has 4 or more and is about to topple.

ONE PILE: every grain is poured on the same square of an endless floor. The picture the page opens with is 1,048,576 grains (2 to the power 20), worked out in advance; BUILD grows one in front of you, pouring in handfuls that double in size, each settling before the next. A million grains take a minute or two on a fast computer, because they topple about 19 billion times between them. Double the grains and the pile gets about 1.4 times wider (the square root of 2), but the pattern inside keeps the same shapes, finer and finer. Point at the pile (or tap it) for a hand lens.

DROP: drop grains yourself, by clicking a square or pouring a handful at random or in the middle, and watch each avalanche spread. Squares that toppled in the latest avalanche are ringed in blue. ALL 3s fills the tray to the brim: one more grain then sets off an avalanche across the whole tray.

ANY ORDER: the same heap of grains on one square, toppled two ways side by side: on the left every full square topples at the same moment, step by step; on the right one full square at a time, picked at random. They look different on the way, and end exactly the same, square for square, with every square having toppled the same number of times. The lower pictures count how many times each square has toppled.

AVALANCHES: grains dropped one at a time on random squares of a tray that has already filled up. Most drops do nothing; some topple a few squares; now and then one sweeps the whole tray. The chart counts how often each avalanche size happens, on scales that go up in tens. Equal steps along a straight line mean the same rule holds at every size: no typical avalanche. The lower chart shows the grains per square in the middle of the tray, which settles near 2.125 by itself, whether you start from an empty tray or not. Changing a setting fades the old result until you RUN again.

ADDING: two sandpiles add by putting one on top of the other, square by square, and toppling. SMALL SUMS does it on 3 by 3 trays you set yourself (click a square to add a grain). THE ZERO builds, in four steps, the pile that adds like zero: put 6 grains on every square, topple, take what is left away from 6, topple again. Step 5 adds it to a pile and gets the same pile back.

THE STORY

Per Bak, Chao Tang and Kurt Wiesenfeld, physicists at Brookhaven National Laboratory, described the model in 1987 in the paper "Self-organized criticality: an explanation of the 1/f noise" in Physical Review Letters. Their point was that many things in nature, from earthquakes to the flicker in electronic circuits, show events of every size with no typical size, and that a system can drive itself into that state without anyone tuning it: keep adding grains and the tray always ends up poised so that the next grain could do anything from nothing to everything. Real sand turned out not to behave so neatly (experiments with rice piles came closer), but the idea spread far beyond sand.

In 1990 Deepak Dhar showed the model's hidden algebra: the order of topplings never changes the end result, which is why it is called the abelian sandpile (abelian means the order of adding does not matter), and the piles a long run keeps returning to form a group, with exactly as many members as the grid has spanning trees (counting the open edge of the tray as one extra point). Michael Creutz wrote about the zero of that group, the identity, in 1991; on a large tray it is the pattern on step 4 of THE ZERO. In 2011 two teams (Richard Kenyon and David Wilson; and Vahagn Poghosyan, Vyatcheslav Priezzhev and Philippe Ruelle) proved that far from the edges a settled tray holds on average exactly 17/8 = 2.125 grains a square. Lionel Levine, Wesley Pegden and Charles Smart, among others, have studied the pile on one square; Pegden and Smart proved in 2013 that its pattern settles to a fixed shape as the pile grows, which is why the pictures for different numbers of grains look alike.

HOW IT WORKS

Everything on the page is the rule itself, done for real: no picture is drawn by hand. A square with h grains may topple h ÷ 4 times at once (rounded down); since the order makes no difference, this gives the same pile as doing the topplings one at a time. The one-square pile is worked out on a quarter of the floor and mirrored, because it is the same in all four quarters; each toppling next to a mirror line is counted for its mirror twin too, so the result is exact. The tests for this page check the 3 by 3 zero (2 1 2 / 1 0 1 / 2 1 2), and that the number of piles in the group matches the number of spanning trees: 192 for 2 by 2 and 100,352 for 3 by 3, found by checking all 262,144 possible 3 by 3 trays with Dhar's burning test.

Avalanche size is the number of topplings a dropped grain sets off. The chart sorts sizes into bins a quarter of a doubling wide and shows, among the drops that toppled anything at all, the share per unit size (the drops that toppled nothing are counted separately, under the chart); the straight line is fitted to the middle sizes, from 4 topplings to a fiftieth of the squares on the tray, because the smallest avalanches feel the squares themselves and the biggest are cut off by the edges. Careful studies on much bigger trays put the slope near −1.2 to −1.3 and still argue over whether it is a pure straight line at all; on a small tray the page measures a little less steep. Starting from an empty tray, the first few thousand drops only fill it up, with small avalanches, and they pull the line steeper.

Simplifications: real sand has slopes, friction and grains of many shapes; here a "grain" is just a count. The tray is a square grid with all four edges open. The one-square pile is on a floor big enough never to reach the edge. The 2.125 line on AVALANCHES is the proven value far from the edges of an endless tray; the middle of a small tray comes close but not exactly.

FURTHER WATCHING AND READING

0 1 2 3 grains 4 or more topples

A million grains on one square

Every grain lands on the middle square, and any square with 4 grains topples, one to each neighbour. Nothing else shapes this pattern.

GRAINS1,048,576
SPEED
Grains poured
Topplings so far
Width of the pile

Twice the grains, about 1.4 times as wide (the square root of 2): the same shapes come back, finer. Point at the pileTap the pile for a hand lens.