Fractals
|
Code in Java |
The prerequisite for the subject as presented here is to know (1)
fundamental algebra and geometry of complex numbers, (2) beginning calculus,
and (3) basic computer programming in one of the modern languages (VB, C++,
Java, etc.) in a graphics mode.
You should be able to write 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 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 we consider is finite so a computer can
deal with "all" of them in R. 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 is an
example:
We begin our discussion with the rectangular region R 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 ,
where the parameter p is a complex number in R (which is our
canvas). (*) is called the Mandelbrot equation or Fatou
equation (sometimes) as Pierre Fatou came up with the following idea
nearly a century ago.
The best-known figure in fractal geometry is given by iterating the
Fatou 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. 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 parameter p (which is a pixel, remember?)
according to how fast 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 replace the awkward IF statement by a few good looking
lines.
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 PCs to take up computer
programming.
As we noted, the color of a pixel is determined according to the "escape
speed" of the corresponding sequence zn = z0 , z1
, z2 , ... 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 parameters (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 a network through curious and extremely
intricate patterns, which we can find by zooming intently and patiently.
Surprisingly, it has been verified that the Mandelbrot set is one of the
most complex figures ever plotted on a piece of paper (in terms of the
so-called Hausdorff-Besicovitch dimension and other advanced
properties).
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 often come from sequences zn with
diverse properties interlaced in a complex fashion. Thus, a very slight
change in the "starting" value p = z02 + p in
this area may result in an utterly different "future behavior" of 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
equation such as (*) which looks totally well behaving and instead of ugly
consequences it produces beautiful fractal patterns. You might remember that
Steven Spielberg's Jurassic Park premiered in 1993 has a
mathematician who introduced himself as a "chaotician."
A chaotician obviously deals with chaotic behaviors of various dynamic
mathematical systems, a.k.a. dynamical systems, including our
generating equation (*). It was in fact around the 1970s and the early 80s
when several significant events coincidentally took place in mathematics:
People saw the computer-generated bizarre-looking and epoch-making
Mandelbrot set for the first time; the new field called "chaos" was born
from a computer experiment and created a great sensation among younger
mathematicians; 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 are now important part of mathematics.
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 parameters 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| < s,
where s is a small number like 0.0000000001. 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
parameters 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 parameters in a similar fashion in order to add more varieties
to the image.
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 challenging task to unearth new
patterns from the Fatou (or Mandelbrot) equation (*) using available
computers and software. 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 scheme applied
on a dynamical system of the form
(**)
zn+1 = fp(zn)
a Fatou Pattern, where fp is a function of
complex numbers that contains a parameter p. For example, we may find
Fatou Patterns 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, but this is not necessarily mandatory from an artistic
viewpoint.
A non-critical initial point like z0 = (0.1,0) provides us
with 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 and its behavior discovered through
computer simulations, the term chaos was born in 1974. The
subject that appeared to connect the world of randomness and certain
"deterministic" processes stirred up great interests in the mathematics
world in much of the late 20th century. The primary application
of the logistic equation lies in population dynamics, which explains why the
chaotician had his role in Jurassic Park.
A fractal, which I call a Julia pattern, 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 Fatou Patterns) in the rectangular region R (which is our
canvas). Thus, z0 plays the role of a pixel in the canvas.
As in the case of a Fatou Pattern, a Julia pattern appears more interesting
when the parameter value p is chosen in an area where the sequences
zn behave unpredictably. A Julia pattern 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 an important object in fractal geometry.
Gaston Julia, Pierre Fatou, and several other mathematicians, amazingly
envisioned fractal images generated by certain dynamical systems about a
hundred years ago using sheer imaginations.
A fractal, which I call a Newton Pattern, is a Julia pattern
given by a dynamical system of the form
zn+1
= zn- g(zn)/g'(zn)
where p = (0, 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 the beginning calculus
hold for g. As you may have recognized already, this dynamical system
is, in practice, Newton's Root-finding Algorithm, and as such, it
converges to a root of the equation g(z) = 0 quickly more often than
it converges slowly or diverges. For this reason, the convergence scheme
alone is usually used to process a Newton pattern. Furthermore, M,
the maximum number of iterations, for my Newton patterns is typically
between 50 and 500 instead of between 500 and 2,000,000 for Fatou and other
Julia patterns. As in a general Julia pattern, an interesting Newton pattern
is a fractal that contains (at least a part of) a Julia set, which
ironically causes the chaotic behavior of the otherwise extremely useful
root-finding algorithm.
In my program, g is always a polynomial which allows me to take
advantage of the time-saving scheme called Horner's Synthetic Division
to evaluate both g and g' efficiently and the stable
Müller's algorithm to find all roots of g. Why do we want the
roots? Well, Figure 4 above is a Newton pattern over the unit
disk of the complex plane given by the polynomial
g(z)
= z3 - 1
and the advanced convergence scheme
utilizes the roots in the coloring scheme
as well as the number of iterations. Arthur Cayley, one of the great
mathematicians of the 19th century, did not know chaos involved
in Newton's method and was frustrated by a geometric problem that turned out
to be equivalent to sketching the three-color Newton Pattern (without
shading) using pencil and paper. Without computers, mathematicians like
Cayley and Georg Cantor began to recognize the existence of fractals in the
late 19th century.
As we know by now, each pixel color is determined by the number of
iterations the corresponding sequence undertakes before escaping from a
circle of a prescribed radius or before getting sufficiently near a fixed
point in the complex plane. This number, say w, of iterations adds one more
dimension to the complex number underlying the pixel that already has two
dimensions (x, y). Following elementary three-dimensional analytic
geometry, therefore, we may plot every point of the form (x - dy, w - dy)
in the xw-plane using a pixel color determined by w, where d
is a nonnegative real number between 0 and 1. If the "depth" number d
is nonzero, the above scheme creates an illusion of having an object in the
three-dimensional space with x- and w- axes that are
horizontal and vertical and y-axis that is perpendicular to the
xw-plane. Note that the expression dy has nothing to do with
calculus. If d happens to be zero, the picture will lose the depth
and show the projection (or the side-view) of the object on the xw-plane.
Here is a caution about the 3D plotting: When a dynamical system becomes
highly chaotic (which is desirable in the earlier 2D plotting), it tends to
give too many variations on the altitudes w causing the fractal
pattern to look like a reedy swamp. To remedy this problem, we may plot the
points of the form (x - cy, h(w) - dy) instead, where c and
d are real numbers (that may be negative) and h is a "height"
function. For example, if h is the natural logarithm, it may
de-emphasize the excessive variations of w.