...
running...
The science
A fractal tree is a self-similar recursion: a trunk of length L₀ ends in two children rotated by ±θ and scaled by r, and each child does the same. At depth k there are 2ᵏ branches of length L₀rᵏ.
N(D) = 2^(D+1) − 1 total length = L₀ · Σ_{k=0..D} (2r)^k = L₀ ((2r)^(D+1) − 1)/(2r − 1)
The sum shows the key threshold r = 1/2: below it the total length converges as depth grows, above it the tree's wood length diverges (each generation has more length than the last). The tree's fractal (similarity) dimension is d = ln 2 / ln(1/r), which is 1 at r = 1/2 and approaches 2 (space filling) as r → 1/√2 ≈ 0.707. Real trees follow Leonardo's rule (the cross-section area is conserved at a split, i.e. r ≈ 2^(−1/2)), which is why many measured values sit near 0.7.
Simplifications: this is a pure geometric model with no gravity, light competition or branch thickness physics; thickness here just scales linearly with length. Wind is a cosmetic sinusoidal rotation. The numerical check recounts every segment drawn by the recursion and compares with the formulas above.
What is checked and why you can trust it
Every time the page loads, and whenever you press Re-run check, the simulation evaluates its own mathematics against an independent reference, such as a closed-form formula, a finite-difference derivative or an exhaustive count. Each line above reports PASS or FAIL together with the measured numbers, so you can see by how much it agrees. Results are also published on window.__msChecks for automated testing. The check never uses the same code path as the animation it validates, otherwise it would only confirm itself.
How to read a failure: a FAIL line means the measured discrepancy exceeded the stated tolerance for the current slider values. Try Reset, then move the sliders back toward their defaults; if a check still fails at the defaults it is a bug worth reporting. Tolerances are chosen from the numerical method itself, never tuned to make a test pass: round-off level (1e-9) for exact algebra, about 1e-3 for finite differences and Monte Carlo estimates with a few hundred thousand samples, and a documented margin for stochastic learning runs.
Reproducibility: the particle and pen simulations use the browser random generator for initial positions, so exact pixels differ between visits, but the checks depend only on mathematics and not on those positions. Fixed wave tables (curl noise) and fixed grammars (L-system) are deterministic.
This is an educational model. It shows the mechanism clearly, but it is deliberately simplified; the science panel lists what was left out.