Last essential modification: March 24, 1999

Marko Mäkelä’s software projects: 3D Mandelbrot and Julia fractals

Fractals became popular in the 1980s, when microcomputers started to become common. Everyone could produce the Mandelbrot set with their home computer. It is difficult to conceive how so simple mathematic formulae can create such beautiful images having such detailed and in some sense recursive structure.

Some theory

The underlying mathematics makes use of complex numbers. For each point c=t+j x n the complex plane, one associates a colour by using an iterative process:

z(0)=0

z(i+1)=z(i)²+c

The colour of the point c is the smallest i for which |z(i)| > 2.

This is the process for the Mandelbrot set. The Julia set is similar, but it uses the formulae

z(0)=c

z(i+1)=z(i)²+d

Above, d is an additional parameter, which is used for all points in the fractal.

Programming languages usually do not directly support complex number arithmetics. Therefore, the iteration equations are usually split into real and imaginary components

z(i)=t(i)+j x(i)

c(i)=ct(i)+j cx(i)

and the iteration step is as follows:

t(i+1)=t(i)²-x(i)²+ct

x(i+1)=2 t(i) x(i)+cx

This can be generalized to 3 dimensions by adding another coordinate y, which is orthogonal to both the t and x axes:

t(i+1)=t(i)²-x(i)²-y(i)²+ct

x(i+1)=2 t(i) x(i)+cx

y(i+1)=2 t(i) y(i)+cy

These formulae were originally found out by my friend Topi Kärki, who wanted to see how the Mandelbrot fractal behaves when using quarternions instead of complex numbers. It turned out that the 4th dimension was redundant.

Demonstration

I wrote a Java applet that calculates 3-dimensional Mandelbrot and Julia fractals. As a bonus I added a Mandelbrot variant that makes use of the Julia parameters. Instead of initializing z(0)=0 it sets z(0)=d where d is the Julia parameter. This creates distorted Mandelbrot fractals.

Please do not expect the program to display any fancy rotating objects. It merely projects the 3-dimensional fractal on the tx plane, cutting 2-dimensional slices of it. You can view the y parameters as height coordinates.

The applet

There are two versions of the applet. The JDK 1.0 version should run on all Java implementations. Due to the limitations of JDK 1.0, resizing the window does not work as expected. The JDK 1.1 version reacts to resizing as expected, but it does not work in Netscape Navigator version 3.

The source code

The applet consists of 4 classes. You may use, modify and redistribute the software under the conditions of the GNU General Public License.

Viewer
The applet class, derived from java.awt.Applet
In the JDK 1.0 version, this class is called Viewer10.
Fractal
The fractal class, derived from java.awt.Canvas
In the JDK 1.0 version, this class is called Fractal10.
DoubleField
Entry field for double-precision floating point numbers, derived from java.awt.TextField
IntegerField
Entry field for integer numbers, derived from java.awt.TextField