📚 The CoCalc Library - books, templates and other resources
License: OTHER
Single source sand piles
An exploration of the single source sand pile model and the fractals it produces.
Code examples from Think Complexity, 2nd edition.
Copyright 2016 Allen Downey, MIT License
Sand pile
Sand.py
contains an implementation of the sand pile model.
run_ss_pile
initializes a pile with 2**k
grains in the center cell, then runs until equilibrium.
After initialization, the result looks like a fractal, but as far as I know, no one has estimated its fractal dimension.
draw_four
draws the cells with each of the given values.
I'll estimate the fractal dimension for each of these patterns separately.
Bigger sand piles
Wesley Pegden at CMU has studied the single source sand pile model and the fractals it produces. On this web page you can explore results he generated from sand piles with a large number of grains in the initial tower. I'll use the images he produced to estimate the dimension of these fractals.
read_pile
reads the images Prof Pegden generated and makes a SandPile
object.
Here's an example with 2**20
grains.
Here's what the four patterns look like.
Estimating dimensions
radial_box_count
applies a radial version of the box counting algorithm.
The following plots show cell counts versus distance for each of the 4 values, along with the estimated fractal dimensions.
estimate_four_radial
calls radial_box_count
for each value.
And here are the four dimensions.
It sure looks like they are fractals, although the dimensions greater than 2 are surprising.
Let's see what happens as we increase the size of the pile.
process_pile
takes a value of k
, reads the results of the sand pile with 2**k
grains, and estimates the dimensions.
And here are the results for a range of values of k
.
Above k=14
the estimates are pretty stable.
Might be interesting to try a few more to see if those trends are going anywhere.