1618.dev

small tools, one committed a day

Mandelbrot Set Explorer

The Mandelbrot set is the picture you get by asking, for every point c on the complex plane, one question: if you start at zero and keep applying z → z² + c, does the number stay bounded forever (black, in the set) or does it fly off to infinity (coloured by how fast it left)? That one rule draws an endlessly detailed boundary. Drag to pan, scroll to zoom, and click any point to inspect its orbit.

centre span zoom

Scroll to zoom toward the cursor · drag to pan · double-click to zoom in · single-click to inspect a point. On a touch screen, tap to inspect and pinch-free zoom with the buttons below.

What you are looking at

Take any complex number c = x + iy and run the feedback loop z0 = 0, zn+1 = zn² + c. Two things can happen. Either the numbers stay corralled near the origin no matter how long you iterate — then c belongs to the Mandelbrot set, and we paint it black — or they eventually break free and race off to infinity, and we colour c by how many steps that escape took. The black body is the set itself; all the colour is the outside, banded by escape speed.

The escape-time rule (and why 2 is magic)

|z| > 2  ⇒  the orbit will diverge — stop iterating

You never have to iterate to infinity. There is a clean theorem: once the magnitude of z ever exceeds 2, the orbit is guaranteed to blow up, so we can stop the moment |z| > 2 and record the step count. Points that survive the whole iteration budget (the max iterations slider) without crossing 2 are treated as being in the set. Raise the budget and the boundary sharpens, especially deep in a zoom — at the cost of more work per pixel.

Smooth colouring

μ = n + 1 − log2( log |z| )

The bare integer escape count produces ugly colour bands — every pixel that escapes on step 37 gets exactly the same colour. The fractional normalised iteration count μ above interpolates between steps using how far past the bailout the orbit overshot, giving the silky, band-free gradients you see. This page colours by μ, fed through a cosine palette.

A boundary you can fall into forever

The Mandelbrot set is connected — one single piece, no islands floating free (every tiny "mini-Mandelbrot" you find on a zoom is tethered to the main body by filaments too thin to see). Its area is finite but its boundary is infinitely long and has fractal dimension 2: keep zooming and you keep finding new spirals, seahorse tails, and shrunken copies of the whole set. The Mini-Mandelbrot and Tendrils shortcuts above drop you straight into that endless detail.

The Mandelbrot–Julia connection

Each point c here is also the recipe for a whole other fractal — its Julia set, the picture you get by fixing that same c and iterating over every starting z instead. Pick a c inside the Mandelbrot set and its Julia set is one connected blob; pick one outside and the Julia set shatters into dust. In that sense the Mandelbrot set is an index of all Julia sets at once. (A Julia explorer is on the way as a sibling tool.)

How this page is built

The math lives in logic.py — the escape iteration, the |z| > 2 bailout, the smooth-μ formula, and the quick interior tests for the main cardioid and period-2 bulb. The full picture is drawn in JavaScript on a canvas (hundreds of thousands of pixels per frame is too much to push through Python), but the same Python is what the point inspector calls, point by point, so the numbers under your cursor come straight from the source of truth.