Stories about Fractal Plotting




Contents Preparations: Canvases, Dynamical Systems and Iterations
The Divergence Scheme
The Mandelbrot Set and Its Complexity
The Convergence Scheme
Mandelbrot Fractals
Julia Fractals and Julia Sets
Newton Fractals
Introductory 3D Plotting
Supplement
Fractal Coloring
Galleries
Gallery 2D
Gallery 3D
Speaking loosely without using technical terms such as the HausdorffBesicovitch dimension, a fractal is an object that is selfsimilar, i.e., a large part of it contains smaller parts that resemble the large part in some way; see Figures 0.10.5 below. Mathematician Benoit Mandelbrot coined the term “fractal” in 1975 and created a branch of mathematics called fractal geometry seven years later. As an "IBM Fellow," he had access to some of the best computers available for his research at the time.
Our world has fractals everywhere exemplified by trees, mountains, blood vessels, mycelium strands, stock market graphs, weather patterns, seismic rhythms, ECG signals and brain waves. In its article entitled "How Mandelbrot's fractals changed the world," the BBC states that fractal geometry has practical applications in diverse areas including diagnosing some diseases, computer file compression systems and the architecture of the networks that make up the Internet.
Figure 0.1. The Mandelbrot Set
 Figure 0.2. Julia Set
 Figure 0.3. Newton Fractal

The idea of fractal was not particularly new in mathematics for Mandelbrot's time or the computer age, as Georg Cantor introduced the prototypical "Cantor Set" in 1883 almost 100 years before Mandelbrot published his book entitled "The Fractal Geometry of Nature." During the early 20th century, Pierre Fatou and Gaston Julia laid the foundations for fractals generated by "dynamical systems." It was in 1980 when Mandelbrot showed the famous fractal called the "Mandelbrot set" generated by a simple dynamical system and a computer. Almost immediately after that, the novelty and complexity of the Mandelbrot set reinvigorated the interests in fractals and stimulated mathematicians to develop further theories in fractal geometry.
 Figure 0.4. Classical Fractals by Geometric Constructions


Koch Snowflake, 1904
 Sierpinski Rectangle, 1916
 Pythagorean Tree, 1942

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 the logistic equation. Like "fractal," the word "chaos" was used as a mathematical term for the first time in 1975 when the American Mathematical Monthly published "Period Three Implies Chaos" by T.Y. Li and James Yorke. The paper received a great sensation especially because there appeared very little difference between chaotic and random outcomes even though the former resulted from deterministic processes. It is now known that fractals and chaos are closely related and together they provide applications not only in sciences but also in art.
Figure 0.5. Fractals Generated by the Logistic Equation

 "Elephant Moon" painted on a sphere

Through Google, we find numerous websites that display stunningly beautiful computergenerated fractal art images. It indicates that a large population not only appreciates the digital art form but also participates in the eyeopening creative activity. Written below is a guide on how to program a computer and plot popular types of fractals generated by simple dynamical systems. It is not a text on computer programming or coding. Instead it tells the general principles needed for fractal plotting without going into too many specifics. It assumes the readers' basic programming experience and encourages them to be creative and engage in frequent computer experiments based on the essentials.
Particularly exciting is the moment the fractal image generated by our personal program emerges in our computer screen because of its rather unpredictable nature. The intricate fractal patterns often change dramatically when we alter some of the input values slightly  perhaps influenced by the unpredictable "butterfly effect" of chaos. The reader who may be merely intrigued by the general idea behind fractal plotting is encouraged to try it. Many of the images will stir our imaginations in the part of mathematics that is in fact quite deep and still filled with unknowns. Best of all, though, it is plain fun.
§ 1. Preparations
The readers who want to try it out need to know (a) fundamental algebra and geometry of complex numbers, (b) beginning calculus, and (c) basic computer programming in such language as C++, Delphi (Pascal) and Java.
(a) includes the practice of writing a complex number z as a point (x,y) in the xyplane as well as the standard algebraic expression z = x + yi and ability to do basic arithmetic of complex numbers such as multiplication, division and exponentiation. The complex plane means the set of all complex numbers z = (x,y) which coincides with the Cartesian xyplane. For each complex number z = (x,y), the absolute value of z means z = √(x^{2} + y^{2}) and it represents the distance of z from the origin O of the complex plane. More generally, if z and w are complex numbers, z  w represents the distance between the complex numbers. (b) includes the basic ideas about the
derivative and a critical point of a function where the derivative vanishes. Particularly important in (c) is a twodimensional (2D) array of numbers.
We now introduce several preliminary ideas needed for fractal plotting.
Canvases: We begin with a simple example.
Let R be the rectangle in the complex plane defined by 3 ≤ x ≤ 3 and 2 ≤ y ≤ 2 and suppose we wish to plot the graph of the inequality x^{2} + y^{2} ≤ 1 on R using a computer. We first decompose R into, say, 1,920 x 1,080 miniature rectangles of equal size called picture elements or pixels and then represent the pixels by pixel coordinates (i, j) in such a way that the upper left and lower right pixels are (0, 0) and (1919, 1079), respectively. Thus, the i and jaxes of the pixel coordinate system are the rays emanating from the upper left corner of R and pointing east and south, respectively; see Figure 1.1 shown below.
Let imax = 1920, jmax = 1080, xmin = 3, xmax = 3, ymin = 2 and ymax = 2. Then for each i = 0, 1, 2, · · ·, imax1 and j = 0, 1, 2, · · ·, jmax1, the pixel (i, j), which is a rectangle, contains infinitely many complex numbers (x, y). For our computational purpose, we choose exactly one representative (x, y) in the pixel (i, j) by setting
(1.1) Δx = (xmax  xmin) / imax; Δy = (ymax  ymin) / jmax,
(1.2) x = xmin + i Δx; y = ymax  j Δy.
Consequently, we may view R as the rectangle comprising imax x jmax = 1,920 x 1,080 pixels, each of which has a unique representative complex number. The rectangle R with the pixel structure is called a canvas for plotting the output image with the image resolution of 1,920 x 1,080 pixels.
Plotting the graph of the inequality x^{2} + y^{2} ≤ 1 on the canvas is now easy. We examine each pixel (i, j), er the representative complex number (x, y) on the canvas R. If it satisfies the inequality, color the pixel red, and otherwise, color it white. Since the coloring process uses only finitely many pixels of the canvas R, the output image that resembles the Japanese flag is an approximation of the true graph. The greater the number of pixels, the higher the image resolution and the more accurate the output image.
Figure 1.1 shows two approximations of a fractal called "Goldfish in Love." The one on the left is painted on a canvas with 50 x 32 pixels and the other on a canvas with 500 x 320 pixels.
Figure 1.1. A Fractal with Different Image Resolutions
Remarks: (1) In formula (1.1), Δx and Δy denote the dimensions of each pixel in the canvas, and they are usually constants that are specified by the computer we use. Therefore, the canvas size naturally gets larger when the image resolution gets finer.
(2) In the aforementioned discussion, no restrictions are imposed on the input numbers imax, jmax, xmin, xmax, ymin, ymax and they often produce, for example, an oval instead of the circle in the "Japanese flag" output. If the true aspect ratio in the output image is important, then input imax, jmax, xmin and xmax and program the computer to calculate appropriate ymin and ymax.
Dynamical Systems and Iterations: When we solve a mathematical problem using a computer, we usually do it by exploiting what the machine does best, namely an iteration, which means repeating a certain process over and over, often for thousands or even millions of times, at a blinding speed. As an example of iterations, consider the equation called the Mandelbrot equation
(1.3)
z_{n+1} = z_{n}^{2} + p ,
which involves two indexed variables z_{n+1} and z_{n} and the third variable p called a parameter. All variables vary through complex numbers. The iteration index n is especially important for fractal plotting and it is there for us to iterate the equation to generate a sequence of numbers once the value of p and initial value z_{0} are given. For instance, let p = 2 and z_{0} = 0. Then setting the index n = 0, 1, 2, · · · in (1.3), our properly programmed computer iterates (1.3) and calculates the sequence of numbers
z_{1} = z_{0}^{2} + p = 0^{2}  2 = 2 ,
z_{2} = z_{1}^{2} + p = (2)^{2}  2 = 2 ,
z_{3} = z_{2}^{2} + p = 2^{2}  2 = 2 ,
and similarly, z_{n} = 2 for n = 4, 5, 6, · · · . If we hold the value of z_{0} at z_{0} = 0 and change the value of p from p = 2 to p = 1.9 in (1.3) then the computer again iterates (1.3) and calculates thousands of terms within a fraction of a second to give us the sequence of numbers
z_{0} = 0, z_{1} = 1.9, z_{2} = 1.71, z_{3} = 1.0241, · · · , z_{30} = 1.1626, z_{31} = 0.5483, · · · .
Similarly, if we leave the value of p fixed at p = 2 and change the value of z_{0} from z_{0} = 0 to z_{0} = 0.1, we get
z_{0} = 0.1, z_{1} = 1.99, z_{2} = 1.9601, z_{3} = 1.842, · · · , z_{30} = 0.7157, z_{31} = 1.4877, · · · .
Note that the behavior of the sequence may change drastically if we alter the value of p or z_{0} slightly. We exploit such changes to draw an intricate fractal with a variety of colors.
We have shown only real sequences for simplicity, but actual numbers involved in fractal plotting are complex numbers in the complex plane. Thus, the Mandelbrot equation (1.3) comprises infinitely many sequences of complex numbers, one sequence z_{n} for each choice of values of p and z_{0}. Because most of the infinitely many sequences hop around in the complex plane as n increases, it is appropriate to call the Mandelbrot equation a dynamic mathematical system or dynamical system. As we shall see in § 5, there are infinitely many dynamical systems including (1.3) and the logistic equation (5.3) that can be used for fractal plotting.
pCanvases, zCanvases, Orbits, and a Preview of § 2  § 7: Although the following idea applies on a wider variety of dynamical systems, consider, for the sake of simplicity, the dynamical system (1.3) with a fixed value of z_{0}, say, z_{0} = 0. As we have seen then, each value of p in (1.3) generates a sequence z_{n} of complex numbers, which we call the orbit of p (with the fixed value of z_{0}). "Sequence" and "orbit" generally have a subtle difference in mathematics but we won't distinguish them here for simplicity.
Recall that a canvas is a rectangle in the pixel coordinate system comprising r x s pixels with r = imax and s = jmax and that each pixel is identified with a unique complex number. Interpreting these complex numbers as values of p in (1.3), we call the canvas a pcanvas (with the fixed value of z_{0}) for the dynamical system (1.3). Thus for each p in the pcanvas, we have a unique orbit of p, and as we shall see in § 2  § 5, we plot a fractal called a "Mandelbrot fractal" on the pcanvas by examining certain behaviors of the orbits. Figure 1.2 shows a few examples.
Figure 1.2. Mandelbrot Fractals Painted on pCanvases
"Untitled"

 "Jellyfish Couple"

Now, suppose p is a fixed constant in the dynamical system (1.3) while z_{0} is a variable. Then by the symmetric argument, we can talk about a zcanvas comprising finitely many pixels interpreted as values of z_{0}. Each z_{0} gives rise to a unique sequence z_{n} (with the fixed value of p) called the orbit of z_{0}, and as we shall see in § 6, we plot a fractal called a "Julia fractal" on the zcanvas by looking at certain behaviors of these orbits.
Figure 1.3. Julia Fractal Painted on zCanvas
There is a special subset of the Julia fractals, consisting of fractals generated in essense by "Newton's rootfinding algorithm." The fractals in the subset are called "Newton fractals," which we will discuss in § 7.
Figure 1.4. Newton Fractal Painted on zCanvas


Back to the
Top


§ 2. The Divergence Scheme
We say that a sequence z_{n} of complex numbers diverges to ∞ if the real sequence z_{n} diverges to ∞, i.e., if z_{n} gets further away from the origin of the complex plane without bound as n gets larger. Our goal of § 2 is to introduce the fractal plotting technique associated with the notion of divergence of orbits of p using the aforementioned Mandelbrot equation (1.3) as an example.
Define a function f_{p} of a complex variable z involving a complex parameter p by setting f_{p}(z) = z^{2} + p and write the Mandelbrot equation as
(2.1) z_{n+1 }= f_{p}(z_{n}) = z_{n}^{2} + p.
The derivative of the function f_{p} is f_{p}'(z) = 2 z so the critical point of f_{p} is z = 0. As we go on, it will become clear why the critical point is important and why we often (but not always) use a critical point as the initial value z_{0}. If z_{0} is a critical point, we call the orbit of p a critical orbit. Throughout § 2  § 4, we set
(2.2) z_{0} = 0,
so all orbits are critical orbits of p.
Suppose R is the square in the complex plane with center 0 and radius 2.1, so it is bounded by xmin = 2.1, xmax = 2.1, ymin = 2.1, and ymax = 2.1, and regard R as the pcanvas with an image resolution of 400 x 400 = 160,000 pixels. As we have seen in the preliminary ideas, we may identify each pixel in the canvas with a unique parameter p in R. Paint the whole canvas white initially.
Let M = 500 and for every pixel, er parameter p, in the pcanvas R, iterate (2.1) at most M times. Thus, M is the maximum number of iterations, which is intended to "approximate" ∞ and also thwart the computer to get trapped in an infinite loop. Here's a simple instruction to our computer:
If
z_{1} > 2 then color the pixel p black ,
else if z_{2} > 2 then color the pixel p red ,
else if z_{3} > 2 then color the pixel p black ,
· · ·
else if z_{M} > 2 then color the pixel p red .
It can be shown that
(†)
z_{m} > 2 for some m if and only if the orbit z_{n} of p diverges to ∞ ;
hence the above scheme assigns a color to each pixel p in the pcanvas R according to how quickly the orbit z_{n} of p escapes from the circle of radius 2 before taking a long journey toward ∞. We call the algorithm the divergence scheme.
The divergence scheme can be streamlined in an actual computer program by using:
just two variables zold and znew instead of the array z_{0} , z_{1} , z_{2} , ... , z_{n} , ... ,
a greater number of colors, and
z_{n}^{2 }> 4 in place of z_{n}
> 2 to avoid the square root operation hidden in the absolute value.
The Mandelbrot Set: By definition, the famous Mandelbrot set, or the M set for short, is the set of all complex parameters p whose critical orbits do not diverge to ∞, or equivalently, the set of all parameters p whose critical orbits stay within the circle of radius 2 forever. The white "snowman" of Figure 2.1, which is left untouched by the above redblack divergence scheme and retains the initial white canvas color, depicts an approximation of the Mandelbrot set on the pcanvas given by replacing "forever" by "up until M = 500 ". Theoretically, such approximation gets better as M gets bigger, but for our small canvas of 400 x 400 pixels, the use of any M > 500 will just waste the computing time without improving the output image.
Choosing Good pCanvases: (†) implies that the Mandelbrot set stays within the circle of radius 2, which explains why we chose the pcanvas to be the square of radius little over 2. We also note in Figure 2.1 that the redblack pattern gets more intricate in areas nearer the boundary of the Mandelbrot set. It explains why we almost always zoom in on a small neighborhood of a point near the boundary of the Mandelbrot set so as to produce good fractals from the Mandelbrot equation (2.1). It is extremely unlikely to get something interesting without knowing a "global image" of the Mandelbrot set such as Figure 2.1.
Example: The images shown below are "local images"given by zooming in on small neighborhoods of points that are just outside of the Mandelbrot set but very near its boundary. The one on the top is a cropped and resized image from a fractal on a large pcanvas with 6400 x 3200 pixels centered at the point (0.2820607, 0.011014375) with the horizontal radius 0.0000011. The large canvas and M = 100,000 are used to allow a high resolution printout. The part of the Mandelbrot set shown in the figure is painted black and the exterior of the Mandelbrot set by multiple colors using the tequniques described in Sekino's Fractal Coloring. Note that the figure shows several replicas of the snowman painted black that look like small isolated islands.
Figure 2.2. Fractals by the Mandelbrot Equation and the Divergence Scheme
Threshold Values: The nimber, 2, in the inequality z_{n}
> 2 is called a threshold value of the divergence scheme for the Mandelbrot set. Interestingly, (†) implies that we can actually use any radius greater than 2, say 10, as a threshold value, so z_{n} > 10 works just as well or even better sometimes in plotting fractals from the Mandelbrot equation. Such observation becomes important when we deal with a different dynamical system without knowing what number to use as a threshold value.
Computer Experiment/Experience: There are numbers in fractal plotting which we can find only by trialanderror computer experiments or by educated guesses based on our experience. For example, a good maximum number of iterations M depends not only on the size of the canvas but also on the location such as (0.2820607, 0.011014375) shown in the preceding example and we can find it through experiments and experience. A lot of things in fractal plotting get easier with experience.
.
§ 3. The Mandelbrot Set and Its Complexity
The Mandelbrot set is famous for a reason and it turned out to be one of the most complex figures ever plotted on a plane. Although it may not sound obvious unless we know something about fractal dimensions, the following celebrated theorem guarantees that no figures on the plane are more complex than the Mandelbrot set.
Shishikura's Theorem: The fractal dimension of the boundary of the Mandelbrot set is the same as the dimension of the plane, namely 2.
If we apply the divergence scheme on the Mandelbrot equation (2.1) with a greater number of colors and zoom in on a microscopic area near the boundary of the "snowman" in Figure 2.1, we find an unlimited variety of complex images including those in Figure 1.2 and Figure 2.2. Here's another example: Figure 3.1 is a cropped/resized image from a fractal on the pcanvas with 4,000 x 4,000 pixels centered at the point
p = (0.25000316374967, 0.00000000895902)
with a microscopically small radius ≈ 0.0000000000001 = 10^{13}. We note that the body of the white snowman in Figure 2.1 is bounded by a "cardioid," whose cusp (or sharp point) is at the point (0.25, 0); it is very near the point p.
Figure 3.1. A Snowman Under the Microscope
M = 1,500,000

 M = 500,000

The picture shows a replica of the "snowman" at the center but it actually contains (theoretically) infinitely many such replicas. With experience our eyes become sharper in spotting where many of the replicas hide and it helps us realize that the Mandelbrot set is indeed selfsimilar and a fractal in that sense. By the definition of the Mandelbrot set, the "colorful" area (which is painted in colors other than black) depicts outside or the complement of the Mandelbrot set. Here is another amazing theorem:
The DouadyHubbard Theorem: The Mandelbrot set is connected.
So, all of the replicas of the snowman are connected by an invisible network that belongs to the Mandelbrot set, thereby shaping the intricate and complex pattern shown in Figure 3.1. It is also known that the Mandelbrot set is "simply connected," i.e., the connecting network has no loops. Not surprisingly, therefore, it is also true that the complement of the Mandelbrot set comprising all those colorful pieces is connected as well.
Plotting the boundary of the snowman with reasonable accuracy always demands a higher maximum number M of iterations because of ∞ involved in the definition of the Mandelbrot set, and for the picture on the left in Figure 3.1, we used whopping M = 1,500,000. If we use M = 500,000 (still a large number) instead, the outline becomes blurry as shown in the picture on the right. It is astounding that the difference between the two pictures comes from so many additional iterations of the Mandelbrot equation.
Digression: I have two Pentium XP machines with 4 gigabytes of RAM and use one of them to do tedious and timeconsuming jobs. Many of the jobs involve a large canvas with as many as 6,400 x 6,400 pixels and often require days or even weeks of computing time. I bought the workhorse used for $89 by net shopping in 2015. We live in a good world, where computers are inexpensive and minimizing computing time is not such a big deal as it used to be.
Project for Multivariable Calculus Students: Computersavvy students who are used to draw geometric shapes such as spheres and pyramids in the threedimensional (3D) space can devise fun projects of creating 3D landscapes in digital art. In Figure 3.2 shown below, the first image is another closeup of the boundary of the Mandelbrot set and parts of it are mapped onto the sphere, cone and pyramids. Note that the 2D fractal image is also used as the night sky. In this website, we often plot fractals on nonplanar surfaces including spheres and tori so as to indicate expanded possibilities.
Figure 3.2. The Mandelbrot Set Near p = (0.68852, 0.27985) on Various Surfaces
Errors in Computation: Aside from programming bugs and other human errors, fractal plotting entails two unavoidable errors, each of which contributes to a loss of mathematical precision in the output. One is the truncation error resulting from "truncating" the infinite process after the finite number of steps given by M and the other is the roundoff error caused by our "imperfect" computer that has to round almost every real number involved. In my program, M is usually between 500 and 100,000 but it occasionally gets as large as 1,500,000 as shown in the above example. Using larger M is better in theory as it reduces the truncation error but is worse in practice as it makes the computing time longer and at the same time causes more roundoff errors to propagate. Balancing the good and the bad to find an optimum number M is a difficult problem in computing. Although it is not an issue if our goal is in art, it is something we should keep in our mind. Computers are great tools for mathematical research but they mislead us from time to time.
§ 4. The Convergence Schemes
We are not done yet with the complexity of the Mandelbrot set and still stay with it. The Mandelbrot set has become so illustrious, everybody with at least some interest in fractals knows its "snowman" shape in Figure 2.1 by heart: The main body is in the form of a heartshaped "cardioid" with a bunch of circular disks attached, and to each of the disks another bunch of disks are attached. The pattern repeats as if the cardioid has children, grandchildren, great grandchildren and so on so forth, but beyond that nobody knows exactly what's happening. Here, the cardioid means the bounding curve together with its interior.
As we have seen, the divergence scheme paints the cardioid and all of the disks in a single color like white as it is incapable of distinguishing them. Our current goal is to find their distinguished mathematical properties and paint them in various colors, like Figure 4.1 below, by developing a scheme that is different from the divergence scheme.
Figure 4.1. The Mandelbrot Set in Colors
A sequence z_{n} of complex numbers is called a cycle if there is a positive integer k satisfying z_{n} = z_{n+k} for any index n. The smallest such integer k is called the period of the cycle, and a cycle with period k is called a kcycle for short. For example, the sequence
1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, · · ·
is a 3cycle but not a 6cycle or a 9cycle. The sequence 0, 0, 0, 0, · · · is a 1cycle, which we identify with the constant 0. A sequence z_{n} is said to converge to a kcycle if it acts more and more like the kcycle as n gets bigger.
Example 1: The sequences 1/2, 1/3, 1/4, 1/5, 1/6, · · · and 1/2, 2/3, 3/4, 4/5, 5/6, · · · converge to the constants 0 and 1, or equivalently, to the 1cycles 0, 0, 0, 0, · · · and 1, 1, 1, 1, · · ·, respectively. Therefore, the sequence
1/2, 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 4/5, 1/6, 5/6, · · ·, 1/1000, 999/1000, 1/1001, 1000/1001, · · ·
converges to the 2cycle 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, · · ·, 0, 1, 0, 1, · · ·.
People who are familiar with the socalled "(N, ε) arguments" can define the aforementioned notion of convergence in a precise way and easily prove the following key fact for our purpose:
Theorem: If a sequence z_{n} converges to a kcycle then for any ε > 0, there is an integer N such that n > N implies
(4.1) z_{n+k}  z_{n} < ε.
Thus, our convergence scheme with period index k is given by replacing z_{n} > 2 of the divergence scheme by the inequality (4.1), where ε is a small positive real number such as 10^{6} or min{Δx, Δy}; see (1.1) and Computer Experiment/Experience.
The convergence scheme with period index k is intended to detect every parameter whose orbit converges to a kcycle and also the "speed of convergence" of the orbit that is used to color the parameter (pixel) just like the divergence scheme. We will talk about "a parameter whose orbit converges to a kcycle" frequently, so let's call it a parameter of period k for short. In particular, a parameter of period 1 is the same as a parameter whose orbit converges to a single point (1cycle).
Figure 4.2. Images by the Divergence Scheme (Left) and the Convergence Schemes
Example 2: The images in Figure 4.2, which complement each other well, are given by applying the divergence scheme and the convergence schemes to the Mandelbrot equation. The convergence scheme with period index k = 1 detected that the interior of the cardioid of the Mandelbrot set comprises parameters of period 1 and painted it red, and the convergence scheme with period index k = 2 detected that the interior of the largest disk comprises parameters of period 2 and painted it orange. The repetitive use of the convergence schemes up to k = 20 with various colors generated the image on the right. Figure 4.1 is given by combining the two images together and using the technique of fractal shading; see Sekino's Fractal Coloring.
Periodicity Diagram: If we use the convergence schemes and label the cardioid with its periodicity 1, the largest disk with its periodicity 2, etc., we get a diagram similar to Wikipedia's Periodicity Diagram instead of the colorful image shown above. The periodicities in the diagram have interesting numerical patterns that are easy to recognize and will play a crucial role when we plot colorful "Julia sets" in § 6. This is another property of the amazing Mandelbrot set.
Weakness of the Convergence Scheme: The convergence scheme is based on the aforementioned theorem whose converse is unfortunately not necessarily true. For example, the convergence scheme with k = 1 may be fooled by an orbit that diverges to ∞ very slowly and treat it like a convergent orbit. Secondly, the convergence scheme obviously confuses a parameter of period, say, 3 with a parameter of period 6 or 9. For almost all practical problems, however, we can overcome these shortcomings by carefully programming a computer to do the right thing.
The Eyeball Effect: The weakness of the convergence scheme mentioned above is not entirely bad as it sometimes acts up and gives us an interesting pattern. The picture below on the left is essentially the same as Figure 3.1 and is given by the divergence scheme alone while the one on the right is painted by the divergence scheme (with different colors) and the convergence scheme with k = 1. The "eyeballs" painted by the convergence scheme show which parameters are affected. Figure 6.7 illustrates the effect more vividly.
Figure 4.3. The Eyeball Effect (Right) Given by the Convergence Scheme
Filling "Holes": We have seen that the big black "hole" shown in Figure 4.2 can be filled nicely by the convergence schemes to generate an image like Figure 4.1. Now the question is: Can we do the same with the black hole shown in Figure 4.3 ? If the numerical pattern of the periodicity diagram extends on the entire Mandelbrot set, the little hole is probably associated with astronomically large periods, and finding them by the convergence schemes so as to color the hole simply takes too long―like thousands or millions of years, even by today's modern computers. There is another technique also shown in Fractal Coloring, however, and Figure 4.4 shows an example, where we painted the fractals on spheres for a change.
Figure 4.4. Before (Left) and After Plugging a "Hole" in a Fractal
§ 5. Mandelbrot Fractals
Since it was published in 1980, the Mandelbrot set became so popular that a great many digital artists, mathematicians and computer programmers have explored around it and shown their fractal images on a variety of objects including webpages, posters, book covers, Tshirts, and coffee mugs. Although the complexity of the Mandelbrot set shown on a twodimensional canvas is boundless and the hidden beauty inexhaustible, it has become quite a challenge to unearth new patterns from the Mandelbrot equation (2.1) using available computers and software. Consequently, a creative work calls for a modification of the formula, and there are infinitely many formulas available for it.
We call a fractal given by a dynamical system of the form
(5.1)
z_{n+1 }= f_{p}(z_{n})
a Mandelbrot fractal if it is painted on a pcanvas, where f_{p} is any nonlinear elementary function containing a parameter p. The initial value for the orbits is often a critical point of f_{p} as in the case of the Mandelbrot set but it is not a requirement. There are functions f_{p} without convenient critical points, and even if f_{p} has one, a noncritical point often produces interesting fractals from f_{p}. We always have the advantage of having a fast computer that allows us to satisfy our curiosity by engaging in a computer experiment.
Figure 5.1. "Snowman" Shot by Arrow
The comical image shown above is a Mandelbrot fractal given by
(5.2)
z_{n+1 }= f_{p}(z_{n}) = z_{n}^{3} + z_{n} + p
with z_{0} = i / √3 which is a critical point of f_{p}. The tip of the arrowhead is at the origin (0, 0) of the pcanvas and the tiny isolated figure on the right is another snowman (who propelled the arrow); see the inset for an enlarged image. Here, the picture is actually given by rotating the output fractal 90^{o} counterclockwise to better fit in the webpage. In this article, we use rotations and horizontal/vertical reflections of fractal images freely for artistic effects.
The image shown below is a Mandelbrot fractal given by zooming in on the boundary of the tiny snowman. We often use it as a night sky of 3D landscapes like in Figure 5.2 and Figure 5.3 shown below. § 9 explains how to plot such 3D images.
Figure 5.2. "Mandelbrot Island"

 Figure 5.3. "Desert Rocks"

