To generate an image of the Mandelbrot Set or a Julia Set, a relatively
simple algorithm is used that requires the squaring of a complex number followed
by the addition of a constant.
In the region of the complex plane being investigated, each pixel position
is iterated through that simple equation, and the color of the pixel determined
by the behavior observed. In most cases, the color relates to the number of
iterations required before the value does one of two things: 1) it reaches
some maximum number of iterations, or 2) it becomes too large. A typical
method for deciding when an iteration is too large is to calculate the
distance from the origin to that point. If the distance exceeds 2 units,
successive iterations will get extremely large, approaching infinty.
if a value is too large, typically a test of the distance from the
The same basic algorithm used for both the Mandelbrot and Julia Set programs. Bothe fractals use Complex Numbers, and the only difference relates to the use of the constant that is added on each time. Here are the equations:
In order to graph the pixels in the coordinate plane, the above equation
is separated into its Real and Imaginary components for each arbitrary
point (an, bn).
The Real part is
graphed along the horizontal axis and the Imaginary part graphed along the
vertical axis. The equations to generate the next real or imaginary
portion is as follows:
Since it is wise to avoid unnecessary computation, it is a good idea to calculate the numerical position of each pixel. For instance, if a tiny Mandelbrot 10 pixels wide were to be drawn in the range -2 < x < +2, the first pixel would be drawn at -2 and the last pixel would be drawn at +2, but where would the other 8 pixels be located? To calculate this, the following rationale might help. With n pixels there will be n-1 intervals between them. Since the total distance between the starting and stopping point must be divided into n-1 equal intervals, this example becomes:
For the Mandelbrot Set, the value for C is the initial pixel position at the
start of each iteration sequence but for a Julia Set, the value for C is the
same for every iteration, regardless of the starting pixel
position. Most of the
constants that produce interesting Julia Sets are near the boundaries of
the Mandelbrot Set. Here are some
constants that produce interesting Julia Sets:
For either the Mandelbrot Set or a Julia Set, the region in the Complex Plane that is graphed is typically -2 < a < 2 and -2 < b < 2 . To zoom into a region, the values for the glOrtho( ) can be easily modified to produce a closeup view.
For more information on the Mandelbrot Set or Julia Sets, check out the
web page developed by
Sean Dobbs' Fractals: Mandelbrot
Set, Julia Sets, Orbits of Points
Interesting things to try:
Newton's method is a Calculus-based process used to arrive at roots of
high order polynomials. This iterative approach relates to a line tangent
to a polynomial at a specific point on the curve which can be used to
give a better approximation of the root with another iteration.
The process for general equations in the Complex Plane can be defined as:
where Z moves from some initial guess to an approximation of the root through some maximum number of iterations. The iteration process can be halted when consecutive values of Z are within some arbitrarily small distance, epsilon, of one another.
To generate an interesting fractal, all points in some region of the Complex
plane can be colored in some way depending upon how these points converge
to the various roots or "Basins of Attraction". For example:
An arbitrary point a + bi in the complex plane should eventually converge to one of these three roots, assuming the iteration process is long enough and the approximation technique does not divide by zero some where along the way.
Newton's Method calculations can be very computationally intensive though, especially since it will be necessary to eliminate values of i in the denominator of any fractions by using the complex conjugate. After that, isolate the real and imaginary portions of each calculation carefully since even a misplaced sign will significantly distort the picture. Look for ways to save on computation, too. The following page might be helpful for understanding more about Complex Numbers and DeMoivre's Theorem. It will show you some tricks for working with fractional powers.
For more examples of Newton's Method in the Complex Plane, check out:
Some interesting graphics can be produced using a process developed by
Dr. Aristid Lindenmayer, a colleague of Dr. Mandelbrot. The technique has been
called "L-Systems" after Dr. Lindenmeyer, and involves recursive string
replacement using a set of simple rules.L-Systems can be used to generate rather complex graphic images from some simple rules that define such things as lines, polygons, angles, and such. For each L-system, a set of string replacement rules are defined, and the objects defined in the string are graphed after a certain number of iterations have been applied. In a book by Prusinkiewicz and others titled The Algorithmic Beauty of Plants, a number of incredibly realistic biological images such as flowers, trees, and ferns are defined by these relatively simple rules.
For more examples on L-systems, check out: