Fractals/Iterations in the complex plane/Mandelbrot set/mandelbrot

Speed improvements - optimisationEdit


The Mandelbrot set is symmetric with respect to the x-axis in the plane :

colour(x,y) = colour(x,-y)

its intersection with the x-axis ( real slice of Mandelbrot set ) is an interval :

<-2 ; 1/4>

It can be used to speed up computations ( up to 2-times )[1]

Bailout testEdit

Instead of checking if magnitude ( radius = abs(z) ) is greater then escape radius ( ER):


compute square of ER:

 ER2 = ER*ER

once and check :


It gives the same result and is faster.

interior detectionEdit

Mandelbrot set with Interior detection method

Interior detection method[2]

  • time with detection versus without detection is : 0.383s versus 8.692s so it is 23 times faster !!!!
// gives last iterate = escape time
// output 0< i < iMax
 int iterate(double complex C , int iMax)
   int i=0;
   double complex Z= C; // initial value for iteration Z0
   complex double D = 1.0; // derivative with respect to z 
    { if(cabs(Z)>EscapeRadius) break; // exterior
      if(cabs(D)<eps) break; // interior
      D = 2.0*D*Z;
      Z=Z*Z+C; // complex quadratic polynomial
   return i; 

Period detectionEdit

"When rendering a Mandelbrot or Julia set, the most time-consuming parts of the image are the “black areas”. In these areas, the iterations never escape to infinity, so every pixel must be iterated to the maximum limit. Therefore, much time can be saved by using an algorithm to detect these areas in advance, so that they can be immediately coloured black, rather than rendering them in the normal way, pixel by pixel. FractalNet uses a recursive algorithm to split the image up into blocks, and tests each block to see whether it lies inside a “black area”. In this way, large areas of the image can be quickly coloured black, often saving a lot of rendering time. ... (some) blocks were detected as “black areas” and coloured black immediately, without having to be rendered. (Other) blocks were rendered in the normal way, pixel by pixel." Michael Hogg [3]

 // cpp code by Geek3 
bool outcircle(double center_x, double center_y, double r, double x, double y)
{ // checks if (x,y) is outside the circle around (center_x,center_y) with radius r
        x -= center_x;
        y -= center_y;
        if (x * x + y * y > r * r)

 // skip values we know they are inside
                        if ((outcircle(-0.11, 0.0, 0.63, x0, y0) || x0 > 0.1)
                                && outcircle(-1.0, 0.0, 0.25, x0, y0)
                                && outcircle(-0.125, 0.744, 0.092, x0, y0)
                                && outcircle(-1.308, 0.0, 0.058, x0, y0)
                                && outcircle(0.0, 0.25, 0.35, x0, y0))
                          // code for iteration

Cardioid and period-2 checkingEdit

One way to improve calculations is to find out beforehand whether the given point lies within the cardioid or in the period-2 bulb. Before passing the complex value through the escape time algorithm, first check if:


to determine if the point lies within the period-2 bulb and


to determine if the point lies inside the main cardioid.

another description [4]

         public static void quickRejectionFilter(BlockingCollection<Complex> input, BlockingCollection<Complex> output)
            foreach(var item in input.GetConsumingEnumerable())
                if ((Complex.Abs(1.0 - Complex.Sqrt(Complex.One - (4 * item))) < 1.0)) continue;
                if (((Complex.Abs(item - new Complex(-1, 0))) < 0.25)) continue;
                if ((((item.Real + 1.309) * (item.Real + 1.309)) + item.Imaginary * item.Imaginary) < 0.00345) continue;
                if ((((item.Real + 0.125) * (item.Real + 0.125)) + (item.Imaginary - 0.744) * (item.Imaginary - 0.744)) < 0.0088) continue;
                if ((((item.Real + 0.125) * (item.Real + 0.125)) + (item.Imaginary + 0.744) * (item.Imaginary + 0.744)) < 0.0088) continue;

                //We tried every known quick filter and didn't reject the item, adding it to next queue.

Periodicity checkingEdit

Most points inside the Mandelbrot set oscillate within a fixed orbit. There could be anything from ten to tens of thousands of points in between, but if an orbit ever reaches a point where it has been before then it will continually follow this path, will never tend towards infinity and hence is in the Mandelbrot set. This Mandelbrot processor includes periodicity checking (and p-2 bulb/cardioid checking) for a great speed up during deep zoom animations with a high maximum iteration value.

Perturbation theoryEdit

"The thing we call perturbation consist of 2 things: Calculate one pixel with high precision and use it as a reference for all other pixels.

This method will fail though, however thanks to Pauldelbrot we have a trustable method of detecting the pixels where the reference fails to compute the pixel with hardware precision. These pixels can be rendered with a reference closer to these pixels, so a typical perturbation render use several references. This method gives a speedup at about 10 times on depths of 10^100 Use a truncated Taylor series to approximate a starting value for a specific iteration, which make you able to skip all previous iterations. This method gives a speedup of typically Another 10 times on depths of 10^100, and together the speed up is typically 100 times. This, which we call Series Approximation, is where we have issues since we do not have any solid theoretically way of finding when too many iterations are skipped - for all pixels in the view. The more terms you include in the Taylor series, the more iterations you are able to skip. So if you stay below say 50 terms, it is not likely that you ever encounter any issues. Because some views can be correctly rendered 1000 or 100,000 times faster than full precision for each pixel with many terms - can you imagine a month turned into seconds! shocked K.I.Martin originally used only 3 terms " - Kalles Fraktaler [5]


Very highly magnified images require more than the standard 64-128 or so bits of precision most hardware floating-point units provide, requiring renderers use slow "bignum" or "arbitrary precision"[6] math libraries to calculate. However, this can be sped up by the exploitation of perturbation theory.[7] Given


as the iteration, and a small epsilon, it is the case that




so if one defines


one can calculate a single point (e.g. the center of an image) using normal, high-precision arithmetic (z), giving a reference orbit, and then compute many points around it in terms of various initial offsets epsilon-zero plus the above iteration for epsilon. For most iterations, epsilon does not need more than 16 significant figures, and consequently hardware floating-point may be used to get a mostly accurate image.[8] There will often be some areas where the orbits of points diverge enough from the reference orbit that extra precision is needed on those points, or else additional local high-precision-calculated reference orbits are needed. This rendering method, and particularly the automated detection of the need for additional reference orbits and automated optimal selection of same, is an area of ongoing, active research. Renderers implementing the technique are publicly available and offer speedups for highly magnified images in the multiple orders of magnitude range.[9][10][11]

Newton-Raphson zoomingEdit

One can "use newton's method to find and progressively refine the precision of the location of the minibrot at the center of a pattern. This allows them to arbitrarily select a magnification between the location they started at and the final minibrot they calculate to be at the center of that location."[12][13]





  • 2 independent descriptions :
    • Fast Mandelbrot set with infinite resolution by Sergey Khashin (July 9, 2011)[16][17]
    • perturbation method by K.I. Martin (2013-05-18)[18] ( only use 3 Series Approximation terms )
  • Pauldelbrot's glitch detection method [19]
  • extending Martin's description to handle interior distance estimation too by Claude Heiland-Allen[20]



  1. How to use symetry of set
  2. A Cheritat wiki: Mandelbrot_set#Interior_detection_methods
  3. FractalNet by Michael Hogg
  4. Fractal forums: quick-(non-iterative)-rejection-filter-for-mandelbrotbuddhabrot-with-benchmark/
  5. Fractal Forums > Fractal Software > Help & Support > (C++) How to deep zoom in mandelbrot set?
  6. arbitrary precision at wikipedia
  7. perturbation theory in wikipedia
  8. "Superfractalthing - Arbitrary Precision Mandelbrot Set Rendering in Java by K.I. Martin 2013-05-18". 
  9. "Kalles Fraktaler 2". 
  10. Fast Mandelbrot set with infinite resolution, ver. 2 by Sergey Khashin, July 9, 2011
  11. Perturbation techniques applied to the Mandelbrot set by Claude Heiland-Allen October 21, 2013
  12. newton-raphson-zooming by quaz0r
  13. Newton-Raphson zooming and Evolution zoom method by Dinkydau
  14. pertubation-theory-glitches-improvement - fractal forum
  15. fractalNotes by Gerrit
  16. Fast Mandelbrot set with infinite resolution, ver. 2
  17. Fast calculation of the Mandelbrot set with infinite resolution by Sergey Khashin, October 12, 2016
  18. fractalforums : superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-java
  19. fractalforums - pertubation-theory-glitches-improvement
  20. Perturbation glitches by Claude Heiland-Allen
  21. superfractalthing By K.I. Martin
  22. mightymandel by Claude Heiland-Allen