julia_set, an Octave code which computes and plots a Julia set, the set of points in the complex plane that remain bounded under a mapping of the form f(z) = z^2+c.

We consider points (X,Y) in a rectangular domain R = [XL,XR]x[YB,YT]. Here XL=-1.5, XR=+1.5, YB=-1.5, YT=+1.5.

For every (X,Y) in R, let Z be the complex number X+Yi, and let C be some complex constant. Here, C=-0.8+0.156i.

For each Z, consider the sequence of points:

        Z(0) = Z,
        Z(k+1) = Z(k)^2 + C

The Julia set is the set of points Z in R with the property that the sequence of points Z(k) remain within R.

To compute a picture of the Julia set, we choose a discrete array of WxH points in R. We carry out up to 200 steps of the iteration for each point Z. If 1000 < |Z| at any time, we assume Z is not in the Julia set.


The computer code and data files described and made available on this web page are distributed under the MIT license


julia_set is available in a C version and a MATLAB version and an Octave version.

Related Data and Programs:


caustic, an Octave code which generates an image of a caustic, by drawing n equally spaced points in a circle, and then connecting specific pairs of points using a spacing parameter m.

epicycloid, an Octave code which plots an epicycloid curve.

fern, an Octave code which displays the Barnsley fractal fern.

fibonacci_spiral, an Octave code which displays points on a Fibonacci spiral, suggesting the arrangement of seeds in a sunflower, for instance.

hilbert_curve, an Octave code which computes the sequence of discrete Hilbert curves whose limit is a space-filling curve.

mandelbrot, an Octave code which generates an ASCII PPM image of the Mandelbrot fractal set;


  1. Heinz-Otto Peitgen, Hartmut Juergens, Dietmar Saupe,
    Chaos and Fractals - New Frontiers in Science,
    Springer, 1992,
    ISBN: 0-387-20229-3,
    LC: Q172.5.C45.P45.

Source Code:

Last revised on 23 December 2022.