The Logistic Equation: In 1838 Pierre Verhulst introduced a differential equation called the "logistic equation," which became a widely used mathematical model for population dynamics. If we replace the derivative in the equation by its approximating difference quotient and do some algebra, we get the following formula that is more suitable for computer applications:
(5.3)
z_{n+1 }= f_{p}(z_{n}) = p(1  z_{n}) z_{n }.
It is again called the logistic equation (or logistic map) and is equally applicable in the population dynamics when the variables are restricted to real numbers.
In 1974, while conducting a computer simulation of certain population change, biologist Robert May discovered "very complicated orbits" of (5.3), which led us to the concept of chaos. In 1993, a "chaotician" appeared in Steven Spielberg's hit movie, "Jurassic Park," tacitly suggesting a possibility of chaos in the controlled dinosaur populations.
Figure 5.4. "Bifurcation"
So, it is natural that we plot Mandelbrot fractals of the dynamical system (5.3) by expanding its variables to complex numbers; see Figure 0.5. The source of chaotic orbits Robert May discovered is the real interval [α, 4] with α ≈ 3.57, which is a part of the horizontal "antenna" at the right edge of the "global" image (first image) of Figure 0.5. Figure 5.4 above is given by zooming in on a microscopic neighborhood of a point in the interval. In this example, a noncritical point z_{0} = 0.1 is used for a certain deforming effect.
By the way, people familiar with multivariable calculus might find a fun project in mapping an image like Figure 5.4 on surfaces like the ones shown below. We can see more examples of this sort in Gallery 3D.
The next two images are Mandelbrot fractals given by the cubic equation motivated by the Logistic Equation:
(5.4)
z_{n+1 }= f_{p}(z_{n}) = p(1 + z_{n})(1  z_{n}) z_{n }.

 Figure 5.5. "Rising Dragon"

