Computer Laboratory

ECAD and Architecture Practical Classes

The Mandelbrot Set

Mandelbrot Set

The Mandelbrot set is the set of complex numbers for which the iteration zn+1 = zn2 + z0 does not diverge. Divergence is known to occur if |zn| > 2 for some n. In what follows, we take complex numbers z = x + yi as coordinates (x,y).

We will use a 4.28 fixed point scheme to approximate real numbers as integer (I) and fractional (F) parts.

31 - - - 27 - - - - - - - - - - - - - - - - - - - - - - - - - - 0
     I                              F
31 - - - 27 - - - - - - - - - - - - - - - - - - - - - - - - - - 0

The following summarises 4.28 fixed point arithmetic:

conversion from real number
A real number q is converted to 4.28 fixed point by the function
to_fp(q) = floor(q * 2^28)
addition
equivalent to real numbers
multiplication
For two real numbers p and q, it can be shown that
to_fp(p*q) ~= (to_fp(p) * to_fp(q)) / 2^28
Some rounding errors will be produced, but these will not have a significant effect On the rendering of the Mandelbrot set.
Previous  |  Contents  |  Next