[<< wikibooks] Fractals/Iterations in the complex plane/MandelbrotSetExterior
Colouring of exterior of Mandelbrot set can be :

non-smooth :
Boolean/binary Escape Time Method   ( bETM/M )
discrete = Level Set Method =  LSM/M = iETM/M
Smooth  :
radial measures
Real Escape Time Method( rETM/M )
Distance Estimation Method( DEM/M )
radius of complex potential = Complex Potential Method ( CPM/M )
angular measures
argument of complex potential
SAC = stripe average coloring
other
"triangle inequality"
Orbit trap One can also draw curves : 

external rays
equipotential lines ( closed curves - quasi circles)
Similar projects:

Mandelbrot Notebook by Claude Heiland-Allen 
mandelbrot-book
mandelbrot-book/book : one file c programs , images and description
fork of the mandelbrot-book and book in pdf format
different drawing techniques and algorithms by Arnaud Cheritat 
Mandelbrot set and example C programs ( not by A Cheritat)
Linas Vepstas' Art Gallery:
original site
fork at gitlab


== Escape time or dwell ==
Here for given point c on parameter plane one checks how critical point 
  
    
      
        z
        =
        0.0
      
    
    {\displaystyle z=0.0}
   behaves on dynamical plane under forward iteration.  If you change initial point you will get different result To draw given plane one needs to check/scan (all) its points. See here for more details ( optimisation)
Read definitions first.


=== Boolean escape time ===
This algorithm answers the question: “For which values of c will the Julia fractal, J(c), be line-like and for which dust-like?”Here complex plane consists of 2 sets : Mandelbrot set 
  
    
      
        M
        
      
    
    {\displaystyle M\,}
   and its complement 
  
    
      
        
          M
          
            c
          
        
        
      
    
    {\displaystyle M^{c}\,}
   :

  
    
      
        
          C
        
        =
        M
        ∪
        
          M
          
            c
          
        
      
    
    {\displaystyle \mathbb {C} =M\cup M^{c}}
  


==== ASCI graphic ( on screen) ====

Comparison programs in various languages 


==== Graphic file ( PPM ) ====
Here are various programs for creating pbm file 
GLSL using shadertoy
short c programs by ed Burke


===== C =====
This is complete code of C one file program. 

It makes a ppm file which consists an image. To see the file (image) use external application ( graphic viewer).
Program consists of 3 loops:
iY and iX, which are used to scan rectangle area of parameter plane
iterations.For each point of screen (iX,iY) it's complex value is computed c=cx+cy*i.
For each point c is computed iterations of critical point 
  
    
      
        
          z
          
            0
          
        
        =
        
          z
          
            c
            r
          
        
        =
        0
        
      
    
    {\displaystyle z_{0}=z_{cr}=0\,}
  
It uses some speed_improvement. Instead of checking :

sqrt(Zx2+Zy2) 5.


=== Decomposition of exterior of Mandelbrot set ===
Decomposition is modification of escape time algorithm.
The target set is divided into parts (2 or more). 
Very large escape radius is used, for example ER = 12.


==== Binary decomposition of LSM/M ====

Here target set 
  
    
      
        T
        
      
    
    {\displaystyle T\,}
   on dynamic plane  is divided into 2 parts (binary decomposition = 2-decomposition ):

upper half ( white) 
  
    
      
        
          T
          
            u
          
        
        =
        {
        z
        :
        
          |
        
        z
        
          |
        
        >
        E
        R
         
         
        
          
            and
          
        
         
         
        I
        m
        (
        z
        )
        >
        0
        }
        
      
    
    {\displaystyle T_{u}=\{z:|z|>ER~~{\mbox{and}}~~Im(z)>0\}\,}
  
