Fractals and Chaos

Fractals Show 2  

Lab Report

undercon1.gif (4551 bytes)

NOTE:  This program requires additional validation tests,
which will be conducted in the next few months.

Other items to be addressed include:

1.  Re-validation of complex number routines
(rewritten from old TP 7  code).

2.  Fix data entry for floats (esp. negative values)

3.  Fix localization to treat DecimalSeparator correctly
outside the U.S.  

4.  Fix aspect ratio problems in certain "Quick Settings"

5.  Allow printing of fractal images

6.  Save/Restore iteration map for coloring independently
of the calculations

"Intermingle" Images from Fractals Show 2 Program
IntermingleCycle.gif (13747 bytes)
Intermingle.gif (28345 bytes)

Purpose
The purpose of this project is to create Mandelbrot and Julia sets for a number of complex math functions.

Mathematical Background

The famous Mandelbrot Set is formed by the iteration

z z2 + c

over an area of the complex plane.  A Julia Set is formed using a similar iteration.  But instead of iterating only with the function z2, many other complex math function can be explored.  Here's a summary of how to create a Mandelbrot or Julia Set:

At the Point (x,y): Mandelbrot Set Julia Set
Initial Condition z0 = 0 + i0 z0 = x + iy
Constant c = x + iy c = p + iq
where p and q are any real values
Iteration

zn+1 = fn[ zn ] + C

Termination Conditions
  • Maximum number of iterations exceeded, or
  • z exceeds specified value

The complex functions, fn,  that are used in Fractals Show 2 include:  z2, zn, zx, zz, exp(z), cos(z), sin(z), cosh(z), sinh(z), I0(z), J0(z), tan(z), tanh(z), sec(z), sech(z), csc(z), csch(z), cot(z), coth(z), gamma(z).  See the Complex Math page for mathematical details.

Points where the iteration count reaches the maximum specified limit are "captured" points and are usually colored a single color.  The other points that exceed a specified value "escape" to infinity and are colored in a way that reflects the number of iterations at the time the specified value was exceeded.  Many different color schemes can be explored. 

This program attempts to make the counting of iterations a separate process from the coloring of the iterations.

<Add comments and examples of FractInt mis-optimization and re-definition of standard math terms>

Materials and Equipment

Software Requirements
Windows 98
Delphi 4.02/5 (to recompile)
FractalsShow2.EXE

Hardware Requirements
VGA display with 640-by-480 screen in high/true color display mode

Procedure

  1. Double click on the  icon to start the program.

ScreenFractalsShow2A.jpg (52657 bytes)

  1. Choose the three "Quick Settings" selections, or individually specify the x and y min and max, number of pixels in each dimension, the number of iterations, the name, and the function parameters.

Here is a summary of the various Groups that may be chosen:

Group Description Number of Parameter Sets
Beauty of Fractals:  Mandelbrot Images from the book
The Beauty of Fractals
14
Beauty of Fractals:  Julia 16
Mandelbrot Evolution Mandelbrot Sequence
z zx + c, for x
34
MiniMandelbrot Bifurcation In the Mandelbrot Evolution, near x=2, a "MiniMandelbrot" can be seen to bifurcate (split). 34
Mandelbrot "UFO" In the Mandelbrot Evolution, near x=3.89, a "UFO" can be seen to "fly" briefly. 19
efg's Mandelbrot Gallery A variety of fractal images originally displayed in efg's Fractal Discovery Lab Gallery. 28
efg's Julia Gallery 34

 

ScreenFractalsShow2B.JPG (51631 bytes)

  1. Press the Start button (where the Continue button is above).   Interrupt/continue the computation any number of times.

This "Integer" image was an experiment to see if raw binary data might make sense without any special coloring.  Each pixel is an integer in the range 0..MaxIterationCount.  But each integer is treated as the color $00rrggbb, so often the blue pixels show up since iteration limits are often in the range from 256..1024.

A further experiment using pf15bit bitmaps, where each pixel is a "word," might also be interesting.

This step was introduced so the counting of iterations was a distinctly separate process from coloring of iterations.  Often fractal programs combine both of these operations in one step.  However, this makes re-coloring of images difficult when more than one iteration value is mapped to the same color.

ScreenFractalsShow2C.JPG (43646 bytes)

  1. Click on any of the color boxes above to change the box color using the standard color dialog.  This provides for a wide variety of color gradient combinations.

"Captured" and "Escape" colors are established via the selections above.  The "Color Shift" spin box on the Final Image tab also affects the color mapping. 

