Algorithms, Fractals – Continuous Coloring of a Mandelbrot Fractal

algorithmsfractals

I've recently started making a small fractal app in Javascript using the famous Mandelbrot bulb $(z = z^2 + c)$. I've been trying to find the best method of coloring the points on the complex plane, and I've come across some very interesting ideas:

http://linas.org/art-gallery/escape/escape.html

http://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/Mandelbrot_set#Real_Escape_Time

So I've been focusing on this "normalized iteration count algorithm" and I've run into a small mental hurdle sorting out what needs to be calculated. Basically, I'm confused about the first equation that shows up in that second link. Assuming we have a complex number $Z$ which is the end result of $n$ iterations. I can't quite figure out what "Zx2" or "zy2" is and how how one might add them together or take the square root of their sum. Is that just shorthand for some basic complex operators, or is there something else going on? Basically, my problem is that I'm not particularly good at reading mathematical notation in this area.

Anyway…any directional guidance you can offer would be extremely helpful. Thanks in advance!

Best Answer

Based on the C code given there, Zx is just the real part $\Re z$ and Zy is just the imaginary part $\Im z$.

Remember that the complex iteration formula for the Mandelbrot set

$z=z^2+c$

when expanded to real variables looks like

$x=x^2-y^2+u$

$y=2xy+v$

where $z=x+iy$ and $c=u+iv$.

The variables with a 2 appended are the squares, as can be seen from how they were defined, so for instance $|z|=\sqrt{x^2+y^2}$ is sqrt(Zx2+Zy2) which is used for determining how much the iteration diverges (escapes to infinity), which is used by the coloring functions.