Complex Julia Set Fractals

May 23, 20082 Comments

julia setComplex Julia Sets

A Julia set, named after French mathematician Gaston Julia, is a type of fractal defined by an iterative function over the complex numbers. The study of fractals has applications in complex dynamics, partial differential equations, statistics, etc, but most people like them because they produce pretty images. The following is an overview of how two-dimensional Julia sets work.

The Complex Numbers

the complex planeComplex numbers are numbers of the form a+bi, where i2 = -1. As these numbers have two parts (a real part and an imaginary part) they can be graphed in two dimensions. Usually, the real part (a) is plotted on the x-axis and the imaginary part (b) is plotted on the y-axis. Thus we can create a mapping to go back and forth between a point on a plane and a complex number.

Defining a Julia Set

A Julia set is the set of points on the complex plane which do not approach infinity after the function zn+1 = zn2 + c is repeatedly applied. The initial value of z0 is the point on the complex plane, and c is a constant complex number (different values of c create different Julia sets).

Here is perhaps a more simple explanation: Choose a point on the plane. That point has a corresponding complex number, which we will call z0. Take z0 and run it through the function several times - that is, square it, add c, repeat ad infinitum. If the resulting number goes towards infinity, the point z0 is not in the set (color it white). If the result does not go to infinity, z0 is in the set (color it black).

Strictly speaking, Julia sets are usually defined as either the set of divergent points (the ones that go to infinity, see wikipedia) or as the boundary of the convergent points (see mathworld). But for the purposes of creating pretty pictures, the above explanations suffice. Also, functions other than zn+1 = zn2 + c can be used. More on that later.

Interesting Properties

Julia sets are not smooth. No matter how much you zoom in, the edges will always appear jagged (except when c = 0, which gives a circle).

When c is a real number, the corresponding Julia set is symmetrical about the real axis. Otherwise the set has 180-degree rotational symmetry.

If the value of c is inside the Mandlebrot set, the Julia set will be connected and is called a Fatou set. Values of c outside the Mandlebrot set form a disconnected Julia set, also called a Cantor set or Fatou dust.

Coloring Julia Sets

julia setJulia sets can be made even prettier by adding color. The color of each point is usually determined by how fast that point diverges to infinity.

Other Functions for Julia Sets

While zn+1 = zn2 + c is the most commonly used function, a Julia set can be defined by any function over the complex plane. Commonly used functions include:

  • zn+1 = zn3 + c
  • zn+1 = c sin(zn)
  • zn+1 = c i cos(zn)
  • zn+1 = c exp(zn)
  • zn+1 = c zn (1 - zn)

z cubed plus c c sin z c i cos z c exp z c z 1-z

Rendering Julia Sets

Rendering a Julia set using a computer is rather simple using a brute-force method. Every pixel is mapped to a point on the complex plane and then run through an iterative process. If, after a certain number of iterations, the magnitude of the result is greater than a pre-defined threshold, the point is not in the set. Otherwise, the point is in the set. A greater number of iterations and a larger escape threshold value will result in a more accurate depiction of the Julia set, but also longer computation times.

Downloads

cJulia.cpp (4.42kb) - This is some simple C++ source code for creating a Julia set and writing the result to a bitmap file.

cJuliaEx.exe (80kb) - A small Windows program that renders quadratic Julia sets. Use the sliders to adjust parameters. If you want, you can take a look at the Visual C++ source code: cJuliaExSrc.zip

cJuliaExColor.exe (96kb) - Similar to the program above, except that it has more functions and is green. You can get the source code here: cJuliaExColorSrc.zip

I have to warn you about the last two programs, though. I don’t know very much about WIN32 API, so even though they work fine on my machine, the programs might be a bit wonky. If anybody wants to clean it up, make it faster (setPixel() is slow), or expand its functionality, go right ahead. But hopefully, they should work fine for you and are nice way to start exploring Julia sets.

Further Reading

The Wikipedia article on Julia sets is actually rather uninteresting. However, Paul Bourke has a good website on the topic. If you would like to read a book on the subject, Amazon has a few about fractals. I haven’t read any of them, but I’ve heard that Fractal Geometry by Kenneth Falconer is a good book (though expensive).

2 Responses to “Complex Julia Set Fractals”

  1. uhuqosot Says:

    uhuqosot…

    Real Estate Phenix City Alabama

  2. ujulezivuje Says:

    ujulezivuje…

    nc bord certification for cna

Leave a Reply