The Color Scheme for the Reverse Gradient with a Shift of 645 appears like this:

ScreenFractalsShow2GradientReverseShift.jpg (3505 bytes)

This is the color scheme used for the Final Image tab shown below.

The Rainbow color scheme looks like this:

ScreenFractalsShow2Rainbow.jpg (4134 bytes)

Computation of the "rainbow" colors are explained in more detail in the Spectra Lab Report.

Either the Gradient or the Rainbow can be broken in to a specified number of intervals by checking the Color Bands box.  For example, specifying 5 steps yields the following color gradient:

ScreenFractalsShow2ColorSteps5.jpg (3523 bytes)

Checking the "Rotate" box rotates the above colors:

ScreenFractalsShow2ColorSteps5Cycle.jpg (8422 bytes)

A wide variety of color schemes is possible.

The following shows the biomorph "Final Image" using the reverse gradient with a shift of 645:

ScreenFractalsShow2D.JPG (97923 bytes)
Cliff Pickover put a similar image in his book
Mazes for the Mind:  Computers and the Unexpected,
St. Martin's Press, 1992.
Color plate before  page 173.

  1. Press the Save button to store the image in a pf24bit BMP or a JPG.

Press the Color Shift spin box to gradually "rotate" gradient or rainbow colors.

Discussion
(Outline for now)

ScreenFractalsShow2 unit and form:
- IterationCallback
- ResetStartPixel Procedure
- TimerDisplayTimer Procedure with elapsed and estimated completion time
- Keystroke validation:  EditFloatKeyPress, EditIntegerPress, EditSequencePress
- Range validation:  EditLimitsChange, EditPixelsChange, EditIterationsChange
- Start/Pause/Reset Procedures (BitBtnStartClick/BitBtnPauseClick/BitBtnResetClick)
- csOwnerDrawFixed style ComboBox with "hidden" parameters
- UpdateColorScheme
- storing integers as "pixels" in pf32bit bitmap; displaying integer value with ImageMouseMove
- handling MouseMove events when TImage is stretched
- saving BMP or JPG file (need to provide way to specify JPEG quality)
- ShellExecute to link to web site

MandelbrotJuliaLibrary unit (separates computations from user interface):
- CZN, CZX, CZZ complex functions
- FunctionNameIndex
- TMandelbrotJuliaMap Class with methods ComputeMandelbrot, ComputeJulia, SetColorScheme, ColorLambdaBitmap, ...

ComplexMathLibrary unit
- complex arithmetic functions using either rectangular or polar coordinates
- complex trig and transcendental functions

SpectraLibrary unit:
- Rainbow Function
- WavelengthToRGB Function (overloaded)
- ColorToRGBTriple Function

Conclusions
Exploring fractals is an excellent way to experiment with mathematics while using computer graphics to display results.


Keywords
Fractals, Chaos, Mandelbrot Set, Julia Set, Biomorph, Rainbow, WavelengthToRGB, pf32bit, complex math, Delphi

Download
Delphi 4.02/5 Source and EXE:   FractalsShow2.ZIP (295 KB)

Turbo Pascal Programs.  Note:  If you have a fast machine (233 MHz Pentium II or faster), you'll likely need a patch to run these TP 7 programs.  See this fix for "Runtime Error 200."

Fractals and Show (original programs).  Shown below is the fractal "66" Julia Set z zz + (1.7 + 1.4i) created with the "Fractals" program and displayed with the "Show" program.  TP Source and EXE:  FracShow.ZIP

Biomorph.  While searching the Mandelbrot "Shoreline" of z z1.5 + C, a fascinating fractal biomorph was discovered for the Julia Set z z1.5 - 0.2.   TP 7 Source and EXE:  Biomorph.ZIP


Future

Many additional features could be added to this project:

Setup Tab

Raw Image Tab

Color Scheme Tab

Final Image Tab


Glynn Function Study Center Gallery


Links:  Fractals and Chaos Section of efg's Mathematics Reference page


Other Links about Fractals

An Introduction to Fractals
http://astronomy.swin.edu.au/pbourke/fractals/fracintro 

Fractal World
www.kcsd.k12.pa.us/~projects/fractal 

What Is a Fractal?
www.glyphs.com/art/fractals/what_is.html 

Fractals
http://math.rice.edu/~lanius/frac  

Fractal - Mandelbrot Set for F(Z)=Z*Z + C
http://republika.pl/fraktal/mandel.html 


Updated 11 Jul 2009
Since 16 Apr 2000