The sandpile model, or Bak–Tang–Wiesenfeld sandpile, was developed to demonstrate how a simple system can bring itself to a critical state without the need for careful tuning.
June 23, 2017—Leo McElroy
Setting Up the Model
Our model involves placing sand on a table and adding grains one by one as we observe collapses. Let’s start by making our table.
We begin by picking our table size:
In[]:=
gridSize:=8
Now let’s generate a matrix to represent our table:
Next we will place a grain of sand in a random cell on the table. If that cell gets taller than four grains of sand, it will topple, losing four grains and giving one grain to each neighbor that shares an edge.
First we select a cell. We will distinguish this cell with a white dot:
Now we will add a grain of sand to the cell we selected. If this made the cell larger than five grains tall, then the cell will topple and cause an avalanche: