During Summer 2026, I worked on three complex-systems models for PHY 351 Independent Summer Research. The project started with Paul Charbonneau's Natural Complexity: A Modeling Handbook (Princeton, 2017), specifically chapters 10, 5, and 8, covering flocking, sandpiles, and earthquakes.

All three models have something in common. The rules governing individual interactions are relatively simple, but once enough interactions happen together, the system starts producing behavior that's much harder to describe.

I wanted to see how far those rules could actually take me. If I know exactly how every particle, agent, or fault interacts with its neighbors, how much can I predict about the system as a whole?

The project ended up taking 162.0 hours across 42 research days, with 188 commits, 150 figures, and 133 Python scripts. I recorded 94 flocking findings, 22 sandpile findings, and 8 earthquake findings.

I also pre-registered nine predictions, meaning I wrote down what I expected before running the measurements. Several were wrong.

The results are published at Where the Law Runs Out, and the code and findings are on GitHub.

What I was modeling

The flocking model comes from Silverberg et al., Physical Review Letters 110, 228701 (2013), which studied the collective motion of people in mosh pits.

It's a system of self-propelled agents moving on a periodic plane. Each agent responds to nearby agents through short-range repulsion and alignment, with noise added to its motion.

The sandpile is Charbonneau's slope model. Sand is added slowly at random locations, and when the slope between neighboring sites exceeds a threshold, the difference is halved. That can trigger another topple, which can trigger another, until the avalanche stops.

The earthquake model is the Olami–Feder–Christensen model, or OFC. Each site accumulates stress and passes a fraction α to each of its four neighbors when it topples. At α = 0.25, the bulk dynamics conserve stress. Below that, stress dissipates.

I built the experiments in Python using NumPy, numba, and matplotlib, with Anthropic's Claude helping with coding and analysis. I documented that assistance in the research log for each session.

I. The flock

The first thing I found was that even the flock's basic speed wasn't quite what the nominal parameter suggested.

Its equilibrium cruise speed is exactly v0 + α/μ, rather than v0.

I also tested whether changing the agents' compactness or the hardness of their repulsion would produce a solid-to-fluid phase transition. At every setting I tested, the change was a smooth crossover instead.

But the part that became much more interesting was collective information.

Can a flock know something its members don't?

I gave every agent its own noisy estimate of a goal direction and measured how accurately the flock could collectively follow it.

The heading error decreased as 1/√N. The predicted log-log slope was −0.5, and I measured −0.523.

That's a pretty good match.

Individual agents can be wrong, but if their errors are independent, the group averages them away. Increasing the number of agents improves the collective estimate without requiring any individual agent to become more accurate.

There was a limit, though.

Once per-agent noise approached σ ≈ 1.3 radians, the averaging began to break down. Between σ = 1.0 and 1.5 radians, accuracy fell from 0.999 to 0.754 to 0.582, while the flock remained cohesive, with coherence Φ falling only from 0.95 to 0.90.

So the agents could still move together while becoming substantially worse at knowing where to go.

I think that's an interesting distinction. Collective coordination and collective accuracy aren't necessarily the same thing.

The more important result came when I correlated the agents' errors.

Instead of independent noise, I introduced a shared component with correlation ρc. Accuracy stopped improving at an N-independent error floor of σ·√ρc.

Adding more agents couldn't remove the shared error.

Misinformation isn't all the same

I tested two kinds of misinformation.

In the first, misinformed agents had uncoordinated, incorrect directions. With half the flock misinformed (f = 0.5), heading accuracy was still 0.998. Even at f = 0.7, it was 0.983.

I checked whether this depended on flock size. At f = 0.40, accuracy was 0.987, 0.995, 0.998, and 0.998 for N = 60, 125, 250, and 500.

It didn't.

Then I changed the misinformation so that the incorrect agents were coordinated around the same wrong direction.

At f = 0.5, accuracy dropped to 0.105. At f = 0.6, it was −0.617. The directional accuracy crossed zero at parity, f = 0.5.

The difference was enormous.

With uncoordinated misinformation, heading accuracy remained 0.998 at f = 0.5 and 0.983 at f = 0.7. With coordinated misinformation, it fell to 0.105 at f = 0.5 and −0.617 at f = 0.6, crossing zero at parity.

The averaging mechanism that makes a group robust against independent mistakes doesn't protect it against correlated ones.

Flock heading accuracy versus misinformed fraction, uncoordinated versus coordinated misinformation
Flock heading accuracy vs misinformed fraction f: uncoordinated ("lost") misinformation keeps accuracy at 0.998 at f = 0.5, while coordinated ("adversarial") misinformation drives accuracy through zero at f = 0.5; the uncoordinated result holds across N = 60–500.

What happens when predators surround the flock?

I added predators and started testing how the flock responded.

Six predators surrounding the flock reduced global coherence to Φ ≈ 0.77, but the resulting sub-flocks maintained internal coherence of 0.997.

The flock wasn't simply becoming disorganized. It was splitting into smaller, highly coordinated groups.

When I placed the predator ring around the flock's predicted position about 2 time units into the future, coherence fell from 0.83 to 0.53.

Then I tried giving agents an escape response.

One approach was to make every agent flee the shared predator centroid. I expected this to help, but at escape weight w = 0.25, coherence fell to 0.275, worse than the no-escape value of 0.530.

It took w ≥ α = 1 to restore coherence.

Locally sensed escape worked better, raising coherence from 0.53 to about 0.83 at best.

That led me to another question: if escape behavior is useful, will evolution discover it?

Evolution doesn't necessarily find the useful behavior

I made escape weight heritable and used capture-and-removal selection.

Starting from a population with no escape behavior, mean escape weight rose from 0 to 0.51 over 400 time units. But it never reached the threshold w = 1 required for effective collective escape.

The population was evolving, but it wasn't crossing the threshold.

When I seeded just 5% of the population with escapers, the behavior established itself and settled around a mixed equilibrium of 60% escapers. Mutation steps around σ ≈ 0.3–0.6 could also get a population across the valley from a no-escape start.

Interestingly, increasing predation eightfold, from 1/tu to 8/tu, only increased the escaper fraction from 0.56 to 0.66.

Escape never became universal.

About a third of the flock could benefit from the collective escape response without carrying the escape trait themselves.

I tested whether the same thing happened with alignment.

It didn't.

With alignment strength as the heritable trait, a high-alignment population starting at α0 = 2 maintained Φ = 1.0 and experienced about 6 captures. A population starting at α0 = 1.0 drifted down to 0.85 and experienced 1391 captures.

But seeding high-alignment agents into a weaker population didn't cause the trait to spread. At seeded fractions of 0.05–0.20, they were diluted away. At 0.50, the fraction only held approximately steady, going from 0.50 to 0.45 with Φ = 0.65.

No mutation step up to σ = 1.0 reached α = 1 in any of the tested seeds.

I think this was one of the more interesting findings from the flocking experiments.

Whether a protective behavior spreads isn't determined only by whether it's beneficial. It also depends on whether agents without the behavior can benefit from agents that have it.

Shared escape can support free riders. Mutual alignment behaves differently.

Vaccination and three dimensions

I also used the flock as a moving contact network to test vaccination strategies.

Targeting agents that recovered slowly performed much better than random immunization.

At 20% immunized, epidemic size was 0.115 compared with 0.233 for random vaccination. At 40%, it was 0.000 compared with 0.095.

The effective threshold was about 0.30–0.35, compared with about 0.50 for random vaccination.

Targeting agents by contact degree didn't outperform random selection. At 20% immunized, degree targeting produced an epidemic size of 0.262 against random's 0.233.

Spatial targeting didn't help either. Its means were within 0.007 of random at 10–30% immunized, and at 46% immunized it produced 0.125 against random's 0.088.

Finally, I extended the flock to three dimensions.

At matched contact degree, a 3-D flock mixed about 1.8× slower than a 2-D flock. None of the point-predator strategies I tested disrupted it, with coherence remaining Φ ≥ 0.99.

II. The sandpile

The sandpile experiments were where I started finding something that didn't fit neatly into a single scaling law.

A sandpile is a useful model of self-organized criticality. You add sand slowly, the system redistributes it through local toppling rules, and avalanches emerge across a range of sizes.

In Charbonneau's slope model, the heights are continuous. A topple occurs when the slope between neighbors exceeds a threshold, and the difference is halved.

The system self-organized to criticality. With bulk conservation, the avalanche cutoff scaled as N2.00. Introducing any bulk dissipation truncated the avalanche distribution.

I also found a discrepancy in the textbook's mean slope. The text states that the mean sits about 7% below the critical slope, but my measurements gave about 16%. Back-calculating from the book's own figure also gave about 16%.

