ana MANDELBRACT
twist into w
anakata

c movesbothz₀ moves
Tan Lei:
can it be done?

The Mandelbrot set lives in the complex numbers, and the complex numbers are special: a plane you can add, multiply and divide in. The Mandelbulb was the search for a 3D version, and it had to cheat, because no such number system exists in three dimensions. In four there are the quaternions, the only other one (Frobenius, 1878), but they are the wrong kind: their Mandelbrot set is just the flat one spun round.

So "the Mandelbrot set in 4D" is four different things, each giving something up. Switch between them above. The first is the honest one and, in a way, the oldest: the Mandelbrot set was always a slice of a four-dimensional object. Its other slices are the Julia sets.

Solid shows the 3D slice your frame cuts. Plane shows the 2D slice through the middle of your view, the familiar picture. Cut open takes away the half of the solid toward you, so the cut face is that same plane. The pad twists your slice into w and the lever moves it ana and kata, as in HILBERT⁴. Double-tap to fly to a point. Keys: J L I K twist, R F move, V swaps the view, C cuts it open, Z squares up.

Tan Lei's twist

Zoom into the Mandelbrot set at a Misiurewicz point, a c whose orbit from 0 lands, after a few steps, on a repelling cycle (c = i: 0, i, −1 + i, −i, −1 + i, …). In 1990 Tan Lei proved that the closer you look, the more the Mandelbrot set there looks like the Julia set of that same c, looked at in the same place, up to a scale and a turn.

In four dimensions this is one fact. Near a point P of the (c, z₀) set, after many steps zₙ ≈ zₙ(P) + A·δc + B·δz₀, so the set near P is a pattern in u = A·δc + B·δz₀ and nothing else: the same all along the line where u doesn't change. Any plane through P that moves c and z₀ together, at an angle θ from "c moves" to "z₀ moves", sees that one pattern, scaled and turned by A cos θ + B sin θ. The plane z₀ = c is the Mandelbrot set again (start at c, and you're at step 1 of starting at 0); θ = 90° is the Julia set. Theirs are two views of one pattern.

Press a Tan Lei point, then slide the plane. With hold the pattern on, the page undoes the scale and turn, and the picture stays put while the plane swings through 4D from the Mandelbrot set to the Julia set. Turn the hold off and watch the pattern grow and spin instead. Zoom further in and it holds better: the theorem is about the limit. Measured in the selftest: at a window 10⁻⁴ across, the planes at 0°, 60° and 90° match the Mandelbrot plane pixel for pixel (IoU ≥ 0.95) at all four points, and the unheld Julia plane doesn't.

how it's drawn

Each set has a distance estimate: from the orbit's escape speed and its derivative, a lower bound, near enough, on how far a point is from the set. In four dimensions it bounds the distance within your slice too, so the shader sphere-traces your slice by it: step a fraction of the estimate, again, until it's under a pixel. For (c, z₀) the derivative is both ∂z/∂c and ∂z/∂z₀, since z depends on both holomorphically. The bicomplex estimate is the two Mandelbrot sets' estimates combined as a product. The surface's colour is how close the orbit came to 0, or (by w) whether the set carries on ana or kata of your slice there.

Iterations rise as you zoom (30 more per factor of ten) unless you turn that off. Single precision: zoom past about 10⁴× and the picture breaks up into blocks, so the zoom stops at 2 × 10⁴. The address bar always holds where you are: share this view copies it.

Checked: test/mandelbract.selftest.mjs holds the (c, z₀) set to the Mandelbrot set on z₀ = 0 and to known Julia sets on c = 0 and c = −2; the bicomplex orbit to the two complex orbits, exactly; the quaternion set to turning symmetry; the hyperbulb to its invariant w = 0 subspace and mirror symmetry; every estimate to being safe to march by (measured); and the march to stopping on the edge.