Fractals/Iterations in the complex plane/Mandelbrot set

< Fractals

This book shows how to code different algorithms for drawing parameter plane [1] ( Mandelbrot set [2] ) for complex quadratic polynomial [3].

One can find different types of points / sets on parameter plane [4]


Contents

Exterior of Mandelbrot setEdit

Boundary of Mandelbrot setEdit

Interior of Mandelbrot set - hyperbolic componentsEdit

The Lyapunov ExponentEdit

 
Lyapunov exponents of mini the Mandelbrot set
 
Lyapunov exponent of real quadratic map

Math equation :[5]

 

where :

 

means first derivative of f with respect to z


See also :

  • image and description by janthor [6]
  • image by Anders Sandberg [7]

Interior distance estimationEdit

 
Interior distance estimation

Description of method

absolute value of the orbitEdit

# Hypercomputing the Mandelbrot Set? by Petrus H. Potgieter February 1, 2008
n=1000; # For an nxn grid
m=50; # Number of iterations
c=meshgrid(linspace(-2,2,n))\ # Set up grid
+i*meshgrid(linspace(2,-2,n));
x=zeros(n,n); # Initial value on grid
for i=1:m
x=x.^2+c; # Iterate the mapping
endfor
imagesc(min(abs(x),2.1)) # Plot monochrome, absolute
# value of 2.1 is escape


internal level setsEdit

Color of point  :

  • is proportional to the value of z is at final iteration.
  • shows internal level sets of periodic attractors.


bof60Edit

Image of bof60 in on page 60 in the book "the Beauty Of Fractals".Description of the method described on page 63 of bof. It is used only for interior points of the Mandelbrot set.

Color of point is proportional to :

  • the smallest distance of its orbit from origin[8][9]
  • the smallest value z gets during iteration [10]
  • illuminating the closest approach the iterates of the origin (critical point) make to the origin inside the set
  • "Each pixel of each particular video frame represents a particular complex number c = a + ib. For each sequential frame n, the magnitude of z(c,n) := z(c, n-1)^2 + c is displayed as a grayscale intensity value at each of these points c: larger magnitude points are whiter, smaller magnitudes are darker. As n rises from 1 to 256, points outside the Mandelbrot Set quickly saturate to pure white, while points within the Mandelbrot Set oscillate through the darker intensities." Brian Gawalt [11]

Level sets of distance are sets of points with the same distance[12]

if (Iteration==IterationMax)
 /* interior of Mandelbrot set = color is proportional to modulus of last iteration */
 else { /* exterior of Mandelbrot set = black */
  color[0]=0;
  color[1]=0;
  color[2]=0;                           
 }
  • fragment of code : fractint.cfrm from Gnofract4d [13]
bof60 {
 init:
       float mag_of_closest_point = 1e100
 loop:
       float zmag = |z|
       if zmag < mag_of_closest_point
               mag_of_closest_point = zmag
       endif
 final:
       #index = sqrt(mag_of_closest_point) * 75.0/256.0
}

bof61Edit

Names and description

  • period domain
  • atom domain
  • BOF61
  • orbit trap at (0,0)

Period of hyperbolic componentsEdit

 
period of hyperbolic components

Period of hyperbolic component of Mandelbrot set is a period of limit set of critical orbit.


Algorithms for computing period:

  • direct period detection from iterations of critical point z = 0.0 on dynamical plane
  • "quick and dirty" algorithm : check if   then colour c-point with colour n. Here n is a period of attracting orbit and eps is a radius of circle around attracting point = precision of numerical computations
  • "methods based on interval arithmetic when implemented properly are capable of finding all period-n cycles for considerable large n." (ZBIGNIEW GALIAS )[14]
  • Floyd's cycle-finding algorithm [15]
  • the spider algorithm
  • atom domain, BOF61

Multiplier mapEdit

definition

FractintEdit

Fractint : Color Parameters : INSIDE=ATAN

colors by determining the angle in degrees the last iterated value has with respect to the real axis, and using the absolute value. This feature should be used with periodicity=0[18]

Internal angleEdit

Method by Renato Fonseca : [19] "a point c in the set is given a hue equal to argument

 

(scaled appropriatly so that we end up with a number in the range 0 - 255). The number z_nmax is the last one calculated in the z's sequence. "

Internal raysEdit

 
Internal and external rays

When   varies and   is constant then   goes along internal ray. It is used as a path inside Mandelbrot set

/* find c in component of Mandelbrot set 
 uses complex type so #include <complex.h> and -lm 
 uses code by Wolf Jung from program Mandel
 see function mndlbrot::bifurcate from mandelbrot.cpp
 http://www.mndynamics.com/indexp.html

  */
double complex GiveC(double InternalAngleInTurns, double InternalRadius, unsigned int period)
{
  //0 <= InternalRay<= 1
  //0 <= InternalAngleInTurns <=1
  double t = InternalAngleInTurns *2*M_PI; // from turns to radians
  double R2 = InternalRadius * InternalRadius;
  double Cx, Cy; /* C = Cx+Cy*i */
  switch ( period ) {
    case 1: // main cardioid
      Cx = (cos(t)*InternalRadius)/2-(cos(2*t)*R2)/4; 
      Cy = (sin(t)*InternalRadius)/2-(sin(2*t)*R2)/4; 
      break;
   case 2: // only one component 
      Cx = InternalRadius * 0.25*cos(t) - 1.0;
      Cy = InternalRadius * 0.25*sin(t); 
      break;
  // for each period  there are 2^(period-1) roots. 
  default: // safe values
      Cx = 0.0;
      Cy = 0.0; 
    break; }

  return Cx+ Cy*I;
}