That wasn't the main result, though.

The two-dimensional sandpile was almost one-dimensional

I measured avalanche footprints to see how much space they occupied as they grew.

At L = 96, 128, 192, and 256, the mass-radius dimensions were 1.001, 1.005, 1.013, and 1.017.

Those are remarkably close to 1.

In fact, 98% of top-decile avalanche footprints were only a single bond wide.

Slope-sandpile avalanche footprints colored by first-topple time
Slope-sandpile avalanche footprints (A = 44, 107, 447) are single one-bond lines colored by first-topple time; mass-radius dimension D = 1.02 vs BTW's 2.01 under the same estimator, length ~ A0.99, and first-topple time = 1.00 × distance from the launch site.

The avalanche front also propagated ballistically. First-topple time versus distance from the seed had a slope of 0.998 and correlation of 0.990.

For comparison, I ran the deterministic Bak–Tang–Wiesenfeld sandpile through the same measurement pipeline. Its footprint dimension was 2.01, compared with 1.02 for the slope model.

So this wasn't simply an artifact of the estimator.

The slope model's local rule was producing effectively one-dimensional avalanches even on a two-dimensional lattice.

The reason is that the same bond rule applies in both directions. The 2-D model reduces exactly to the 1-D one.

I checked the native 1-D model directly at N = 512–4096. Its avalanches had D = 1.00, were solid and gap-free, and propagated with first-topple time equal to 1.00 × distance, with correlation 1.00.

There was still a geometric difference. In 1-D, about 93–98% of the avalanche footprint was downhill of the seed. In 2-D, the fronts radiated isotropically.

The conditional exponents also lined up closely.

For 1-D, ⟨E|S⟩ = 1.00, ⟨S|A⟩ = 2.00, and ⟨A|T⟩ = 0.98.

For 2-D, they were 1.00, 1.93, and 0.97.

A scaling law that works for the average but not the whole distribution

This was probably the most interesting result of the entire summer.

As I increased lattice size, several scaling relationships moved toward the values predicted by a simple, single-scale picture.

Between L = 96 and 512, the size-versus-area exponent γ(S|A) increased from 1.89 to 1.95, approaching 2. The area-versus-duration exponent γ(A|T) increased from 0.91 to 0.99, approaching 1.

The energy-versus-size exponent γ(E|S) stayed exactly 1.00 at every tested L.

But size versus duration didn't follow the same pattern. Its exponent stalled between 1.66 and 1.75 instead of approaching 2.

The gap between the scaling relationships grew from 0.066 to 0.183, toward a residual near 0.2. In the native 1-D model, the gap was 0.11.

I wanted to know whether this was just a finite-size effect.

So I measured the avalanche area's moment spectrum across sliding three-size windows.

At window center L ≈ 92, the multifractal drift was 0.219 ± 0.040.

At L ≈ 369, it was still 0.194 ± 0.031.

Extrapolating to infinite size gave 0.169 ± 0.048, about 3.5 standard errors from zero.

Within the largest window, the effective area dimension rose from D(q≈1) = 1.14 for typical avalanches to D(q≈4) = 1.34 for the largest ones.

At L ≈ 92, it rose from 0.96 to 1.18.

That means the typical avalanche and the largest avalanches weren't following the same effective geometry.

Area moment dimension D(q) by lattice-size window and its drift extrapolated to infinite size
Left: area moment dimension D(q) per sliding lattice-size window rises with moment order q at every window. Right: the drift over q in [1,4] stays near 0.2 from L ≈ 92 (0.219) to L ≈ 369 (0.194) and extrapolates to 0.169 ± 0.048 at infinite size (square marker; dotted line = no-drift simple scaling).

The average scaling relationships were becoming more regular, but the distribution's higher moments were still behaving differently.

Checking whether I was measuring a numerical artifact

I ran several controls because this is exactly the kind of result that could come from undersampling or an estimator problem.

First, I increased the number of seeds per lattice.

With 10–12 seeds at L = 192–512, the median avalanche area scaled as approximately L0.90 ± 0.04. The typical footprint dimension stayed between 1.00 and 1.01, about one bond wide up to L = 512.

The mean-area growth slope changed from 1.22 with 5 seeds to 0.99 ± 0.03 with 10 seeds.

So some estimates were sensitive to sampling, but the typical filament geometry remained.

Next, I measured the Manna sandpile using the same pipeline.

