The Mandelbrot set
The Mandelbrot set consists of points, c, in the complex plane
that obey the following rule
-
Start with the complex number z = a + ib where a and b are real
numbers.
-
Generate a new complex number, z', by multiplying z by
itself and adding the result to c. z' = z2 + c.
-
Repeat steps 1 and 2. If the complex number z goes toward
infinity, then the starting point, c, is not a member of the
Mandelbrot set. All numbers that remain bounded are members of the set.
It can be shown that if the magnitude of z is greater than 2
, then z will approach infinity. The code assumes that the number c
is in the set if |z| > 2 after 256 iterations. In order to show
how rapidly a number fails the test, we color the pixel corresponding to
the number of iterations.