// draws points to memmory array data
int DrawInternalRay(double InternalAngleInTurns , unsigned int period, int iMax, unsigned char data[])
{

   complex double c;
   double InternalRadius;
   double RadiusStep; // between radius of points 
   int i; // number of point to draw
      
  RadiusStep = 1.0/iMax;
   
  for(i=0;i<=iMax;++i){ 
   InternalRadius = i * RadiusStep;
   c = GiveC(InternalAngleInTurns, InternalRadius, period);
   DrawPoint(c,data);
  }

return 0;
}

Example : internal ray of angle =1/6 of main cardioid.

Internal angle :

 

radius of ray :

 

Point of internal radius of unit circle :

 

Map point   to parameter plane :

 

For   this is equation for main cardioid.

Internal curveEdit

When   is constant varies and   varies then   goes along internal curve.

/* find c in component of Mandelbrot set 
 uses complex type so #include <complex.h> and -lm 
 uses code by Wolf Jung from program Mandel
 see function mndlbrot::bifurcate from mandelbrot.cpp
 http://www.mndynamics.com/indexp.html

  */
double complex GiveC(double InternalAngleInTurns, double InternalRadius, unsigned int period)
{
  //0 <= InternalRay<= 1
  //0 <= InternalAngleInTurns <=1
  double t = InternalAngleInTurns *2*M_PI; // from turns to radians
  double R2 = InternalRadius * InternalRadius;
  double Cx, Cy; /* C = Cx+Cy*i */
  switch ( period ) {
    case 1: // main cardioid
      Cx = (cos(t)*InternalRadius)/2-(cos(2*t)*R2)/4; 
      Cy = (sin(t)*InternalRadius)/2-(sin(2*t)*R2)/4; 
      break;
   case 2: // only one component 
      Cx = InternalRadius * 0.25*cos(t) - 1.0;
      Cy = InternalRadius * 0.25*sin(t); 
      break;
  // for each period  there are 2^(period-1) roots. 
  default: // safe values
      Cx = 0.0;
      Cy = 0.0; 
    break; }

  return Cx+ Cy*I;
}


// draws points to memmory array data
int DrawInternalCurve(double InternalRadius , unsigned int period,  int iMax, unsigned char data[])
{

   complex double c;
   double InternalAngle; // in turns = from 0.0 to 1.0
   double AngleStep;
   int i;
   // int iMax =100;
   
  AngleStep = 1.0/iMax;
   
  for(i=0;i<=iMax;++i){ 
   InternalAngle = i * AngleStep;
   c = GiveC(InternalAngle, InternalRadius, period);
   DrawPoint(c,data);
  }

return 0;
}

Boundaries of hyperbolic componentsEdit

description

Centers of componentsEdit

VideoEdit

see 3D

Speed improvements - optimisationEdit

SymmetryEdit

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 )[20]

Bailout testEdit

Instead of checking :

 

compute ER2 once and check :

 

It gives the same result and is faster.

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 [21]


 // cpp code by Geek3 
// http://commons.wikimedia.org/wiki/File:Mandelbrot_set_rainbow_colors.png
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)
                return(true);
        return(false);

 // 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.

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

DescriptionEdit

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"[22] math libraries to calculate. However, this can be sped up by the exploitation of perturbation theory[23]. Given

 

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

 

or

 

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.[24] 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.[25] [26] [27]

historyEdit

  • 2 independent descriptions :
    • Fast Mandelbrot set with infinite resolution by Sergey Khashin (July 9, 2011)[28]
    • perturbation method by K.I. Martin (2013-05-18)[29]
  • extending Martin's description to handle interior distance estimation too by Claude Heiland-Allen[30]


ProgramsEdit

More tutorials and codeEdit

ReferencesEdit

  1. parameter plane in wikipedia
  2. Mandelbrot set in wikipedia
  3. complex quadratic polynomial in wikipedia
  4. reenigne blog : mandelbrot-set-taxonomy
  5. The logistic equation by Didier Gonze October 4, 2013
  6. Ljapunov Exponent and mandelbrot set by janthor
  7. Image by Anders Sandberg
  8. Fractint : Misc. Options and algorithms
  9. Java™ Number Cruncher: The Java Programmer's Guide to Numerical Computing By Ronald Mak
  10. Firefly Application Help by Terry W. Gintz
  11. Mandelbrot Oscillations by Brian Gawalt
  12. Fractint doc by Noel Giffin
  13. gnofract4d
  14. Rigorous Investigations Of Periodic Orbits In An Electronic Circuit By Means Of Interval Methods by Zbigniew Galias
  15. Mandelbrot set drawing by Milan
  16. interior_coordinates_in_the_mandelbrot_set by Claude Heiland-Allen
  17. practical interior_distance rendering by Claude Heiland-Allen
  18. fractint color params
  19. The Mandelbrot set by Renato Fonseca
  20. How to use symetry of set
  21. FractalNet by Michael Hogg
  22. arbitrary precision at wikipedia
  23. perturbation theory in wikipedia
  24. "Superfractalthing - Arbitrary Precision Mandelbrot Set Rendering in Java by K.I. Martin 2013-05-18". http://www.fractalforums.com/announcements-and-news/superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-java/. 
  25. "Kalles Fraktaler 2". http://www.chillheimer.de/kallesfraktaler/. 
  26. Fast Mandelbrot set with infinite resolution, ver. 2 by Sergey Khashin, July 9, 2011
  27. Perturbation techniques applied to the Mandelbrot set by Claude Heiland-Allen October 21, 2013
  28. Fast Mandelbrot set with infinite resolution, ver. 2
  29. fractalforums : superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-java
  30. Perturbation glitches by Claude Heiland-Allen
  31. superfractalthing By K.I. Martin
  32. mightymandel by Claude Heiland-Allen
  33. ASCII graphic

NotesEdit