At L = 32–128, its toppling dimension D(q) was flat at about 2.68, compared with the literature value of 2.76. Its footprints were compact, with D = 2.06–2.07, and its avalanche size exponent was τ_S = 1.262, close to the literature value of about 1.27.

Manna's moment spectrum had a dip at low moment order, a known kink-rounding artifact.

The slope model's drift was a rise at high moment order.

They were opposite in q-location.

The BTW model also showed a toppling-number spectrum drift of about 0.3, but its footprints were compact.

Together, these checks made the slope model's result more interesting. The typical geometry remained filamentary, while the higher moments continued to distinguish the largest avalanches.

Can I change the geometry without changing the entire model?

I added a parameter that diverted a fraction of each topple's sand to a random transverse neighbor.

As that fraction increased from 0 to 0.5, the footprint dimension rose from 1.0 to 1.87. The L = 128 and 192 measurements overlapped, and the dimension passed 3/2 near a diversion fraction of 0.1.

For reference, the exactly solvable directed sandpile has mass-radius dimension D = 3/2, while BTW has D = 2.

But changing the footprint geometry didn't make the scaling Manna-like.

The area moment drift increased from 0.23 to 0.38 rather than flattening.

The avalanches became more compact, but their scaling remained nontrivial.

Does the angle of repose ever stop increasing?

I also looked at how the sandpile's angle of repose changed with lattice size.

Using seven plateau values from L = 64–512, I compared a logarithmic growth model against a saturating 1/L model.

The logarithmic model performed better, with ΔAIC = 9.7 and R² = 0.990 versus 0.960.

Then I froze both models and ran new simulations at L = 768 and 1024.

The measured repose values were 2.7827 ± 0.003 and 2.8177 ± 0.006.

Both were above the saturating model's own infinite-size ceiling of 2.754.

The frozen logarithmic prediction landed within 0.03–0.04 of both new points. Refitting all nine points gave ΔAIC = −15.1.

So the proposed 1/L saturation was ruled out by the new measurements.

That doesn't prove the true asymptotic form is log L. Something slower, like log log L, could still fit at larger scales. Testing that would require lattices around L ≈ 2048 or larger.

III. The earthquake model

The final system was the Olami–Feder–Christensen earthquake model.

Each site accumulates stress until it topples, redistributing a fraction α to each of its four neighbors.

At α = 0.25, stress is conserved in the bulk. Below that, some is lost with each redistribution.

I first reproduced the Gutenberg–Richter behavior.

At α = 0.25, 0.20, and 0.10, I measured slopes of −1.19, −1.87, and −3.52.

The textbook values were −1.19, −1.92, and −3.34.

The avalanche cutoff scaling dimension was D = 3.19 at α = 0.25, 1.95 at α = 0.20, and −0.15 at α = 0.10, where the cutoff was effectively flat because of dissipation.

Then I started looking at recurrence.

A deterministic earthquake model can synchronize

The nonconservative OFC model developed recurring behavior.

At α = 0.10, 0.15, and 0.20, I measured raw recurrence periods of 12800, 10600, and 7000 iterations.

At α = 0.25, there was no recurrence peak.

I pre-registered a test where I jittered α by ±0.01 on each topple.

The recurrence peak survived, but its height fell to 44% of the fixed-α value. The largest avalanche shrank from 433 to 252.

That suggested there was a predictable component to the dynamics, so I wanted to see whether I could use it to forecast large events.

Forecasting earthquakes when I know every rule

I ran an OFC system with N = 128 and α = 0.15 for 1,161,098 iterations.

I trained a recurrence-based forecaster on the first half, where it learned a cycle of 10400 iterations.

Then I used it to forecast the second half.

There were 428 large test events, and the forecaster made 56 predictions.

At a ±300-iteration window, precision was 0.68 against a chance baseline of 0.44, about 1.5× chance.

At ±100 iterations, precision was 0.25 against 0.15, about 1.7× chance.

So there was genuine forecasting skill in the model.

But precision only tells part of the story. I also measured how many actual large events the predictions caught.

At ±100 iterations, recall was 14/428 = 0.033, compared with chance recall of 0.019, or 1.70×.

At ±300, recall was 50/428 = 0.117, compared with 0.058, or 2.02×.

The forecaster was doing better than chance, but it was still missing most large events.

Are the very largest earthquakes more predictable?

I separated out the largest decile of events.

