This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize
for the AI-speak, we are working on rewriting it!
Pi from escape counts at the cusp of the Mandelbrot set
Adam Zettel · September 21, 2026 · written with an agent
Start just right of the cusp, at c=41+ε, and count the steps of z→z2+c until z>2. Multiply the count by ε. It tends to π.
c=41+ε⟹N(ε)ε→π
At c=41 the map has a fixed point at z=21 where its slope is exactly 1, and the
orbit from z=0 climbs toward it in ever smaller steps without ever passing it. Raise c by ε and the fixed
point disappears, but near z=21 each step still moves z only a little. Write
w=z−21: each step is w→w+w2+ε, which for small steps is the
differential equation dw/dn=w2+ε. The number of steps to get through is
∫−∞∞dw/(w2+ε)=π/ε.
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.
[1]lines 19–64
pi =3.141592653589793#| Steps of z -> z^2 + c, from z = 0, until z > 2. For real c > 1/4 it always gets there.defescape_steps(c) {
z =0.0
n =0.0while z <=2.0 {
z = z * z + c
n = n +1.0
}
return n
}
K =5
eps_all =zeros(K)
estimate =zeros(K)
for k to K {
eps =pow(10.0, -2.0* (k +1.0))
eps_all[k] = eps
estimate[k] =escape_steps(0.25+ eps) *sqrt(eps)
}
show estimate
error =abs(estimate - pi)
figure("Steps to escape, times $\\sqrt{\\epsilon}$", "$\\epsilon$", "$N\\sqrt{\\epsilon}$")
xscale("log")
plot(eps_all, estimate, "$N\\sqrt{\\epsilon}$")
plot(eps_all, zeros(K) + pi, "$\\pi$")
test"at c = 1/4 the map has a fixed point at z = 1/2, where its slope 2z is exactly 1" {
z_fixed =0.5assert_near(z_fixed * z_fixed +0.25, z_fixed, 0.0)
assert_near(2.0* z_fixed, 1.0, 0.0)
}
test"at eps = 1e-10 the count times sqrt(eps) is pi to four decimals" {
assert_near(eps_all[4], 1.0e-10, 1.0e-24)
assert_near(estimate[4], pi, 1.0e-4)
}
test"and every hundredfold cut in eps cuts the error about tenfold: it goes like sqrt(eps)" {
for k to K -1.0 {
assert_lt(error[k +1.0], 0.2* error[k])
}
}
# SPDX-License-Identifier: MIT OR Apache-2.0# SPDX-FileCopyrightText: 2026 The Viv authors