Fractal Colorings

Last time, we saw some fairly primitive images of the Mandelbrot set. In particular, the coloring scheme was somewhat gaudy — there were noticeable discrete bands in all the images. The reason for this was in the code, where I had set the value of each pixel to be whichever integer we escaped at, creating a discrete range of possibilities. Luckily, there are fancier methods of coloring which smooth out these discontinuities. While there are a ton of different implementations out there, I’m just going to mention two: Hubbard-Douady Potential, and the Normalized Iteration Count.

In the Hubbard-Douady method, we treat the Mandelbrot set as though it is an electric field and consider the corresponding electric potential that it induces. This function turns out to be \phi(z) = \lim_{n \rightarrow \infty} \frac{\log|z_n|}{2^n} , where z_n is the value of z after iterations. So one option for smoother coloring is to assign to pixel z the value of \phi(z) , or an approximation for a large value of n. Here’s an example.


In the Normalized Iteration Count, we try to come up with a corresponding continuum to the different integer range that we had specified before. There are a few variants of this formula, but the simplest is given by mapping each point to the real number r = n - \log_2(\frac{\log|z_n|}{\log R}) , where R is the bailout radius and z_n is the first iteration value that escapes the disk of radius R centered at the origin. (One way to understand this is to see that this is equivalent to choosing a real value r which satisfies \frac{\log R}{2^r} = \frac{\log|z_n|}{2^n} .) This formula will give us real numbers r in the interval [0, n) so that upon division by n we get a standard color mapping. Here are a couple examples.


Finally, here’s another spinning Julia video, but with a continuously modified smooth color scheme. I’ve mostly used my own variant of the Hubbard-Douady method in this particular piece.