That left 43 events.

At ±100 iterations, recall was 2/43 = 0.047, with a 95% confidence interval of 0.013–0.155. That was 2.41× chance.

At ±300, recall was 4/43 = 0.093, with a 95% confidence interval of 0.037–0.216. That was 1.61× chance.

The interesting thing was that the ordering reversed depending on the window.

At ±100, the largest decile looked more predictable relative to chance than the overall large-event population, 2.41× versus 1.70×.

At ±300, it looked less predictable, 1.61× versus 2.02×.

And at both windows, the confidence interval for the top-decile recall contained the all-events recall rate.

There wasn't enough evidence to say that the largest events were more or less predictable than large events generally.

This matters because the model has no hidden variables and no observation noise. The rules are fully known to the forecaster.

Even in that setting, knowing the mechanism and learning its recurrence structure only produced about 1.5–2× chance forecasting skill, spread across the event population rather than concentrated in the largest events.

The top-decile sample was small enough that its rate was only pinned down to roughly a factor of six.

One possible explanation is that the largest events correspond to irregular, drifting domain collapses, but I haven't measured that directly.

What I think the three models show

I started this project with three systems whose microscopic rules were completely specified.

The results ended up pointing toward three different relationships between those rules and the collective behavior they produced.

In the flock, independent errors canceled out. A large group could estimate a direction much more accurately than its individual members, but correlated errors defeated that advantage. The limiting factor wasn't the number of agents. It was the structure of their information.

In the sandpile, the mean obeyed an exact spatial scaling law. Avalanche footprints were effectively one-dimensional and propagated ballistically, with 98% of top-decile footprints remaining a single bond wide.

But the higher moments of the area distribution didn't collapse onto the same simple scaling picture.

That result survived the sliding-window finite-range check, the doubled-seed undersampling check, and the Manna comparison.

The average behavior could be described by a clean law while the largest events continued to carry different scaling information.

In the earthquake model, I found something different again.

The system synchronized, and its recurrence structure made forecasting possible. But the forecasting advantage stayed around 1.5–2× chance across the tested windows and populations.

The largest events didn't show a statistically distinguishable advantage or disadvantage.

So I don't think these three systems support one universal explanation for why collective behavior becomes difficult to predict.

The sandpile gave me a measured tail result. The earthquake model gave me a null result for preferential predictability of the largest events. The flock gave me a separate mechanism based on independent versus correlated information.

That's an important distinction.

It would be easy to look at all three and say that complex systems are unpredictable because small interactions create complicated behavior. But that explanation doesn't really tell us much.

In one system, adding more agents improves accuracy. In another, typical behavior becomes geometrically simple while the distribution remains multifractal. In the third, deterministic recurrence gives a modest forecasting advantage without making the largest events especially predictable.

The mechanisms are different.

What I'd like to investigate next

The sandpile is the one I'd most like to push further.

The angle-of-repose measurements ruled out the tested saturating 1/L model, but they didn't establish the exact asymptotic growth law. Larger lattices around L ≈ 2048+ would help distinguish logarithmic growth from slower alternatives.

I'd also like to extend the comparison with Manna. I measured Manna through L = 128, while the slope model reached L = 512. Its flat moment spectrum and compact footprints were stable across L = 32–128, but extending that comparison would be useful.

For OFC, the biggest open question is whether the largest events really correspond to irregular domain collapses that drift away from the synchronized recurrence structure. That's a plausible explanation, but right now it's an interpretation rather than a measured result.

The thing I took away from the summer is that knowing the rules and knowing the outcome are two very different kinds of knowledge.

Every one of these systems was built from rules I could inspect directly. I could change a parameter, rerun the simulation, and measure what happened.

Sometimes the result was almost exactly what the mathematics predicted. The flock's −0.523 averaging slope against −0.5 is a good example.

Other times, a simple relationship held for one part of a system but failed to describe another.

I think that's what made the project interesting to me. The question wasn't whether the systems followed their rules. They always did.

It was how much those rules actually allowed me to know.


Project: PHY 351 Independent Summer Research, Summer 2026

Research: Where the Law Runs Out

Code and findings: github.com/ninjahawk/swarmsim

Textbook: Paul Charbonneau, Natural Complexity: A Modeling Handbook (Princeton, 2017), Chapters 5, 8, and 10.

Flocking reference: Silverberg et al., Physical Review Letters 110, 228701 (2013).