Fractals for the compleat idiot

by Kathy Roth

August 21, 2000

 

 

Here is my effort to explain the basics of fractals-please feel free to comment.

Fractals start with a process called iteration. An operation is repeated over and over again. Often a very simple formula gives rise to an incredibly complicated-appearing image. Most people who initially feel put off by looking at this passed high school algebra and did things that were much more difficult than this.

You can start with the Mandelbrot formula:

z=z^2 +c (z=z squared + c).

This is really:

z(new) = z(old) ^2+ c.

For the Mandelbrot equation, z is set at the beginning and most often is (0,0). The c corresponds to the pixel- picture the computer screen with an x-axis horizontally and a y- axis vertically.

So a point on the x-axis would be (2,0) and a point on the y-axis would be (0,2) and a point in the lower left would be (-2-,2).

(The second number is actually multiplied by i, the square root of minus 1- more on this later.) (like very later when someone else is doing the writing)

So to see what color a particular pixel turns out, you put it into the equation

z= z^2 + c

z(new) = z(old) ^2 + c.

Start with the point (2,0) on the x axis. The second number is multiplied by i,

the square root of minus one, so this number is 2+ 0i= 2. In the Mandelbrot equation, the z is set at the beginning and the pixel is going in at the c value.

For z=0 and c=pixel=(2,0)

z= 0^2 +2= 2

Then you put the 2 in for the old z and get a new new z-

this is the iteration part.

z= 2^2 +2=6

z=6^2+2=38 etc.

Try another pixel- (-0.2,0.2)

z=0^2 + (-0.2 +0.2i)= -0.2 + 0.2i

z=(-0.2 + 0.2i)^2 +(-0.2 +0.2i)

etc.

So where does the beautiful image come from?

