What is a fractal?

A fractal is a mathimatical set of points as a result of applying an mathematical alogoitm using a complex function.


Complex values

A complex value is a values that consists of two parts: a real number and a imaginair number: z = (x,iy) and, by definition, i x i = -1
When creating a picture of a fractal, every complex value is mapped into a two dimensional space.
The real number is mapped to the X coördinate. The imaginair number is mapped to the Y coördinate.
A complex value z


Complex functions

A complex function is a functions applied to complex values.

Adding two complex values z1 = x1 + iy1 and x2= x2 + iy2 results in:
z1+z2=
x1+x2+iy1 + iy2=
(x1+x2) + i(y1+y2)

Multiplying two complex values z1 =
x1+iy1 and z2 = x2 + iy2 results in:
z1*z2 =
x1*x2 + x1*iy2 + iy1*x2 + iy12 =
(x1*x2) + i(x1*y2 + x2 * y1) + i*i*(y1*y2) =
x1*x2 - y1*y2 + i(x1*y2 + x2*y1)

The quadratic value of z:
z2 = x2 + x*iy + iy*x + (iy)2 =
x2 - y2 + 2*i*x*y


The standard Julia and Mandelbrot Algoritm

To explain those algoritms, it is good to first make definitions.


Scanning pixels (definition)

To create a picture of a fractal, you must give every pixel a color. This is done by scanning all pixels. It make no sense on which order you are selecting pixels. Every pixel is undependent of each other. (Of course you can merge pixels by mixing colors of a small square of pixels into one new pixel, but this is done after these pixels are already scanned.)


Starting point (of a Walk) (definition)

When filling a pixel with a color, you start a Walk. This starting point is the point that belongs to the pixel. A point in this algoritm is by definition a complex value, so the starting point is also a complex value: Z0.


A Step (definition)

When a point (a complex value) is put into the formula, the result is also a complex value. The point is taking a Step: Zn -> Zn+1.


A Walk (definition)

You can make so many steps as you like, but (as every walk) you must stop at a time. This finit list of Steps is called a "Walk". If a Walk take n steps, you can write it as: Z0->Z1->Z2->....Zn-1->Zn


Viewport (definition)

When drawing a fractal, you always take a piece (rectangle) of a complex space, in which the fractal is present. This rectangle piece is a Viewport. When the Viewport is great, for example (-2,-2) - (2,2), the whole fractal is visible (when using a kwadratic formula z -> z2 + c), but when it is small (0.5,0.2)-(0.5000001,0.2000001), you can zooming into a piece of a fractal, so that part is enlarged a million times!


Mapping pixels with a complex space

If you have for example a resolution of 1000 times 1000 and a Viewport of (1.0, 0.2) - (1.1, 0.3). You must map the viewport onto the pixels, before you can draw the fractal. By convention, the real part of complex values is mapped horizonally (x) from low at left to high at right, and the imaginair part of complex values is mapped vertically (y) from low at bottom to high at top. So, in this case, you create a convertionally oriënted fractal by do the mapping as follows:

  • Map the upper-left pixel at (1.0, 0.3)
  • Map the upper-right pixel at (1.1, 0.3)
  • Map the bottom-left pixel at (1.0, 0.2)
  • Map the bottom-right pixel at (1.1, 0.2)
0 The pixel right next to the upper-left pixel will be mapped on the complex value (1.0001, 0.3000) and The pixel below next to the upper-left pixel will be mapped on the complex value (1.0000, 0.2999). (* not exaclty at resolution 1000 times 1000, but exactly when it is 1001 times 1001).
You can mirror the picture of a fractal by swithing the mapping with left/right or top/bottom.

standard algoritm

A piece of the two dimensional space of the fractal is selected to draw on the screen. For Julia fractals using a quadratic functions as z' = z2 + c, the fractal always fits in the ractangle from (-2,-2) to (2,2). You can zoom (extremely) in by taking a very small rectangle, for example (1.344, -0.750) - (1.345, -0.749) resulting in a magnification of about 1000.
To fill in the selected reactangle, every pixel (x,y) of the rectangle is taken belonging the complex value z0 = x + iy. It is the Starting Point.



"Stepping" points




When you take a complex value zn and put it through a certain complex function, you get a new value zn+1. That is a "Step".


When you put again zn+1 into the function, you get zn+2, etcetera.






Repeating taking steps create a "Walk".

a infinite attractor (defintion)

When the "Walk" goes away from the center, the distance of (0,0) becomes greater and greater, the point z goes towards the infinit attractor. You can define "nearby" a infinite attractor as follows:
z*x,y) is "nearby" when x2 + y2 > r, with r of a high number (h). When you draw a great circel of radius 1000, and define "nearby" when entering the ouside part of a circles, then the value of h is 1,000,000.

a finite attractor (defintion)

When the steps of the "walk" grows smaller and smaller, the point z goes towards a finite attractor. You can define "nearby" a infinite attractor as follows:
z is "nearby" when the distance of zn and zn-1 is smaller than a small number s. For example 0.0001

apply a color to the pixel

In the Julia algoritm, To display the fractal, for every pixel z0 the length of a "walk" of each starting point is calculated until xn is "nearby" an attractor.
when for example it takes 7 iteration to get z "nearby" a infinite attractor, the value 7 is mapped into a color (for example using a color palette) when for example it takes 13 iteration to get z "nearby" a finite attractor, the value 13 is mapped into a color (for example using a (alternate) color palette)
Sometime it will take too long to get zn nearby an attractor, so a maximum of iteration is defined. When for a pixel z the maximum is reached, you give that pixel a choosen color.

Julia Algoritm

In the Julia algoritm, the same function (using the same constants) is used for all complex value of each pixels. For example when using zn+1 = zn2 + c, with c = 0.2 + 0.3i, it is applied to all pixels.

Mandelbrot Algoritm

In the Mandelbrot algoritm, the complex value of the starting point of the "walk" is used as a constant of the complex function. For example when using zn+1 = zn2 + z0, it is applied to the complete "walk" from the pixel z0.