lower half (black) 
  
    
      
        
          T
          
            l
          
        
        =
        {
        z
        :
        
          |
        
        z
        
          |
        
        >
        E
        R
         
         
        
          
            and
          
        
         
         
        I
        m
        (
        z
        )
        ≤
        0
        }
        
      
    
    {\displaystyle T_{l}=\{z:|z|>ER~~{\mbox{and}}~~Im(z)\leq 0\}\,}
  Division of target set induces decomposition of level sets 
  
    
      
        
          L
          
            n
          
        
        
      
    
    {\displaystyle L_{n}\,}
   into 
  
    
      
        
          2
          
            n
            +
            1
          
        
        
      
    
    {\displaystyle 2^{n+1}\,}
   parts:

  
    
      
        
          L
          
            n
            ,
            u
          
        
        =
        {
        c
        :
        
          |
        
        
          z
          
            n
          
        
        
          |
        
        >
        E
        R
         
         
        
          
            and
          
        
         
         
        I
        m
        (
        
          z
          
            n
          
        
        )
        >
        0
        }
        
      
    
    {\displaystyle L_{n,u}=\{c:|z_{n}|>ER~~{\mbox{and}}~~Im(z_{n})>0\}\,}
   which is colored white,

  
    
      
        
          L
          
            n
            ,
            l
          
        
        =
        {
        c
        :
        
          |
        
        
          z
          
            n
          
        
        
          |
        
        >
        E
        R
         
         
        
          
            and
          
        
         
         
        I
        m
        (
        
          z
          
            n
          
        
        )
        ≤
        0
        }
        
      
    
    {\displaystyle L_{n,l}=\{c:|z_{n}|>ER~~{\mbox{and}}~~Im(z_{n})\leq 0\}\,}
   which is colored black.External rays of angles (measured in turns):

  
    
      
        a
        n
        g
        l
        e
        =
        (
        k
        
          /
        
        
          2
          
            n
          
        
        )
         
         
        
          
            mod 
          
        
         
        1
        
      
    
    {\displaystyle angle=(k/2^{n})~~{\mbox{mod }}~1\,}
  
can be seen.
Difference between binary decomposition algorithm and Mandel or LSM/M is in only in part of instruction , which computes  pixel color of exterior of Mandelbrot set. In binary decomposition is :

also GLSL code from Fragmentarium :

Point c is plotting white or black if imaginary value of last iteration ( Zy) is positive or negative.


==== nth-decomposition ====
This method is extension of binary decomposition.
The target set T = { z : |zn| > R } with a very large escape radius ( for example R = 12 ) is divided into  more then 2 parts ( for example 8).


=== Real Escape Time ===
Other names of this method/algorithm are :

the fully-renormalized fractional iteration count ( by  Linas Vepstas in 1997)
smooth iteration count for generalized Mandelbrot sets ( by Inigo Quilez in 2016)
continuous iteration count for the Mandelbrot set
Normalized Iteration Count Algorithm
Continuous  coloring
smooth colour gradient
fractional iterations
fractional escape timeHere color of exterior of Mandelbrot set is proportional not to Last Iteration ( which is integer number) but to real number :

  
    
      
        ν
        (
        z
        )
        =
        
          lim
          
            i
            →
            ∞
          
        
        (
        i
        −
        
          log
          
            2
          
        
        ⁡
        
          log
          
            2
          
        
        ⁡
        
          |
        
        
          z
          
            i
          
        
        
          |
        
        )
        
      
    
    {\displaystyle \nu (z)=\lim _{i\to \infty }(i-\log _{2}\log _{2}|z_{i}|)\,}
  Other methods and speedups
Colouring formula in Ultrafractal :
smooth iter = iter + 1 + ( log(log(bailout)-log(log(cabs(z))) )/log(2)

where :

log(log(bailout) can be precalculated


==== C ====
To use log2 function add :
 #include   
at the beginning of program.

where :

Zx2 = Zx*Zx
Zy2 = Zy*ZyHere is another version by Tony Finch

based on equation 

  
    
      
        ν
        (
        z
        )
        =
        n
        −
        
          log
          
            2
          
        
        ⁡
        log
        ⁡
        (
        
          z
          
            n
          
        
        )
        
      
    
    {\displaystyle \nu (z)=n-\log _{2}\log(z_{n})\,}
  


==== C++ ====


==== java ====


==== Matemathica ====
Here is code by Paul Nylander. It uses different formula :

  
    
      
        c
        e
        t
        =
        n
        +
        l
        o
        
          g
          
            2
          
        
        l
        n
        (
        R
        )
        −
        l
        o
        
          g
          
            2
          
        
        l
        n
        
          |
        
        z
        
          |
        
      
    
    {\displaystyle cet=n+log_{2}ln(R)-log_{2}ln|z|}
  


==== Python ====
Python code using mpmath library


== Distance estimation DEM/M ==

		
		
Variants :

exterior DEM/M
interior DEM/MDescription


== Complex potential ==
Description


= See also =
https://web.archive.org/web/20071008112609/http://rgba.scenesp.org/iq/trastero/fieldlines/
http://fraktal.republika.pl/mset_bottcher.html


= References =