Fractals on the Complex Plane

Author: Greg Paperin.

An important class of fractals are divergent and convergent fractals on the complex plain. For such fractals, every complex number z does or does not belong to the fractal set depending on the result of recursively iterating some complex function zn+1 = fc(zn).

Mandelbrot set

Probably the most famous example of this class of fractals is the Mandelbrot set. The Mandelbrot set is the boundary of the set of complex numbers c ∈ C for which the iteration of the complex quadratic polynomial zn+1 = zn2 + c, where z0 = 0, is bounded.

E.g., c = 1 gives the sequence 0, 1, 2, 5, 26… which leads to infinity. As this sequence is unbounded, 1 is not an element of the Mandelbrot set. On the other hand, c = i gives the sequence 0, i, (-1 + i), -i, (-1 + i), -i, …, which is bounded, and so i belongs to the Mandelbrot set.

When computed and graphed on the complex plane, the Mandelbrot set is seen to have an elaborate boundary, which does not simplify at any given magnification.

Julia set

Julia set is another very famous fractal that is closely related to the Mandelbrot set. The same general formula zn+1 = zn2 + c is iterated. However, while for the Mandelbrot set the value c describes the point currently tested, for the Julia set cC is a constant parameter that remains the same for each point on the plain. Instead, z0 is set to describe the tested point. Different values of c can produce very different instances of the Julia set. Using the pick function of the demo applet, try setting the Julia set parameter to values that lie within and outside the Mandelbrot set and observe some fascinating results.

Newton

In opposite to Mandelbrot and Julia sets, for Newton fractals we do not ask whether or not a complex point diverges under the iteration of a certain function. Instead, we ask to which of several attractor values a point converges.

Newton’s method is a well-known method for finding successively better approximations to the roots of a real-valued function. It can be shown that the iteration xn+1 = xn – f(xn) / f’(xn) will (usually) converge on a root of f(x). This also applies if x is complex. The best known Newton fractal is based on determining convergence basins for the roots of the complex polynomial z3 – 1 = 0. For this function, Newton’s method gives zn+1 = (2·zn3 + 1) / (3·zn2).

Colouring

When representing fractals on the complex plane, the points that do not diverge (for Mandelbrot, Julia) or respectively the points that do not converge (for Newton) are represented using some specified solid colour. The points that do escape/converge are coloured according to the number of function iterations required for crossing some bailout boundary (Mandelbrot, Julia), or for coming within a certain distance of an attractor root (Newton). In Newton fractals the points are also coloured according to the attractors on which they converge.

How to use the renderer

You need Java version 1.6 or later in order to run the renderer.
You can render a variety of fractal images using the following options:

  • Zoom view: Press this button and then select an area on the rendering canvas. A pop-up menu will appear that will allow you to zoom-in or zoom-out the view. This will allow you to explore the endless details and self-similarities of fractals.
  • Move view: While this button is pressed you can use the mouse to drag the fractal image across the rendering canvas in order to explore different areas of the plane. Simply press the left mouse button down while the cursor is above the rendering canvas, and move the image to the required position.
  • Coordinate cross: This option allows you to activate and de-activate the coordinate cross on the rendering canvas.
  • Precision: This is the maximum iteration depth, i.e. the maximum number of iterations each point is subjected to before it is considered non-divergent. A smaller number of iterations allows for quicker rendering, a larger number leads to more detailed and elaborate images. Values over 1000 iterations are typically required only under high magnifications. Select the required iteration depth using the slide control and press the Apply button below to apply the setting.
  • Fractal type: Use the drop-down box to select what fractal you want to render and press the Apply button below to apply the setting. Some fractals (e.g. Julia) require a complex number as a parameter. You will be able to enter the real (R) and imaginary (I) parameter components directly under the drop-down menu. You can also use the Pick button to select the required parameter value by hovering the mouse cursor over the rendering canvas.
  • More options: Press this button to open a window that allows you to make further settings.
  • More options > Viewport: You can select the area of the complex plane to be rendered using the zoom and move view options described above. However, you can also explicitly specify the visible area on this tab.
  • More options > Colours: Here you can specify the colours used for rendering of fractals.
    • Fractal colour: This lets you specify the colour used for rendering points that belong to the fractal set (i.e. convergent points for divergent fractals, and non-convergent points for divergent fractals).
    • Basis outlier colour: The colours of points that do not belong to the fractal set are determined by the number of iterations it takes for the point trajectory to cross a certain threshold. The basis colour acts as the base for choosing the particular shade. Points that escape quickly will typically be rendered in a colour similar to the basis colour (this does not imply that point that escape slowly may not also be rendered using a similar colour).
    • Colour gradient: This determines how smooth/quick the colours change as the number of iterations required for a point to escape a certain threshold increases.
      Use colour smoothing: If disabled, all points that diverge/converge after a given number of iterations will be rendered using the same colour. If enabled, the colours will be smoothed to obtain a more continuous gradient. This option is not available for all fractals.
  • More options > About: This tab displays developer credits for the software.

Things to try

  • Check out the fractal summary page and the fractals and scale tutorial to gain a better understanding of the theory behind this fractal image renderer.
  • Zoom into the Mandelbrot set around the edge areas.
    What do you see?
    What do you see if you zoom even further?
  • Use the pick parameter function to pick a range of parameters that lie within and outside the Mandelbrot set and then render the Julia set using these parameters.
    What do you observe?
    Try picking parameters from the main, from the secondary and from the smaller Mandelbrot discs. What do you see now?
  • Try moving the Newton fractal around. Zoom into different areas. What can you say about the dependency of the Newton method on initial iteration value? When is the Newton method applicable and when should one be careful about using it?
  • Play around with the colour settings, in particular with the gradient and the smoothing options on different zoom levels. What do you see? What is different at various magnifications levels and what is the same?

Download source code

You can download the Java source code for the renderer as a ZIP archive (135 KByte).

Links and references

Demo screenshot