§ 6. Julia Fractals and Julia Sets
Recall that a Mandelbrot fractal is generated by a dynamical system of the form (5.1) with a fixed initial value z_{0} and painted on a pcanvas comprising parameters p. A fractal is called a Julia fractal if it is given by a dynamical system of the same form with a fixed parameter p and painted on a zcanvas comprising initial values z_{0} instead. It is named after Gaston Julia, who was one of the early pioneers of fractals generated by dynamical systems.
For example, consider (again) the Mandelbrot equation
(6.1) z_{n+1 }= f_{p}(z_{n}) = z_{n}^{2} + p.
Figure 6.1 shows two nearly equal parameters and two Julia fractals given by (6.1) and the respective parameters. The first parameter belongs to the interior of the Mandelbrot set and the second parameter just outside but near the first parameter. We call the Julia fractals "Hydra of Lerna with Eleven Heads" and "Hydra's Ash," respectively. The green/blue Hydra on the left is painted by the convergence scheme with period index k = 11 and its background by the divergence scheme. Hydra's ash is given by the divergence scheme alone.
Figure 6.1. "Hydra of Lerna with Eleven Heads" and "Hydra's Ash"
Julia Sets: If p is a fixed complex value in (6.1), let S be the set of all initial values z_{0} in a sufficiently large zcanvas whose orbits do not diverge to ∞. By the Julia set of (6.1) with the fixed value of p or simply the Julia set of p, we mean the boundary of the set S. We then refer to the set S as the filled Julia set of p. For example, the Hydra shown above on the left is a filled Julia set and its boundary the Julia set of p; the Hydra's ash on the right is also a Julia set. The zcanvases are "sufficiently large" as they cantain the entire Julia sets. As we shall see, a Julia set of p is more intricate when p is closer to the boundary of the Mandelbrot set and it is what makes a Julia fractal visually delightful.
Note that the definition of the filled Julia set is very similar to that of the Mandelbrot set. Like the boundary of the Mandelbrot set whose extreme complexity was discussed in § 3, the Julia set is also among the most important objects in fractal geometry. It displays a variety of fractal and topological structures and it is also the source of chaotic orbits.
The concept of Julia set naturally extends to any polynomial in z_{n} (and more general dynamical systems with some modifications) and it appeared well before the computer era. The following theorem was established around 1920 and explains why the critical orbits are important in general and why the Mandelbrot set was built on the critical orbits of p in the first place.
The FatouJulia Theorem: Consider a dynamical system of the form
(6.2)
z_{n+1 }= f_{p}(z_{n}) = c_{m} z_{n}^{m} + c_{m1} z_{n}^{m1} + · · · + c_{2} z_{n}^{2} + c_{1} z_{n} + p ,
where m is an integer ≥ 2 and c_{m}, c_{m1}, · · ·, c_{2}, c_{1} are constants. Then the Julia set of (6.2) with a fixed value of p is connected if and only if every critical orbit of p stays within a finite bound.
Note that if m > 2 in (6.2), p may have multiple critical orbits as f_{p} may have multiple critical points. In case of the Mandelbrot equation (6.1), each p has a single unique critical orbit; hence the FatouJulia theorem is stated beautifully as:
The Julia set of p is connected if and only if p belongs to the Mandelbrot set.
For the Mandelbrot equation, it is also known that if the Julia set of p is disconnected then it must be a "totally disconnected" powderlike fractal called Cantor dust (named after Georg Cantor, the pioneer of set theory) and cannot be the disjoint union of, say, three connected components. For example, because of our choice of the parameters in Figure 6.1, the boundary of the Hydra on the left depicts a connected Julia set and the Hydra's ash on the right Cantor dust.
Figure 6.2. "Julia Lions" of Periods 14 and 42 by the Mandelbrot Equation
Plotting Julia Sets: Consider the Mandelbrot equation (6.1) first and recall (§ 4) that we can actually build a diagram similar to the Periodicity Diagram for the Mandelbrot set. Use the diagram and pick a disk of periodicity, say 14, attached to the cardioid just above its cusp, and choose a parameter p in the interior of the disk, say p = (0.296498, 0.020525); see how to choose good parameters.
The "gold lion" shown above on the left is painted by using (6.1) with p and the convergence scheme with period index k = 14 on a zcanvas centered at the origin and its background by the divergence scheme. So, the gold lion is precisely the filled Julia set of p = (0.296498, 0.020525). Since p is inside the Mandelbrot set, it follows from the FatouJulia Theorem that the Julia set which is the boundary of the lion is connected and so is the lion.
Again using the periodicity diagram, pick a disk of periodicity 42 attached to the aforementioned disk of periodicity 14. It can be done easily by noting 42 = 14 x 3 and simple numerical patterns shown in the diagram. The gold "lion" shown above on the right is given by choosing a parameter, say p = (0.296555, 0.020525), in the interior of the new disk and using the convergence scheme with period index k = 42. Recall that we use rotations and horizontal/vertical reflections of fractal images freely for artistic effects.
We can clearly see number 14 reflected in the shape of the left lion in Figure 6.2 above, but how about 42 = 14 x 3 in the right lion? If you note that the lions in Figure 6.3 below share the same period 85 = 17 x 5 and that they are not mirror images of each other then you have the right idea and sharp eyes. They are given by two parameters in the same disk but different locations that dictate the "curling" directions.
Figure 6.3. "Julia Lions" of What Period?
Additional examples of Julia sets coming out of the Mandelbrot set are shown in Gallery 2D. It tells us the astounding facts about the Mandelbrot set: In addition to the properties shown in § 3  § 4, the Mandelbrot set conceals infinitely many varieties of Julia sets!
Julia Sets by Other Dynamical Systems: We can follow the same process using the logistic equation (5.3) instead of the Mandelbrot equation. Figure 6.4 shown below is given by building a periodicity diagram based on the "global image" of Figure 0.5 and choosing a parameter in the interior of a disk of period 2.
Figure 6.4. "Dancing Seahorses" by the Dynamical System (5.3)
Figure 0.2 shown at the outset of this website is a Julia fractal generated by the dynamical system (5.2), for which the FatouJulia Theorem is applicable. Here, p = (0.185, 0.00007666) and the gold "twin dragons" is painted on a zcanvas centered at the origin by the convergence scheme with period index k = 2. If we alter the value of p and find its period, we get a variety of "twin dragons" including the pictures shown below.
Figure 6.5. "Twin Dragons" by the Dynamical System (5.2)
And here is another by a different dynamical system:
Figure 6.6. "Twin Dragons" by the Dynamical System (5.4)
Similarities of Mandelbrot and Julia Fractals: Although the precise reason is unknown, we note that in many cases Mandelbrot and Julia fractals from the same dynamical system have similar appearances "locally" if they are generated by nearly equal parameters. For example, the image below on the left is a Mandelbrot fractal given by the logistic equation (5.3) on a microscopic neighborhood of p = (3.000008596, 0.076065598) and the one on the right is a Julia fractal from the same equation with the fixed parameter q = (3.001, 0.075975) ≈ p.
"Fractal Elephants" by the Logistic Equation
The image on the left in Figure 6.7 below is a Mandelbrot fractal given by the Mandelbrot equation (6.1) on a pcanvas centered at p = (0.25000316374967, 0.00000000895902) that belongs to the body of the black "snowman." It is essentially the same as the images in Figure 3.1 whose amazing complexity was discussed in § 3; see Figure 4.2. As we mentioned in § 4, the period of p is unknown and probably astronomically large.
The image on the right is a Julia fractal given by the fixed parameter p on a zcanvas centered at the origin. Both images contain infinitely many "cuttlefish" with their eyeballs given by the eyeball effect of the convergence scheme. The divergence scheme painted all other areas except for the black "holes." Just like the Mandelbrot set described in § 3, the filled Julia set in the Julia fractal on the right comprises infinitely many black holes connected by invisible networks and it shapes the colorful and intricate Julia fractal.
The examples show that a Julia fractal can be as complex as the Mandelbrot set "locally," but even more impressive is the fact that the complex pattern is just one of the infinitely many varieties the Mandelbrot set possesses. This is just one of the facts showing that the Mandelbrot set is incomparably more complex than any of the Julia sets even though a Julia set can have an enormously complex structore.
Figure 6.7. "Partying Cuttlefish" by the Mandelbrot Equation
§ 7. Newton Fractals
A Julia fractal is called a Newton fractal if it is given by a dynamical system of the form
(7.1)
z_{n+1 }= z_{n}  g(z_{n})/g'(z_{n})
where the parameter 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 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 the reader to see how (differently) it is applied in computer programming.
The reader may have noted already that the dynamical system (7.1) is nothing but the NewtonRaphson RootFinding Algorithm, aka
Newton's Method. Hence, each orbit of (7.1) converges to a root of g quickly more often than doing something else, and it allows us to plot most of the Newton fractals by the convergence scheme (with period index k = 1) alone with a relatively small maximum number of iterations like M = 500.
Furthermore, if we know all the roots of g prior to the fractal plotting, we can modify the convergence scheme fairly easily so as to add more colors to Newton fractals of g. Because a Newton fractal is a Julia fractal, a "canvas" and an "orbit" always mean a zcanvas and an orbit of z_{0}, respectively, in this section.
Example 1 (Roots of Unity): Probably the simplest Newton fractals to plot are given by a polynomial of the form
g(z) = z^{ d}  1
as its roots are readily available by hand calculations or Googling "roots of unity."
Figure 7.1. Newton Fractals of g(z) = z^{ 5}  1
"Crab Queue"
The leftmost image of Figure 7.1 is a Newton fractal for g(z) = z^{ 5}  1 painted on a square canvas centered at the origin with radius 1.1. It uses five essentially different colors, sky blue, purple, red, amber, and blue, associated with the five roots of g. The sky blue region, e.g., comprises the initial values z_{0} in the canvas whose orbits converge to the root r = (1, 0) and is called the basin of attraction of Newton's method for the root.
Thus, there are five basins of attraction in the leftmost fractal and they are divided by the basin boundary. The basin boundary is precisely the Julia set of the Newton fractal, and that is where Newton's rootfinding algorithm behaves in a "chaotic" fashion and fails to provide a root. As we can see clearly, a Newton fractal is totally uninteresting unless it contains a part of the Julia set—just like the Julia fractals discussed in the preceding section. It is known that the Julia set is Cantor dust.
The second image of Figure 7.1 is a variation of the first and the third is given by zooming in on one of the "bands" in the second image.
Example 2 (Cyclotomic Polynomials): Another interesting example with known roots is a
Cyclotomic Polynomial. The picture on the left in Figure 7.2 is a Newton fractal of the "30th cyclotomic polynomial"
g(z) = z^{ 8} + z^{ 7}  z^{ 5}  z^{ 4}  z^{ 3} + z + 1
with the unit disk highlighted. Since g happens to be a factor of z^{ 30}  1, its roots are among the 30th roots of unity that lie on the unit circle. In the picture, the thirty dots on the unit circle show where the roots of unity are located and eight of them colored yellow show the whereabouts of the roots of g. The picture on the right is a Newton fractal of the "20th cyclotomic polynomial"
g(z) = z^{ 8}  z^{ 6} + z^{ 4}  z^{ 2} + 1.
Figure 7.2. Cyclotomic Polynomials with Eight Roots
Finding the Roots: As we have seen, a Newton fractal of a polynomial with colorful basins of attraction requires its roots to be known. So, if we don't know the roots, how can we find them? A natural choice seems to be the use of Newton's method, but unfortunately, its chaotic nature makes it difficult to program a computer and consistently find the roots. Another way is to use Müller's Method instead. Although Müller's method lacks the impressive simplicity and speed of Newton's method, it generally works well and automatically finds all roots of the polynomial. All Newton fractals shown in Gallery 2D use Müller's method even when the polynomials have known roots.
Figure 7.3 is a Newton fractal of a fifth degree polynomial whose roots are given by Müller's method. Just for fun, we painted it on a plane, a sphere and a torus.
Figure 7.3. Newton Fractal on Plane, Sphere and Torus
Figure 7.4 shows a Newton fractal of a 12^{th} degree polynomial painted on a plane and a sphere. The second image which is on a sphere is intended to give a 3D appearance. All of the twelve roots are again found by Müller's method quickly.
Figure 7.4. "Dragonfly" on Plane and Sphere
Figure 7.5 illustrates two Newton fractals of a fifth degree polynomial. We painted them by highlighting different parts of essentially the same image. Note that we can find numerous replicas of the "fish" in the "crab" and vice versa. Note also that each of the images shows white Cantor dust which is a part of the Julia set (or basin boundary) of the Newton fractal.
Figure 7.5. "Newton Fish" and "Newton Crab"
§ 8. Introductory 3D Plotting
This section is for people who are familiar with the three dimensional (3D) xyzspace and have some experience in plotting the graph of a function like z = x^{2} + y^{2} by a computer. We recall that in such a graph, z represents the altitude of the graph at (x, y). Our goal of this section is to use a 2D fractal already computed on a canvas in pixel coordinates (i, j) and generate a function of the form w = f(i, j). As in the case of the xyzspace, plotting the graph of w = f(i, j) in the ijwspace should be easy once we find its formula.
Basic Method: Start with a Mandelbrot, Julia or Newton fractal on a canvas R, and for each pixel (i, j) in R, let d(i, j) be the number of iterations of the dynamical system that generates the fractal. We then set
(8.1) w = d(i, j)
at each pixel (i, j) on the canvas R. This gives us a quick graph in the 3D space, but because the 2D fractal is closely tied with chaos, the 3D graph given by (8.1) tends to get literally "chaotic" with countless and abrupt ups and downs. The chaotic fluctuation of d(i, j) generally translates into intricate color changes of the 2D fractal but it is not necessarily welcomed in the 3D rendering. We may still find a few ad hoc ways to deal with them and produce interesting fractal scenery.
The desert scene on the left in Figure 8.1 is based on a Mandelbrot fractal given by the logistic equation and the divergence scheme. It shows several "hills," but if we look at the picture on the right, we realize that the hills are actually holes shown upside down. The undesirable chaotic part of the picture was conveniently thrown into the holes.
Popular Method: This is based on the idea of the (Euclidean) distance function detailed in Sekino's Fractal Coloring. For example, start with the Mandelbrot fractal of Figure 3.1, and let d(i, j) be the distance of the pixel (i, j) from the boundary of the Mandelbrot set. The distance means the length of the shortest line joining the pixel and the boundary and it can be computed by the formula given in the website mentioned above.
Just as in (8.1), let
(8.2) w = d(i, j)
so, the altitude of the 3D graph at each pixel equals the distance of the pixel from the boundary of the Mandelbrot set.
Figure 8.2 shown below is given by coloring the graph of the equation (8.2) in the ijwspace (where the axes are not uniformly scaled). The island is shaded by the directional derivative (which is also discussed in the aforementioned website) in the direction of northwest to define the sunny side.
Perhaps the hardest part in plotting the image is casting the shadow of the island on the lower surface. It does not use anything from higher mathematics but requires the persistence of the programmer.
Figure 8.2. "Mandelbrot Island"
There are many variations of (8.2) such as w = [d(i, j)]^{1.5} and w = √[d(i, j)] that change the shape of the surface. The "Mandelbrot Island" shown in Figure 8.3 is given by the Mandelbrot set shown below on the left and one of the variations of the distance function. The water surface is given by another variation involving the sine function, while the "moon" is given by mapping the Mandelbrot set on a sphere (which is a little trickier). The sky is another 2D fractal.

 Figure 8.3. "Mandelbrot Island"

Figure 8.4 shown below is based on the "Crooked Mandelbrot Set" shown on the left and given by another variation of the distance from its boundary.

 Figure 8.4. "Crooked Mandelbrot Rocks"

The night sky used in Figure 8.6 shown below is another image of the Mandelbrot set and provides the distance function from its boundary. Figure 8.5 is given by setting the height equals the distance on the complement of the Mandelbrot set and Figure 8.6 by another variation of the distance function.
Figure 8.5. "Crater Lakes 1"
Figure 8.6. "Crater Lakes 2"
