Fractals are a branch of mathematically defined algorithms that are most commonly used to generate complex computer images.

The Ogless time saver uses many of these amazing fractal images. You can download and install the screen saver for free from our download page.

The computation could not be any simpler, it involves the repeated squaring of a complex number (a number with real and imaginary parts).

```
a = x + iy;
```

a^{2} = (x+iy) * (x+iy);

a^{2} = x^{2} + 2iy + i^{2}y;

a^{2} = x^{2} - y^{2} + 2ixy;

The real part of the result (x^{2} - y^{2}) and the imaginary part (2ixy) are then passed to the next iteration as the new x and y.
The standard fractal set is produced in graphical form by counting how many times this loop is executed before (x^{2} + y^{2}) exceeds a certain value. The count of loop iterations is then converted to a color value and plotted according to the value of the initial position (x,y) value.

Without knowing the details of what the function does it is clear that an initial point very close to the origin (x=0; y=0) will take a very large number of iterations to reach (may be never) the limit. While a point far from the origin will take very few iterations to reach the value. It is the small region in between the two extremes that generates all the 'pretty' fractal patterns.

Fractal code in C++

`double Fx, Fy, Initx, Inity, Sqx, Sqy;`

int Loops;

Fx = Initx;

Fy = Inity;

for (Loops = 0; Loops < MAX_LOOP_ITERATIONS; Loops++)

{

Sqy = Fy*Fy;

Sqx = Fx*Fx;

if (Sqx + Sqy > 2.0) break;

Fy = 2.0*Fx*Fy + Inity;

Fx = Sqx - Sqy + Initx;

}

// Plot the value of 'Loops' as a color for the initial position Initx, Inity

// ...

The most surprising feature of the Mandelbrot and Julia sets is that the intricate detail revealed is infinite in depth. If you zoom in on a small region then the smaller region is broadly similar to the larger one, and you can zoom in indefinitely - up to the limits of the capabilities of the processor. When you see a typical part of the fractal set you'll see spirals made up of spirals, each smaller spiral is a miniature version of the larger version.

This image is the familiar Mandelbrot 'top level' picture. You can begin to see the intricate spirals that occur throughout the set. To demonstrate the way that zooming in on a fractal works go and Explore an Ogless image - we have computed just 7 levels but the image goes infinitely deeper..

The concept has been broadened to a general 'fractal' concept for anything that is similar on one scale than on another scale. There are many different fractal algorithms that have been discovered. It is a powerful concept that can be applied to many fields of knowledge.

The clearest example of a general fractal concept working in real-life comes from something amazingly simple. How do you measure the length of the coastline? It seems on face value a silly question, I just take a map and move around the coast totting up each mile measured. But then by doing this you are making an approximation, the coastline wiggles in and out and you should really take account of each cove and inlet. So the first figure is too low, but then where do you stop? When computing the length of coastline should you get the most detailed map and go around every cliff outline? But it does not stop there, as you can then consider whether each rock provides an extra level of detail that needs to be added. Moving from coves and beaches to rocks is one 'fractal' level as we then hit another consideration. Should each and every rock be considered? Some rocks are very angular and going into each pit and protrusion would greatly add to the total. Even smooth rocks are made up of very angular crystals under a microscope. The search goes on down to the molecular and atomic scale. The coastline can be considered infinite in length, it all depends what level of detail you stop looking any further at. The fractal levels identified are cove/rock/crystal/molecule all with internal structure.

Another example of fractal scales is astronomical orbits. The moon goes around the Earth, the planets around the Sun, the Sun around the Galaxy and the Galaxies around the Galactic cluster. Also consider road networks, start at the motorway or inter-state highways and then main roads, small roads and lanes, they are all roads but differ in scale.

The interest in 'levels' of fractal has led to its application to human affairs. Can the rules and structures at the level of a state be applied to companies, cities and individuals? Re-using the same concepts at different levels can greatly simplify the situation. In software design it is also appealing to re-use the same set of procedures and functions on different objects at a different scale.

Often finding a set of fractal levels not only simplifies design but simplifies the understanding of a system as there are fewer concepts to take in.

On a computer a fractal is usually computed using floating point arithmetic as this keeps the same level of accuracy for very and very small numbers however it is still only an approximation and there comes a point where floating point 'rounding' and other errors creep in and affect the result. If you 'zoom' in a long way on a PC you will end up with a 'blocky' pixelated image just because of the limited size of representation of the number on it. If the floating point calculation uses a larger mantissa (more bits) then these effects will be delayed for longer. Intrinsically, as far we can tell the fractal set contains an infinite amount of detail, you never reach a point where there is no smaller structure.

The standard fractal algorithm (Mandelbrot) is quite appealing but lacks something. It is just a bit too repetitive and regular. There are lots of interesting spirals but they all look somewhat similar even with different colors. What Ogless has set out to do is to create new algorithms unique to Ogless that enliven the displayed fractal image. It does this by making slight changes to the basic fractal computation - adding extra parameters and modifying others. We have ended up with over a dozen of different variations of the fractal algorithm.

Here are the top level pictures of some of the algorithms that Ogless uses. In each case there is a controlling variable (called 'z') that substantially alters the pattern created, so there are an infinite number of these top level views, we have chosen an arbitrary one.

It would be pleasing to extend these images into three dimensions. Instead of flat colors a whole landscape would be possible of infinite detail.

The hunt for a quick and simple 3-D algorithm is still on if you want a challenge... The original fractal is intrinsically two dimensional - it has a 'real' and 'imaginary' part which map onto 'x' and 'y'. It is tempting to think that changing the base equation from.

```
a = x + iy;
```

a^{2} = (x+iy) * (x+iy);

```
a = x + iy + jz;
```

a^{2} = (x+iy+jz) * (x+iy+jz);

Would do the trick, using the components of 'i' and 'j' as 'y' and 'z' dimensions. It creates two imaginary dimensions 'i' and 'j' (with both i^{2} and j^{2} = -1). However this does not give the 3-D image you might hope for - it is distorted and not that interesting.

The other main issue with 3-D is how to render it. You can choose arbitrary viewpoints and set up lights of different colors and positions - there are an infinite number of ways to view one scene. However all this takes a lot of processing time - particularly if shadows are cast. It is all much more complex than the 2-D used for our images - effectively they look directly down on a scene and use simple coloring to represent 'z'.

Biography of Mandelbrot - the man behind fractals ➚

Gallery of a large range of different fractal types ➚

High quality Fractals images including some interesting animations ➚

A Java applet for fractals with some mathematical explanation ➚

A good introduction to the general concepts of fractals ➚

A Java applet allowing you to explore the Mandelbrot set with some description of what is happening ➚

Detailed examination of properties of the Mandelbrot and Julia sets with example images ➚

Overview of Fractal compression ➚

Explanation of Fractal image compression ➚

Copyright © Ogless and Silurian Software 2008-2016