Wolfram Alpha:

```Fractals
--------

A fractal is a rough or fragmented geometric shape that can be split
into parts, each of which is similar to a reduced-size copy of the whole.
This property referred to as 'self-similarity'.  In other words a fractal is
a pattern that repeats itself on an increasingly smaller scale. All fractal
images are created by using mathematical functions and applying them
as transformations on a pre-existing image. Each fractal is created by
applying a finite number of such transformations. The set of these
functions, together, is referred to as an 'iterated function system' (IFS).

A good example of a fractal is a snowflake.   All snowflakes have
hexagonal structures.  Dividing a simple hexagon into 7 smaller
hexagons and subsequently dividing these smaller hexagons into
7 smaller hexagons and so on produces the following snowflake.

By simply changing the IFS so that the original hexagon is now divided
into one large hexagon surrounded by 6 smaller ones, reveals another
version of the snowflake.

Approximate fractals are easily found in nature. These objects display
self-similar structure over an extended, but finite, scale range.
Examples include clouds, river networks, fault lines, mountain ranges,
lightning, and systems of blood and pulmonary vessels. Trees are also
fractal in nature.  A branch from a tree is a miniature replica of the whole:
not identical, but similar in nature. The connection between fractals and
leaves is currently being used to determine how much carbon is contained
in trees.

Computer-animated films use fractals to simulate nature and many of
the IFSs used to create these images are not much more complex than
the IFSs used to create the above snowflakes.  For example, consider the
following fractal that models the surface of a mountain.

The Mandelbrot set is perhaps the most famous example of a fractal.  The
Mandelbrot set is a mathematical set consisting of a collection of complex
numbers (i.e. a + b√-1).

To see if a given number is inside or outside the set it is necessary to
perform a test. The test is based on the equation Z = Z2 +  C where
Z is the magnitude of the number and C is the number that is being
tested.  C is the point on the complex plane that will be plotted when
testing is complete. Z starts out as 0 (the seed), but changes as the
equation is iterated.  The list of Z values generated by the iteration
process is referred to as the orbit of Z.  For a given value of C, the
orbit of Z will do one of two things.

1.  It will either stay equal to or below 2 forever and be fixed or cyclic
or behave chaotically,

2.  It will eventually surpass 2.  Once Z surpasses 2, it will increase forever.

In the first case, where Z stays below 2, the number being tested, C, is part
of the Mandelbrot set. Conversely, if Z surpasses 2, the number is not
part of the Mandelbrot set.

The Mandelbrot set in general, is not strictly self-similar but it is
quasi-self-similar, as small slightly different versions of itself can be found
at arbitrarily small scales.

In the following example the Mandelbrot set is plotted:

yi = 0;
xi = 0;

function animate(){
var canvas = document.getElementById("can");
canvas.style.display = 'block';
var context = canvas.getContext("2d");
context.fillStyle = "rgb(255,0,255)";
var fac = 3.0 / 450.0;

for(var xi = 0; xi < 600; xi++)
{
var Ci = (yi * fac - 1.5);
var Zr = 0.0;
var Zi = 0.0;
var Cr = (xi * fac - 2.5);
var i = 0;
var ZrN = 0;
var ZiN = 0;
do
{
Zi = 2.0 * Zr * Zi + Ci;
Zr = ZrN - ZiN + Cr;
ZiN = Zi * Zi;
ZrN = Zr * Zr;
}
while (!(ZiN + ZrN > 4.0) && ++i < 50)
{
if(i == 50)
{
context.fillStyle = "rgb(255,0,0)";
context.fillRect (xi, yi, 1, 1);
}
else
{
context.fillStyle = "rgba(0,0,0," + (i/50)  + ")";
context.fillRect (xi, yi, 1, 1);
}
} // end while
} // end for

yi++;
if(yi < 450){setTimeout("animate();",1);}

}  // end function

```