You run a point corresponding to the pixel through the formula. You choose a bailout value- most often the circle corresponding to r^2 = 4 (points at (2,0) (0,2) (0,-2) (-2,0).

If the point runs out of this it is "outside " and if it is less than this it is "inside". (Most often "outside" gets a color and "inside" is black- more on this later)

The path that the number traces as it goes through the result of each iteration is called the "orbit".

The orbit could go on forever- you can plug it into the iteration formula endlessly but sooner or later there's a clear trend. Is it going to be outside the bailout circle or not?

The number of times you plug it into the formula is called the "maximum iterations" or maxiter- one of the things you can vary in the fractal program.

Here is an example. If you are using Ultrafractal, you can set the "inside" to black and the "outside" to white- the most simple coloring method. This is the Mandelbrot fractal with that coloring, a bailout of 4 , and a maxiter (i.e. maximum iterations, the number of times you plug it into the equation) of 100.

Fractal2 {
fractal:
title="Fractal2" width=320 height=240 author="kathy roth"
created="August 20, 2000" numlayers=1
layer:
caption="Layer 1" visible=yes alpha=no
mapping:
center=-0.5/0 magn=1 angle=0
formula:
filename="Standard.ufm" entry="Mandelbrot" maxiter=100 percheck=normal
p_start=0/0 p_power=2/0 p_bailout=4
inside:
transfer=none repeat=yes
outside:
transfer=linear repeat=yes
gradient:
smooth=yes numnodes=4 index=0 color=16777215 index=89 color=16777215
index=238 color=16777215 index=334 color=16777215
}

 

 

So where do all the colors come from? The basic coloring method is "escape time" coloring. The simplest situation is that the pixels whose orbits never "escape" i.e. are inside the bailout circle, are colored black. The pixels that are "outside" are colored in lots of different ways. The escape time coloring is simple.

(Yeah- I don't really understand the others. Well, sometimes sort of.) Escape time coloring colors the pixels in terms of how many iterations it takes to "escape" the bailout circle.

Fractal3 {
fractal:
title="Fractal3" width=320 height=240 author="kathy roth"
created="August 20, 2000" numlayers=1
layer:
caption="Layer 1" visible=yes alpha=no
mapping:
center=-0.5/0 magn=1 angle=0
formula:
filename="Standard.ufm" entry="Mandelbrot" maxiter=100 percheck=normal
p_start=0/0 p_power=2/0 p_bailout=4
inside:
transfer=none repeat=yes
outside:
transfer=linear repeat=yes
gradient:
smooth=yes position=-14 numnodes=9 index=0 color=34303 index=1
color=58879 index=13 color=65535 index=23 color=11160234 index=91
color=7667829 index=166 color=6946890 index=288 color=6291488
index=374
color=1048576 index=385 color=0
}

 

 

I think it is easier to find really lovely images with the Julia sets than with the Mandelbrot set.

In the early 1900's, before computers, before cars were common, around the time that the theory of relativity was being developed and way before DNA was discovered, Julia came up with the Julia set.

(Julia was a man-sorry women, as far as I know Sylvie Gallet was the first woman in fractals, followed by Janet Parke Preslar and Wizzle- hey this is not my field!)

The equation for the Julia set is the same as the Mandelbrot set, except that z=pixel and c is set as a constant in the beginning- i.e. c is the "Julia Seed."

z=z^2 + c.

If you start a Mandelbrot set and hit "switch" it gives you the Julia set for whatever value of c you have chosen.

It has been described that the Mandelbrot set is the "map" to the Julia sets- that is if you take a value of "c" for the Mandelbrot set and apply it to the Julia set you get a variety of interesting images. You can try this- bring up a Mandelbrot set in Ultrafractal and put the pointer on one of the bays or somewhere near the edge- if you hit "switch" you get a different Julia set.

Really, the whole thing is part of a multidimensional "Julibrot" image. If the computer screen is a graph of the pixels, the Mandelbrot set is a graph of real c and imag c. The Julia set is a graph of real z and imag z. There are several other possible ways to view this. Jim Muth has been doing an exploration of the multi-dimensional Julibrot- his daily Fractal of the Day is on the fractal philosophy and the fractint list. There is real c and real z, real c and imag z, imag c and real z, imag c and imag z. Jim Muth calls these the oblate, rectangular, parallel and something else dimensions-

 

 

Addendum by Julian Smith

 

Here's an interesting exercise if you want to understand a bit of what is happening when a fractal is calculating. This is a bit of an exercise you can do quite simply on excel or other spreadsheet packages. I presented a demonstration of this to some students recently. It was a bit beyond most of them (some were only twelve), but not by much. If we had been able to spend more time on it, I think most of them would have got it.

Here's some instructions for those interested.

Start off with a new spreadsheet.

In cell A1 type

0.3

In cell B1 type

0.3

This is the coordinate we will start with -- (0.3,0.3) We can change

this later.

In cell A2 type

=A1+A1*A1-B1*B1

In cell B2 type

=B1+2*A1*B1

This is the formula which will produce a new coordinate.

Select cells A2and B2. There should be a small square visible on the bottom right corner of B2. Click on this and drag down to B20. This copies the formula twenty times so that it will be repeated (iterated) twenty times.

Now, here's the fun part. Use your mouse to highlight A1 to B20. Click at a button at the top of the screen -- the one that is labelled "Chart Wizard". This will produce a graph of the orbit of your point. You will need to choose XY scatter graph type. You then have a number of sub options. Click one of the ones that has points connected together.

Click "next" and "finish" to produce the graph.

You should now see an erratic zigzag sort of a path, starting at the point (0.3,0.3) and finishing in a blob of points very close together near (0,0) This is the orbit of (0.3,0.3) using that particular formula.

Now what you can do is change cells A1 and B1 to find different orbits.

You should find two types --

those where the points zigzag around a bit, and then settle down

somewheer near (0,0).

those where the points fly off to infinity at a high rate.

You can find some places where a very small change in the starting coordinate will produce huge changes in the shape of the orbit. This is called chaos theory.

What Mandelbrot did in the eighties was to paint different starting points different colours depending on how the orbit behaved. The ones that flew off to infinity, he painted white, and the ones that stayed around zero he painted black. The black region he drew became known as the Mandelbrot set. All points are either inside the set, or outside. (UF uses these terms)

(Ultrafractal needs some guidelines to tell it when to stop calculating the orbit, decide if it is an inside or an outside point, and start calculating the next point. The first guide is the Bailout value. If either of the coordinate values gets bigger than this value, then UF calls it an outside point. The other guide is maximum iterations. This was set to 20 on your spreadsheet. If a point has not bailed out after a certain number of iterations, then UF calls it an inside point.)

The interesting thing to note is that the mandelbrot set has a perimeter of infinite length -- one that twists and turns and folds back on itself an infinite number of times. It encloses a finite space though. This is the definition of a fractal (in simple terms).

What ultrafractal does is enably you to colour the points with different colouring algorithms. Not just black and white the way Mandelbrot did, but a range of different colours depending on the shape and behaviour of the orbit. These are colouring formulas or UCLs.

The other thing that ultrafractal does is allow you to use different formulas on your points -- not just the simple one that you typed into the spreadsheet. As Kathy has pointed out, the Julia formula is related to the mandelbrot formula, but slightly different, and produces different shapes -- a lot of spirals. Other formulas come from different fields of maths and science -- Volterra-Lotka from biology, Newton methods from engineering and physics, and so on. Also, clever people on this mailing list write formulas for artistic purposes -- those which will produce a particular desired effect.

And because Frederik has produced such a wonderful piece of software, your computer can produce thousands of calculations per second -- working out all these orbits. This allows the fractal artist to forget about all the maths and get on with worrying about the way the image appears.

Hope this is helpful to someone. The spreadsheet exercise was a bit of an eye opener for me -- although I knew the theory, I did not appreciate the behaviour of orbits until I actually saw one.

 

 

 

 

HOME