The computer-generated fractals often show beautiful and curious graphic images as you can see in the Fractal Art Main Gallery or dreamlike pictures or realistic 3D landscapes as shown in the Fractal Art Gallery Annex. If you know how to program computers and are interested in creative activities in fractal art, the basic methods described in Stories about Fractal Plotting should provide you with a good starting point. You don't need to know college level math to create a large number of fascinating images, although higher math definitely helps you understand what's under the hood and get beyond the basic technical level.

Thank you for being visitor since initially posted on January 1, 1997.
The site was last updated on November 22, 2014.

Digital Artist (Author's Profile): When Junpei Sekino was 10 years old he won first prize for the junior division in a national printmaking contest in Japan. He now combines art and mathematics to create fractal art. ......from MathThematics, Book 3, Houghton Mifflin, 1998, 2008.
© 1997-2015 Junpei Sekino
Stories about Fractal Plotting

The Divergence Scheme The Convergence Scheme
Mandelbrot Fractals Julia Fractals Newton Fractals Basic 3D Fractals

Speaking loosely without technical terms such as the Hausdorff-Besicovitch dimension, a fractal is a geometric shape that is self-similar, i.e., a large part of it contains a great many smaller parts that resemble the large part in some way; see Figure 1 below. Nature is filled with fractals as seen in such objects as mountains, shorelines, trees (branches, barks and roots), ferns, fluid flow patterns, cloud formations, blood vessels and mycelium strands. Benoit Mandelbrot coined the term "fractal" in 1975 and published a book entitled "The Fractal Geometry of Nature" in 1982.

The idea of fractal was not particularly new for the computer age as some mathematicians like Cantor already conceived it in the 19th century. About a hundred years ago, a group of mathematicians represented by Pierre Fatou and Gaston Julia studied certain fractals generated by so-called "dynamical systems," and about fifty years later Mandelbrot plotted the "Mandelbrot set" using a computer and a simple dynamical system. The novelty, beauty and complexity of the computer-generated fractal reinvigorated and stimulated mathematicians to develop further theories in fractal geometry.

On the other hand, "chaos," often associated with fractals, was basically born as a brand new subject in 1974 from biologist Robert May's computer simulations of population dynamics through the dynamical system called "logistic equation," although some chaos-related phenomena such as the sensitivity to a small change in the initial condition that might cause a hugely unexpected outcome or the "butterfly effect" had been observed earlier by some mathematicians and physicists. "Chaos" received great sensations when American Mathematical Monthly published "Period Three Implies Chaos" by T.Y. Li and James Yorke in 1975. Younger mathematicians were especially excited to see the fact that there appeared very little difference between chaotic and random outcomes even though the former resulted from the deterministic process through the logistic equation. It is now known that fractals together with chaos provide not only mathematical insights into natural objects and phenomena but also surprisingly many applications in sciences, mathematics and art.

Through Google we can find lots of Internet fractal galleries, many of which display stunningly beautiful computer-generated fractal art images. This indicates that a large population not only appreciates the digital art form but also participates in the eye-opening creative activity. Written below is a guide on how to program a computer and plot popular types of fractals that are tied to chaos. Because of chaos involved, a slight change in input values (intentional or accidental) may greatly affect the pattern of the fractal output and this unpredictability provides an added excitement while running the computer program. The subject is kept less formal and mathematical with light topics added here and there so as not to be cut-and-dried. The audience, who may be merely intrigued by the general idea behind fractal plotting, is encouraged to try it. Although the basic process is not based on higher mathematics, it certainly takes intelligence and patience to get successful outcomes. The experience may at some point start to stir the participants' deep imaginations in the part of mathematics that is in fact quite profound. Best of all, though, it is plain fun.

Each of the fractals we discuss here is generated by a single equation and may be classified into one of the three categories, which I call Mandelbrot, Julia, and Newton fractals. The prerequisite for the subjects is to know (1) fundamental algebra and geometry of complex numbers, (2) beginning calculus, and (3) basic computer programming in such language as Java in a graphics mode. I use a modernized "object-oriented" version of Pascal called Delphi marketed by Borland. (1) includes the practice of writing a complex number z as a point (x,y) in the xy-plane as well as the standard algebraic expression z = x + yi. At the outset of each plotting process, we choose a rectangular canvas, part or whole of which will appear in the computer's display screen and which will be filled with a fractal at the end. The canvas comprises finitely many small rectangular picture elements, a.k.a. pixels. One of the basic routines in (3) (usually given in a programming manual) is a simple change of coordinates based on the "point-slope" equations of lines, which allows us to convert the canvas to a rectangular region R in the xy-plane consisting of points, er complex numbers (x,y). As in a basic graphics calculator routine, four real numbers called xmin, xmax, ymin, and ymax bound R.

For the sake of simplicity in our argument, we will identify each pixel in the canvas and the corresponding complex number in R, and consequently, regard the canvas and R to be the same. In particular, the number of complex numbers in R is finite so a computer can deal with "all" of them. Also, at the beginning of the process, we choose an equation such as zn+1 = zn2 + p involving two indexed variables and the third variable p called a parameter. After following the program, the computer will light up each pixel (complex number) in the canvas with a color determined by a simple interaction between the complex number (the pixel) and the equation and eventually display a fractal image on the canvas. Here comes an example:

(A) The Divergence Scheme

We begin our discussion with a small rectangular region R comprising 300 x 300 = 90,000 pixels in the xy-plane bounded by say xmin = -2.1, xmax = 2.1, ymin = -2.1, and ymax = 2.1 and the equation

(*) zn+1 = zn2 + p ,

called the Mandelbrot equation, where the parameter p is a complex number identified with a pixel in our canvas R.

The best-known figure in fractal geometry is given by iterating the Mandelbrot equation using the initial value z0 = (0, 0) for n = 0, 1, 2, ... , M, and for "every" parameter p in R. Here, M is a prescribed maximum number of iterations that rescues the computer from getting trapped in an infinite loop, and M = 500 is used in this example. M is almost always a number between 50 and 500,000 but it occasionally gets as large as 2,000,000 in my program especially when I plan to print out a high-resolution picture that requires millions of pixels. Assuming that our object is to plot a picture in black and red with a background or canvas color say white, our painting scheme is basically given by the IF statement:

  • If |z1| > 2 then color the pixel p black,
  • else if |z2| > 2 then color the pixel p red,
  • else if |z3| > 2 then color the pixel p black,
  • else if |z4| > 2 then color the pixel p red,
  • etc.,

  • where |zn| stands for the modulus or absolute value of zn. It can be shown that |zn| > 2 for some n if and only if the sequence |zn| tends to infinity as n increases; this implies that the above scheme assigns a color to each pixel p according to how quickly the complex number zn escapes from the circle of radius 2 before taking a long journey toward infinity. This basic scheme can be streamlined in the actual program by using:

  • just two variables zold and znew instead of the large array z0 , z1 , z2 , ...;
  • |zn|2 > 4 in place of |zn| > 2 to avoid the hidden square root operation; and
  • MOD operation to simplify the awkward and repetitive black-red coloring scheme.

    Also, the use of any radius greater than 2 (say 100) in place of 2 in the above scheme works just as well and in some cases even better. Computer programming has two faces, art and science, and requires artful wits as well as rigidly logical thinking. Writing, streamlining and debugging computer programs, therefore, provide us with an ideal way of exercising our brain and maintaining normal connections among the neurons. I would recommend it highly to people with computers to take up computer programming. (It's in a way funny to say it because people used to get near a computer only to run their computer programs.)

    Observe that for each pixel value p, we have a sequence of complex numbers zn , n = 0, 1, 2, ..., which moves about the complex plane, and for this reason, a generating equation like (*) is called a dynamic mathematical system or dynamical system. We may view a dynamical system as the collection of the sequences zn , one sequence for each choice of p in the canvas where the initial value z0 is fixed at a single value (like 0 in the current example) for all of the sequences. (Later we will consider a dynamical system consisting of the sequences where the initial value z0 varies in the canvas while the parameter value p is fixed at a single value for all of the sequences.)

    As we noted, the color of a pixel is determined according to the "escape speed" of the corresponding sequence zn , n = 0, 1, 2, ..., from a prescribed circle about the origin. Since all of the escaping sequences diverge to infinity, I call the coloring scheme (without limiting a number of colors) the divergence scheme. Figure 2 is given by the above basic red-black divergence scheme, and the area that retains the white canvas color depicts the famous Mandelbrot set or M set, for short. The set consists of the pixels p attached to the sequences zn that stay within the circle forever regardless of the value of n. If we alter the values of xmin, etc. and run the same program to zoom in on a small area of the plot near the boundary of the Mandelbrot set, we will discover the self-similarity property of fractals along with a hairy characteristic of the "snowman". Many microscopic shapes resembling the snowman are connected by an extremely intricate network, which we can find by zooming intently and patiently; for example, see the
    Mandelbrot Set or Elephant M Set in the gallery. Not surprisingly, it has been verified that the Mandelbrot set is one of the most complex figures ever plotted on a piece of paper.

    Here is the very essence of our fractal plotting: The closer the zoomed area is to the boundary, the finer the fractal pattern. The reason, which leads us to the idea of chaos, is that parameters p near the boundary belong to the sequences zn with diverse properties interlaced in a complex fashion. Thus, a very slight change in the value of p in this area may result in an utterly different "future behavior" of the corresponding sequence zn which dictates its escape speed and the pixel color. Yes, these sequences zn are just like people, most of whom would behave unpredictably when they are placed near an infernal border between life and death and cause chaos for the whole population in the area. What is interesting in mathematics is that chaos near the border between life (staying within the circle) and death (diverging to infinity) stems from an innocent-looking equation such as (*) and instead of ugly consequences it often produces beautiful fractal patterns. You might remember that Steven Spielberg's Jurassic Park premiered in 1993 includes a mathematician who introduced himself as a "chaotician." A chaotician obviously deals with chaotic behaviors of various dynamical systems including the Mandelbrot equation (*).

    It was in fact around the 1970s and the early 80s when several significant events coincidentally took place in mathematics: (a) People saw the computer-generated epoch-making Mandelbrot set for the first time, invigorating fractals. (b) The new field called "chaos" was born from a computer experiment and generated a great sensation. (c) Powerful computers found their way to become main tools among theoretical mathematicians who used to pride themselves on using only pencil and paper to discover recondite theories. Like in chemistry and physics, experimental investigations became important part of mathematics. (d) Apple Inc., established in a garage, produced and marketed desktop computers for the first time in the world and soon IBM followed suit with then budding Microsoft. Also a small company called Nintendo grew large as its "Pacman" became a great hit and invaded mathematicians' offices with desktop computers often munching out their office hours.

    (B) The Convergence Scheme

    The divergence scheme leaves the Mandelbrot set stuck with the canvas color since none of the parameters in the set are attached to escaping sequences. Among those sequences that stay within a finite range, many converge to a point in the set with varying speeds. We can therefore color-code each of the pixels in the Mandelbrot set according to the speed of convergence of the corresponding sequence. This convergence scheme is based on so-called Cauchy's criterion and given by replacing |zn| > 2 of the divergence scheme by

    |zn+1 - zn| < e

    where e is a small number like 10-10 x (minimum of {xmax-xmin, ymax-ymin}). Incorporating the convergence scheme and a greater number of colors into the earlier program may result in a picture like Figure 3. The gold area consists of the pixels attached to the convergent sequences while the green disks are associated with the sequences that eventually become almost periodic of period greater than one. These virtually periodic sequences neither converge to a point nor diverge to infinity, but one can still color-code the accompanying pixels in a similar fashion and add more colors to the image provided that their period is known.

    (C) Mandelbrot Fractals

    Since it was published in 1980, the Mandelbrot set became so popular that zillions of digital artists, mathematicians, and computer programmers and hackers have explored around it and shown their fractal images on a variety of objects including web pages, posters, book covers, T-shirts, and coffee mugs. Although the complexity of the M set is boundless and the hidden beauty inexhaustible, it has become quite a challenge to unearth new patterns from the Mandelbrot equation (*) using available computers and software with certain limitations. Consequently, creative work calls for modification of this formula, and there are infinitely many formulas available for this purpose. I call a fractal given by the divergence/convergence schemes applied on a dynamical system of the form

    (**) zn+1 = fp(zn)

    a Mandelbrot fractal, where fp is a function of complex numbers that contains a parameter or pixel p. For example, we may find Mandelbrot fractals using the logistic equation

    zn+1 = fp(zn) = p(1 - zn) zn .

    An initial value z0 is usually chosen from the so-called critical points of the function fp , at which the derivative vanishes, because it provides us with a better chance for a good output, but it is not mandatory from an artistic viewpoint. Just do a lot of experiments because our computers are really good at it. As you can see in the picture
    Logistic Equation, a non-critical initial point like z0 = (0.1,0) gives us certain deforming effect. The picture also shows a substantial difference between the logistic and Mandelbrot equations even though the two equations are known to be very close relatives and conceal similar fractal patterns. From the logistic equation restricted to just real numbers the term chaos was born in 1974. The primary application of the logistic equation lies in population dynamics, which explains why the chaotician got into Jurassic Park always looking worried.

    (D) Julia Fractals

    A fractal, which I call a Julia fractal, is given by fixing the parameter value p in the dynamical system (**) and iterating it for every choice of the initial value z0 (instead of p in plotting Mandelbrot fractals) in the rectangular region R (which is our canvas). Thus, z0 plays the role of a pixel in the canvas. As in the earlier case, a Julia fractal appears more interesting when the parameter value p is chosen from the area of the corresponding Mandelbrot fractal showing the sign of chaos. A Julia fractal with an appropriate p value contains what appears to be the boundary between two sets, one consisting of every z0 which keeps the sequence zn within a fixed circle and the second set consisting of every other z0. The boundary is called a Julia set, which is closely related to the idea of chaos and can have a complex topological structure.
    Gatekeepers in Figure 1 above, for example, is a Julia fractal given by

    zn+1= zn3 + zn + p, p = (0.185, 0.00007666),

    on the rectangular region with xmin = -1.1, xmax = 1.1, ymin = -0.7, and ymax = 0.7. The gatekeepers are painted by the convergence scheme with various shades of gold and the red background by the divergence scheme; thus, the Julia set in this pattern is the outline (or the boundary) of the gatekeepers. Once you find a value of p yielding a nice Julia fractal, change the value slightly to see if you can improve the picture while retaining the same motif. The corresponding change in the picture sometimes appears gradual and sometimes quite dramatic as you can see in Julia Dragons in the main gallery.

    (E) Newton Fractals

    What I call a Newton fractal is a Julia fractal given by a dynamical system of the form

    zn+1 = zn - g(zn)/g'(zn)

    where p = 0 is invisible and g is an elementary function with its derivative g'. Although g is a function of a complex variable, the familiar rules of differentiation in high school calculus hold for g. In my program, g is almost always a polynomial which allows me to take advantage of the timesaving scheme called Horner's method to efficiently and repeatedly evaluate both g and g' that appear in the dynamical system. Horner's method is nothing but "synthetic division" taught in high school algebra, and it should be interesting for you to see how (differently) it is applied in computer programming. Furthermore, as you may have recognized, the dynamical system is, in practice, Newton's Root-Finding Algorithm, and as such, each sequence converges to a root of the polynomial g quickly more often than it converges slowly or diverges. For this reason, I usually use the convergence scheme alone and a relatively small maximum number of iterations such as M = 500 to process a Newton fractal instead of between 500 and 2,000,000 for Mandelbrot and other Julia fractals. An interesting Newton fractal is a fractal that contains at least a part of the Julia set, which ironically causes a chaotic behavior of the otherwise extremely useful root-finding algorithm.

    Figure 4 above is a Newton fractal over the unit disk of the complex plane given by the polynomial

    g(z) = z3 - 1

    and the "advanced" convergence scheme, which utilizes the (known) three roots to make the number of colors increase threefold; see
    Newton's Basins of Attraction in the Main Gallery. Arthur Cayley, one of the great mathematicians of the 19th century, understood the complex nature of Newton's algorithm but apparently not to the extent of hidden chaos near the Julia set (which is precisely the borders between essentially different colors) in Figure 4. He was frustrated by a geometric problem he posed, which turned out to be equivalent to sketching the three-color Newton fractal (without the variations in lightness) by hand on a paper.

    The above example shows that in order to appreciate the true beauty of a Newton fractal, we should have the roots of the polynomial available before plotting it. The handy tool belongs to college math, however, and is called "Müller's algorithm," by which we find all the roots of a polynomial without running into problems like we do with occasionally chaotic Newton's method.

    (F) Basic 3D Fractals

    As we know by now, each pixel color is determined by the number of iterations the corresponding sequence experiences before escaping from a circle of a prescribed radius or before getting sufficiently near a fixed or periodic point in the complex plane or hitting the maximum number of iterations. This number, say w, of iterations adds one more dimension to the complex number (pixel) that already has two dimensions (x, y). Thus, each pixel is in a three-dimensional (3D) xyw-space and plotting them sometimes provides us with an interesting 3D picture.

    When a dynamical system becomes highly chaotic (which is generally good in 2D plotting), however, the variation on the altitudes w may get too noisy (or busy) and produce a messy picture. In that case, we may suppress the noise by using say log w instead of w. Such experiments are important in fractal plotting and should always be fun.

  • Links
    Google: Fractal Plotting Google: 3D Fractal Art
    Universität Kassel, Mathematics for Liberal Arts Information Page
    Pacific Northwest Section, Mathematical Association of America (Old Version)
    Scribd: Fractals Are Really Beautiful Mathematics
    Open Directory: Math > Chaos and Fractals > Fractal Art eiNET: Chaos > Fractal Art > Artists
    Benford Applied Mathematics Ciencia, Tecnología e Internet

    Return to
    Sekino's Fractal Home Fractal Art Main Gallery Fractal Art Gallery Annex
    Top of the Page Sekino's Home Page Willamette University Willamette Mathematics Department