As you're probably all aware, a Mandelbrot Set is created by iterating over pixels as though they were coordinates on the real and imaginary planes. Each pixel then has a real and an imaginary part (like all complex numbers) which can be fed into an iterative loop of its own:
$ z = z^2 + c $
c are complex numbers,
z starts at
c is the value of our pixel. If you run this a bunch of times, the squared modulus of
|z|) will either stay below a limit you set (6 in my fractal drawer) or it will go above the limit. If it goes above the limit, you break the iteration and consider that pixel to be outside of the set. When this happens, you color that pixel a certain color depending on how big
|z| has gotten and how many iterations it took to determine that it's outset the set. (See more on the formula used in my drawer here: Continuous coloring of a Mandelbrot fractal)
So given all this, we can say that a higher max iteration value will tell you with greater precision whether or not a point is in the set. It will also take more time to run because it's doing more calculations per pixel. There are also other visual factors...
If you start at a full zoom out and run the plot with a maxIterations value of 50, 100, and 300, you get this:
So you can see that while the detail of the edge of the set does get better as you increase the maxIterations value, the pixels outside the set are almost all red. At this zoom level, I'd say something like 50 iterations would be an ideal balance of color variation and edge detail.
Now if you zoom in to some arbitrary level keeping 50 maxIterations, you will begin to see something like this:
The detail is horrible and the colors are also a bit homogeneous. So let's see what happens if we keep the same zoom level and change the maxIterations number to 80, 120, 250, 500, 1000, and 2000 (remember, the coordinates and zoom are exactly the same in all images, the only difference is the maxIterations value):
As usual, increasing the maxIterations value too much leaves most of the points outside of the set red. Here I'd say something between the second (120 maxIterations) and third (250 maxIterations) is more or less ideal.
This is all relatively simple to do one image at a time with your eye and some tinkering, but this would be very difficult to do if I were to create a zoom like this: http://vimeo.com/1908224. I'd need some method of finding something like an ideal maxIterations value depending on the zoom level.
So after all of this, my question is: is there some such method? If not, where might I start to look in order to figure this out for myself? Am I thinking about this wrong? Is there a more obvious solution that I'm missing?
Thanks in advance!