What does Credit Cycles and Market Criticality conclude, in numbers, about “Sandpiles and the Great Moderation: Self-Organised Criticality”?

Answer: But the figure also shows two problems. First, on a finite grid avalanche size has an upper limit set by the size of the grid, so the large end is cut off sharply and the distribution is not a straight line. Second, the estimated exponent rises from 1.30 to 1.41 as the lower limit of the fit, \(s_{\min}\), rises from 2 to 10. The program gives both the exact discrete maximum-likelihood estimate (normalised with the Hurwitz zeta function) and the approximation of Clauset and colleagues; that approximation is accurate only for lower limits of about 6 or more, and for these data the two happen to agree. Values reported in the literature for the avalanche-size exponent of the two-dimensional sandpile are not consistent, and its scaling properties are still debated. "Is it a power law?" and "what is the exponent?" are not questions that a glance at a log–log plot can answer.

Scope of the numbers: The book is not advice to buy or sell any security, index or option, and it predicts no market level or date. Marked boxes separate published evidence, runnable Python calculations (15 programs, all checked; all prices and volatilities in the book are simulated or invented), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 1.30, 1.41, 10

40000 grains after warm-up: mean height 2.09 grains per site; 22560 caused no toppling; largest avalanche 8063 topplings
avalanche size share of avalanches (logarithmic bins)
1-30.2450 ###############
4-150.2014 ############
16-630.1899 ###########
64-2550.1677 ##########
256-10230.1456 #########
1024-40950.0490 ###
4096-163830.0014
maximum-likelihood exponent for s >2: exact 1.30, approximation 1.30 (15161 avalanches)
maximum-likelihood exponent for s >5: exact 1.36, approximation 1.36 (12510 avalanches)
maximum-likelihood exponent for s >10: exact 1.41, approximation 1.41 (10771 avalanches)
the largest 1 % of avalanches account for 28% of all topplings

Key formula

\[P(s) \propto s^{-\tau}\]
Show the full program
# The Bak-Tang-Wiesenfeld (1987) sandpile on an L x L grid with open edges. Drop one grain on a random
# site; any site holding 4 or more grains topples, sending one grain to each neighbour (grains that
# leave the edge are lost). Avalanche size s = number of topplings caused by one grain.
# Nobody tunes the pile: driven slowly, it organises itself into a state with avalanches of all sizes.
import math, random

def sandpile(L=48, warm=10000, n=40000, seed=1):
    rnd = random.Random(seed)
    z = [[0] * L for _ in range(L)]
    sizes = []
    for k in range(warm + n):
        i, j = rnd.randrange(L), rnd.randrange(L)
        z[i][j] += 1
        s, stack = 0, [(i, j)] if z[i][j] >= 4 else []
        while stack:
            a, b = stack.pop()
            if z[a][b] < 4: continue
            z[a][b] -= 4; s += 1
            if z[a][b] >= 4: stack.append((a, b))
            for c, d in ((a + 1, b), (a - 1, b), (a, b + 1), (a, b - 1)):
                if 0 <= c < L and 0 <= d < L:
                    z[c][d] += 1
                    if z[c][d] == 4: stack.append((c, d))
        if k >= warm: sizes.append(s)
    return sizes, sum(map(sum, z)) / L ** 2

def mle_tau(xs, xmin):
    """Discrete power-law exponent, Clauset, Shalizi & Newman (2009) approximation, for x >= xmin.
    The approximation is accurate only for xmin of about 6 or more; mle_exact below is exact."""
    t = [x for x in xs if x >= xmin]
    return 1 + len(t) / sum(math.log(x / (xmin - 0.5)) for x in t), len(t)

def hurwitz(tau, xmin, K=2000):
    """zeta(tau, xmin) = sum over k >= xmin of k^-tau: direct sum, then an Euler-Maclaurin tail."""
    s = sum(k ** -tau for k in range(xmin, K))
    return s + K ** (1 - tau) / (tau - 1) + 0.5 * K ** -tau + tau * K ** (-tau - 1) / 12

def mle_exact(xs, xmin):
    """Exact discrete MLE: maximise -tau * sum(ln x) - n ln zeta(tau, xmin) by golden-section search."""
    t = [x for x in xs if x >= xmin]
    n, sl = len(t), sum(math.log(x) for x in t)
    f = lambda a: -a * sl - n * math.log(hurwitz(a, xmin))
    lo, hi, g = 1.01, 3.0, (math.sqrt(5) - 1) / 2
    for _ in range(60):
        a, b = hi - g * (hi - lo), lo + g * (hi - lo)
        if f(a) > f(b): hi = b
        else: lo = a
    return (lo + hi) / 2

if __name__ == "__main__":
    sizes, dens = sandpile()
    pos = [s for s in sizes if s > 0]
    print(f"{len(sizes)} grains after warm-up: mean height {dens:.2f} grains per site; "
          f"{len(sizes) - len(pos)} caused no toppling; largest avalanche {max(sizes)} topplings")
    print("avalanche size   share of avalanches   (logarithmic bins)")
    lo = 1
    while lo <= max(pos):
        hi = lo * 4
        c = sum(1 for s in pos if lo <= s < hi)
        print(f"  {lo:6d}-{hi - 1:<6d}  {c / len(pos):8.4f}  " + "#" * round(60 * c / len(pos)))
        lo = hi
    for xmin in (2, 5, 10):
        tau, m = mle_tau(pos, xmin)
        print(f"maximum-likelihood exponent for s >= {xmin:2d}: exact {mle_exact(pos, xmin):.2f},"
              f" approximation {tau:.2f} ({m} avalanches)")
    top = sorted(sizes)[-len(sizes) // 100:]
    print(f"the largest 1 % of avalanches account for {sum(top) / sum(sizes):.0%} of all topplings")

Single source and citation

Fan, Y. (2026). Credit Cycles, Self-Organised Criticality and the Statistical Physics of Market Phase Transitions (Version 1.0.0), Chapter 2: Sandpiles and the Great Moderation: Self-Organised Criticality. 5D Library. https://doi.org/10.5281/zenodo.23754711

DOI: 10.5281/zenodo.23754711 · Read the monograph · 5DL-B-020 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026020,
  author    = {Fan, Yafu},
  title     = {Credit Cycles, Self-Organised Criticality and the Statistical Physics of Market Phase Transitions},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.23754711},
  url       = {https://doi.org/10.5281/zenodo.23754711}
}

Other chapter answers in this book