I've created a JavaScript-based fractal drawer which you can see here:


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 $

Where both z and c are complex numbers, z starts at 0, and c is the value of our pixel. If you run this a bunch of times, the squared modulus of z (|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:

mandelbrot full zoom out with max iteration values of 50, 100, and 300

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:

arbitrarily zoomed set at 50 maxiterations

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):

zoomed in changing only the number of maxIterations

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!

  • $\begingroup$ It looks like you are assigning colors based on breakpoints that scale (linearly?) with the maximum number of iterations. That is why the whole rectangle goes red at high iteration limits. You might want to go ahead and calculate with a high limit, then think about where the color breaks go. Say choose red for the fastest 10% of the pixels, yellow for the next 10%, etc. Or look at the width of bands (which may not be easy). $\endgroup$ Commented Jan 10, 2011 at 20:42
  • $\begingroup$ @Ross thanks for the idea...I actually hadn't thought of this. I will try to get it implemented tonight or tomorrow. $\endgroup$
    – treeface
    Commented Jan 10, 2011 at 22:11
  • $\begingroup$ See: en.wikibooks.org/wiki/Fractals/Mathematics/Numerical#Zoom Remember also about precision of numbers you use : en.wikibooks.org/wiki/Fractals/Mathematics HTH $\endgroup$
    – Adam
    Commented Oct 14, 2012 at 19:08

6 Answers 6


As this graph shows, the behaviour of normalized iteration counts of points near the Mandelbrot set varies widely, indicating that attempts at a formula based on scale factors is doomed to fail.

Families of points in the Mandelbrot set

In any case the ideal number of iterations is infinite. For views with no interior regions visible it is preferable to structure computations such that they can be incremental without a fixed iteration limit, as all pixels will escape eventually. For views with interior regions visible one needs a limit, but this can be set dynamically by considering the behaviour of the pixels - maybe keep doubling the limit until no more pixels have escaped. Interior checking can help speed this up.

How to colour the iterations once you have calculated them is an aesthetic matter that has been addressed by the accepted answer. I do also recommend distance estimation as a way to make filaments uniformly visible.


fractal colouring for deep zooms I have rendered such as e214 and "last lights on" have the palette applied in a loop, so it repeats every X number of iterations. can you colour it like that? If I find the journey of an animation has areas where contrasting colours are too far apart, then I increase the speed of the palette. ie: lower the value of X. - Then any change in the overall iteration value will not change the colour placement.


  • $\begingroup$ Thank you for taking the time to answer! I'm curious if you could expound a bit on what you mean by applying the palette in a loop? When you say "X number of iterations", what do you mean by "iterations"? Thanks again for helping out :-] $\endgroup$
    – treeface
    Commented Jan 10, 2011 at 22:32
  • 1
    $\begingroup$ The fractal is made up from iterations - assign a a colour to each iteration. So say if you have 256 colours in your palette, you could repeat the palette every 256 iterations of the fractal formula but how you would go about this in javascript im not sure.... $\endgroup$
    – fractal
    Commented Jan 11, 2011 at 0:36
  • 1
    $\begingroup$ the link is broken $\endgroup$
    – ar2015
    Commented Sep 29, 2017 at 6:48
  • 1
    $\begingroup$ This is not answering the original question as to what would be the minimum nr of required iterations for a given zoom level.... $\endgroup$ Commented Jan 2, 2018 at 19:10

If I understand you correctly, you are asking "what is the formula that tells you how many iterations to do to get the Mandelbrot set to have a 'nice' resolution at some given level of magnification?"

  • "I'd need some method of finding something like an ideal max Iterations value depending on the zoom level" is not a well phrased question; for one thing, the concept of "ideal max iterations" is not well defined and could mean different things for different people.

  • There is no easy way to make the video like the one you linked to, and I'm sure it took a very long time to make that one because each frame had to be resolved one at a time and then put back together. I have no way of knowing for sure, but I have always assumed that video was made by determining how many iterations for each frame (zoom level) to do one frame at a time, by trial and error.

That being said, I believe that the rapidity for which one point on the set converges has little/no effect on the convergence properties of many other points in the set which lie very close in distance; and therefore I don't expect that the formula you are looking for will exist.

The problem is that some regions (and some sub regions...) of the set require more iterations to resolve in a nice way than others.

However, if you included some additional information such as specifying the path you took as you zoomed in on the set, then it would probably be possible to find a formula that accomplishes the thing you are trying to do. I say this last point based only from my personal experience playing around with ChaosPro, not for any major theoretical reason.


This works pretty well, but don't ask me how I came up with it.

$maxItValue=\sqrt{ 2 \cdot \sqrt{\lvert 1-\sqrt{5\cdot scale}\rvert}}*66.5$

  • $\begingroup$ What is scale in this formula? Does this work at extreme depths? $\endgroup$
    – Jordan
    Commented May 23, 2012 at 13:39
  • $\begingroup$ @Jordan Don't ask about free variables, either, I guess. :) $\endgroup$
    – Kaz
    Commented Jun 30, 2016 at 19:49
  • 3
    $\begingroup$ This really doesn't work. I assumed scale meant magnification, because that was the only way I got anything useful out of this. It sort of works for zooming half-way through double precision, but it gets too high by a factor of 10 by the time the magnification is too high for double (~2^44). For anything even a little deep (~2^200), this produces numbers larger than int can handle. It's ridiculous. $\endgroup$
    – Byte11
    Commented Oct 31, 2017 at 22:14

Maybe this article is useful in this respect: http://mrob.com/pub/muency/automaticdwelllimit.html and there was also this piece of advice: https://stackoverflow.com/questions/31871652/calculate-a-dynamic-iteration-value-when-zooming-into-a-mandelbrot

Experimentally, this one worked quite OK for me:

nr of iterations = 50+log10(((4/abs(diff(xlims)))))^5

where xlim is the X axis (real part) range...


For me, experimentally, this one works pretty good for most of the set (up to resolution of double):

maxIter = 50 * (log10(scale))^1.25

where scale is pixelWidth/complexPlaneWidth e.g. 1280/5

  • 2
    $\begingroup$ You can keep coming up with random functions to approximate lower depths, but there really isn't any robustness to this formula. It's just arbitrary. $\endgroup$
    – Byte11
    Commented Dec 4, 2017 at 0:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .