Cool Stuff: Fractals Alt.Fractals paperback - out January 2011

homepage
AuthorLinkBlogLink4.0-Link



2008

The Julia Set

The Mandelbrot Set and the Julia set are both famous sources of fractal images, partly because of the intricacy of the resulting shapes, and partly because they're so easy to generate using a computer.

Both types of image use variations on the same method. We take a parameter z , we square it, we add a constant, c, and we then continue squaring the result and adding a constant until the result shoots off to infinity (or doesn't).

We can write this repeating or iterating process, where we continually square z and add a constant, as:

z → z2 + c

, and we can check how quickly the process heads for infinity, as a function of z or c. To make things more interesting, we don't use conventional numbers for z and c, but complex numbers, which combine a real number component with an imaginary number component.



Julia vs Mandelbrot

The Mandelbrot Set and the usual Julia Set images use the same formula, but apply it in different ways.

Since z and c are complex numbers, they each have two components, giving us four parts in total. For the purposes of these pages, we'll label these four parts A, B, C, and D.
A and B are the real and complex components of the starting value of z, and C and D are the real and imaginary components of the constant, c, that we add every time the formula cycles,


z c
/ \ / \
real
|
imaginary
|
real
|
imaginary
|
A B C D

... Mandelbrot Set

If we start the initial values of z at zero, and plot the values that we're using for the two components of c on the horizontal and vertical axes of a graph – if we set AB to zero – graphing CD gives us the Mandelbrot Set.

Colouring schemes

Technically, the "set" is the "set of points" that are trapped by the formula. Points outside the Mandelbrot Set escape to infinity when we cycle the formula, points inside the set don't. So we run the formula a large number of times, and count how many cycles it takes to cross a threshold that indicates escape. We can then colour the diagram in two colours depending on whether the centre of a pixel is "inside" or "outside" the critical set boundary.

Mandelbrot Set, black and white

The problem with this approach is that the set has a lot of fine detail that's missing from the black-and-white diagram above – we may want to know where the set has fine threadlike structures connecting certain details, and these threadlike details are often too thin to show up on a conventional plot. We can try calculating the set to finer and finer detail, testing multiple points within each pixel ("oversampling") and then using shading or boundary weighting to force the subpixel detail to show up (e.g. the "Minkowski sausage" technique), but this requires extra computing time. Some of these fine threads will be arbitrarily fine, and will still be missed no matter how strongly we oversample.

Mandelbrot Set, greyscaleMandelbrot Set, in colour

However, there's a simple method of indicating proximity to the set boundary: We're already calculating the number of "cycles for escape" for every pixel, so if we use this information to colour the graph, we end up with an external "contour map" that indicates where fine boundary detail is located, even if none of that detail has been calculated directly. Applying nice colour schemes to these external contours is also a good way of generating evocative colour images.

... Julia Set

If we try the same exercise with the other two values – if we set C and D to zero, and plot a graph of the dependency of the formula on A and B – then the boundary of our "escape" values turns out to be a boring circle:

Juia Set, 0,0,x,y

HOWEVER ... if we repeat the exercise with different fixed values of C and D, we get a range of different fractal images – graphing AB gives us a conventional Julia set image, and adjusting varying C and D then lets us control which Julia image we get. Here are a few examples:

Sample Julia Set image Sample Julia Set image Sample Julia Set image Sample Julia Set image Sample Julia Set image Sample Julia Set image



Mapping the Julia Set

It can be handy to have a map showing where some of the more interesting Julia Set images can be found. Here's a rough map of how these images vary with our choice of C and D. In the table below we're using increments of 0.1, but we can specify C and D with arbitrarily-fine precision to call up variations that lie between the sample images in our table.

- - - - - - Julia Set Map + + + + + +
1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 D 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
0.7 +0.7 -1.0+0.7 -0.9+0.7 -0.8+0.7 -0.7+0.7 -0.6+0.7 -0.5+0.7 -0.4+0.7 -0.3+0.7 -0.2+0.7 -0.1+0.7 0.0+0.7 +1.0+0.7 +2.0+0.7 +3.0+0.7 +4.0+0.7 +4.0+0.7 +4.0+0.7 +4.0+0.7 +4.0+0.7 +4.0+0.7 +4.0
+0.6 -1.0+0.6 -0.9+0.6 -0.8+0.6 -0.7+0.6 -0.6+0.6 -0.5+0.6 -0.4+0.6 -0.3+0.6 -0.2+0.6 -0.1+0.6 0.0+0.6 +1.0+0.6 +2.0+0.6 +3.0+0.6 +4.0+0.6 +4.0+0.6 +4.0+0.6 +4.0+0.6 +4.0+0.6 +4.0+0.6 +4.0
+0.5 -1.0+0.5 -0.9+0.5 -0.8+0.5 -0.7+0.5 -0.6+0.5 -0.5+0.5 -0.4+0.5 -0.3+0.5 -0.2+0.5 -0.1+0.5 0.0+0.5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