← Laboratorium Math · experiment

Fractals and complex numbers

Fractal the Mandelbrot set

One rule — z → z² + c — repeated forever. The points whose sequence never escapes form the black shape. Zoom in a million times and beyond: its edge never smooths out, and along the borders spirals, seahorses and tiny copies of the whole are waiting.

Silver
Zoom ×1.00Iterations 250

Tours

Animated flights to the most interesting corners of the set · Esc stops

Controls

wheel, pinch
zoom around the cursor
drag
pan the view
double-click
zoom ×3 (with Shift — zoom out)
click
point's orbit and pin the Julia set
+ −
zoom in / out
← ↑ → ↓
pan
Backspace
previous view
J
Julia set in full screen
P
next palette (Shift — previous)
Enter
orbit of the point in the center
0
starting view
Esc
stop the flight / close the Julia set

How does it work?

One rule, repeated endlessly

Every point of the plane is a complex number c = x + yi, where i² = −1. We start from z0 = 0 and apply the same rule over and over:

zn+1=zn2+c this gives the sequence z₁ = c, z₂ = c² + c, z₃ = (c² + c)² + c, … — the orbit of the point c

Here's how to square a complex number: (x + yi)² = x² − y² + 2xy·i. Geometrically, squaring doubles the angle of the point and squares its distance from zero — that's where all the spirals come from.

Bounded or escaping?

If the orbit stays close to zero forever, the point c belongs to the Mandelbrot set (it's black in the image). But as soon as |zn| > 2 even once, escape to infinity is certain: for |c| ≤ 2 we then have

|z2 + c|≥|z|2 − |c|≥|z|·(|z| − 1)>|z| every step pushes the point even farther out; e.g. c = 0.3 escapes after just 12 steps, while c = −1 jumps between 0 and −1 forever

The color of a point outside the set tells you how fast it escapes. A plain step count gives stair-step bands, so we use the smooth (normalized) iteration count, where n is the escape step:

μ=n + 1 − log2 ( log2 |zn| ) when |z| is squared, log₂ log₂ |z| grows by exactly 1 — the jumps cancel out and the colors flow seamlessly

Self-similarity

Zooming in on the edge, you'll find spirals, seahorses, branches — and everywhere minibrots: small copies of the whole shape, each with its own surroundings. They aren't perfect copies as in the Koch snowflake, only “almost” similar; we call this quasi-self-similarity. Every bulb attached to the big cardioid has its own period: in the cardioid the orbit converges to a single point, in the big disk on the left it jumps between two, and from the branching point of the antenna above a bulb there come out as many arms (counting the one leading to the bulb) as its period.

An infinitely long edge

The edge of the set is so ragged that its length is infinite, and its fractal dimension (Hausdorff dimension) is exactly 2 — the same as a flat surface, even though it's only an “edge” (proved by Mitsuhiro Shishikura in 1998). And yet the whole set fits inside a disk of radius 2.

Julia sets — a map within a map

For a fixed c, we can start not from zero but from any point z0. The points with bounded orbits form the (filled) Julia set. Around 1919, Pierre Fatou and Gaston Julia discovered that there are only two possibilities: if c belongs to the Mandelbrot set, the Julia set is connected (one piece); if not, it falls apart into dust of infinitely many separate points (a Cantor set). So the Mandelbrot set is a map of all Julia sets at once.

Where does the name come from?

Benoît Mandelbrot (1924–2010) was born in Warsaw. While working at IBM, in 1980 he saw the first detailed images of this set on computer printouts (a very rough drawing had already been made in 1978 by Robert Brooks and Peter Matelski). He coined the word “fractal” himself in 1975, from the Latin fractus — “broken.” The name “Mandelbrot set” was given by Adrien Douady and John Hubbard, who studied its most important properties.

Simplifications: the program counts a point as belonging to the set if it hasn't escaped within N steps (N grows with zoom — you can see it in the “Iterations” counter and raise it with the “Detail” slider). Right at the edge, some black pixels actually escape later. We test for escape at |z| > 1000 instead of 2 — it doesn't change which points escape, but gives smoother colors. The computations run on the processor using double numbers (about 16 significant digits), so at a zoom of around 10¹³ the image breaks up. Shading is artificial lighting “from above” computed from the derivative, not a property of the set itself.

Fibonacci in the Mandelbrot set

The bulbs attached to the main cardioid have addresses: the bulb at the point with internal angle p/q (rotation number) has period q, and q arms come out of the branching point of its antenna. The point of the cardioid at angle t is

c=1⁄2 e2πi t − 1⁄4 e4πi t

Between the bulbs p/q and r/s, the largest is (p+r)/(q+s) — this is Farey addition. Following the path

  1. 1/2period 2
  2. 1/3period 3
  3. 2/5period 5
  4. 3/8period 8
  5. 5/13period 13
  6. 8/21period 21
  7. 13/34period 34

we get the periods 2, 3, 5, 8, 13, 21, 34 — the Fibonacci sequence. The ratios 3/2, 5/3, 8/5, 13/8… approach the golden ratio φ ≈ 1.618, and the bulbs themselves converge to the point of the cardioid at angle 1/φ² ≈ 0.381966. The page computes the bulbs' positions exactly using Newton's method.