Iterations in parameter plane






One must do the iteration for every point of tested rectangle of complex plane = raster scan
Here one can see difference of code for drawing filled Julia set and Mandelbrot set
Iteration loop is inside of x-loop and y-loop

Iterations in parameter plane for Mandelbrot set for map Fc(z) = z*z + c:
Iteration on parameter plane have always Z0= 0
Z0=0
Z1=c
Z2=c*c+c
.....
Iterations in dynamic plane for Julia or Fatou set for map Fc(z) = z*z + c:
Z0=z
Z1=z*z+c
Z2=(z*z+c)^2 + c
...........
boolean escape time ( in pseudocode):

z:=0;
for iteration:=1 to iterationMax do
begin
    z:= z*z + c
    If Abs(z) > EscapeRadius then exit
end

// choose the color for pixels
If Iteration=IterationMax
    then color_of_pixel:=black //c is in Mandelbrot set = orbit is bounded
    else color_of_pixel:= white //c is in the exterior of Mandelbrot set = orbit is not bounded
// all points in the exterior of Mandelbrot set have the same color

boolean escape time ( in pascal / delphi) using for loop:
uses pair of real numbers instead of explicit declaration of complex number
// attention to iteration count from 0 to (IMax-1)
// instead of checking : Sqrt(Sqr(Zx))>bailOut
// check : Sqr(Zx)>bailOut2))

eZx:=0;
eZy:=0;

For iteration:=0 to iterationMax-1 do
begin
eTemp:=Sqr(eZx)-Sqr(eZy) +eCx;
eZy:=2*eZx*eZy+eCy;
eZx:=eTemp;
if ((Sqr(eZx)+Sqr(eZy)>bailOut2)) then break;
end;
if (iteration=IterationMax)
then Form.Canvas.Pixels[iX,iY]:=clBlack;
// else

boolean escape time ( in pascal / delphi) using while loop:
eX:=0;
eY:=0;  //
x2:=0;
y2:=0;
xy2:=0;
//
iter:=0;
// iteration of Z ; Z= Z*z +c
//
while ((iter < IterationMax) and (xy2 < = BailOut2)) do
begin
inc(iter);
eY:=2*eX*eY + eCy;
eX:=x2-y2+eCx;
x2:=eX*eX;
y2:=eY*eY;
xy2:=x2+y2;
end;
// drawing procedure
if (iter=IterationMax)
then Form.Canvas.Pixels[iX,iY]:=clBlack;
// else

discrete (integer) escape time = level set method ( LSM/M ) ( in pseudocode)

// the beginning is the same as above, only diffrence is :
// choose the color for pixels
If Iteration=IterationMax
    then color_of_pixel:=black //c is in Mandelbrot set = orbit is bounded
    else color_of_pixel:= iteration // points of exterior of M-set have color proportional to escape time
// point creates level sets = sets with the same color

Level Curves of Escape Time = eLCM/M ( in pseudocode):

// first coat of paint
For iY :=iYmin to iYMax do
begin
Im(c):=Convert_iY_to_eY(iY);
for iX:=iXmin to iXmax do begin
Re(c):=Convert_iX_to_eX(iX);
z:=0;
previous:=0;
for iteration:=1 to iterationMax do
begin
    z:= z*z + c
    If Abs(z) > EscapeRadius then exit
    // drawing procedure     if (ix<>0) and (iter<>previous) then Draw_pixel(black)
    previous:=iter;
end

end; // for iX
end; //For iY
//--------------------------------------------------------------------
// second coat of paint
//-----------------------------------------
previous:=0;
for iX:=iXmin to iXmax do
begin
eCx:=Convert_iX_to_eX(iX);
For iY :=iYmin to iYMax do
begin
eCy:=Convert_iY_to_eY(iY);
// Z:=ex+eY*i
z:=0;
previous:=0;
for iteration:=1 to iterationMax do
begin
    z:= z*z + c
    If Abs(z) > EscapeRadius then exit
    // drawing procedure     if (ix<>0) and (iter<>previous) then Draw_pixel(black)
    previous:=iter;
end

end; // for iY
end; //For iX

the continuous escape time :
* color index = iteration - log2 (log |z|)
* exponetial

Computing first derivative of the Mandelbrot map with respect to c

Z = 0
dZ= 0
for iteration:=1 to iterationMax do
begin
    Z:=Z * Z + c
    dZ= 2 * Z* dZ+ 1
end

iteration for DEM method :

Z = 0
dZ= 0
for iteration:=1 to iterationMax do
begin
    z:= z*z + c
    If Abs(z) > EscapeRadius then exit
    dZ= 2 * Z* dZ+ 1
end
// choose the color for pixels
if (iteration < IterationMax) then
begin
    distance:= GiveDistance(Z,dZ);
    if distance< distanceMax then color:=black // only boundary of M-set is drawn
end
-----------


Function GiveDistance(xy2,eDx,eDy:extended):extended;
begin
result:=2*log2(sqrt(xy2))*sqrt(xy2)/sqrt(sqr(eDx)+sqr(eDy));
end;

Ditancs Max is < = Pixel size in world coordinate ( = Pixel width = height if there is the same scale on both axis)

Function GiveDistanceMax(_PixelSize,_Denominator :extended):extended;
begin
result:= _PixelSize / _Denominator;
end;

Real potential = absolute value of complex potential:
G :=0.5*Log2(hypotenuse(c))
fac :=0.5
z:=0; // Z0
for iteration:=1 to iterationMax do
begin
    z:=Fc(z) // Z(n+1):=Fc(Z(n))
    If Abs(z) > EscapeRadius then exit
    d:=1+c/(z*z) // complex number
    g:=g+ fac*0.5*log2(hypotenuse(d)) // real number
    fac:=fac*0.5;
end
// choose the color for pixels
If Iteration=IterationMax
    then color:=0 // potential in M-set = 0
    else color:=g
// color is proportional to potential

Argument of Complex potential :




Main page


Autor: Adam Majewski
adammaj1-at-o2-dot--pl
Feel free to e-mail me. (:-))
About