| Dewdney's "Zircon Zity" Colored in Various Ways |
Purpose
The purpose of this project is to describe how to compute
and display the Lyapunov exponents of the logistic map with periodic forcing (and to
compute and display some very interesting graphics images).
Mathematical Background
Initial Condition
x0 = 0.5
Periodic Forcing Sequence
e.g., "Zircon Zity" Sequence
{ r n } = {bbbbbbaaaaaa bbbbbbaaaaaa ...}
Logistic Equation
![]()
General Lyapunov Exponent

Use 600 "warmup" iterations,
and approximate Lyapunov Exponent with N = 4000.
Derivative of Logistic Equation
for Lyapunov Exponent calculation

Materials and Equipment
Software Requirements
Windows 98
Delphi 4.02/5 (to recompile)
Lyapunov.EXEHardware Requirements
VGA display with 640-by-480 screen in high/true color display mode
Procedure

Make the two "Quick Settings" selections, or individually specify the a and b min and max, number of pixels in each dimension, the number of iterations, the name, and the sequence.
The names for several of the Parameter Sets (ZirconZity, Jellyfish, Swallow, LyapunovSpace) are the names A.K. Dewdney gave for several of the images in his Scientific American article [Dewdney91], even though these images appeared unnamed in [Markus89] and [Markus90]. The Parameter Set names with a prefix of "Hess" are images from [Markus89], while the names with a prefix of "Markus" are images from [Markus90].
For initial computations, choose a fairly small bitmap size because of the large number of iterations that are made for each pixel computation. Once you think you have an interesting "subject" in an image, re-compute it with a large bitmap size.
I would have reversed the "a" and "b" labels to be consistent with normal "x" and "y" axes conventions, but conform here with the same convention as used by Markus.

Press the Start button (where the Continue button is above). Interrupt/continue the computation any number of times.
For each parameter pair, (a,b), the Lyapunov exponent is computed using double-precision floating-point arithmetic. [Markus89] suggests using 600 "warmup" iterations and found reliable convergence with an additonal 4000 iterations at each point.
The "Raw Image" of the Lyapunov map is formed by storing raw IEEE floating-point "single" values (trunctated from the computations that used double-precision values) as the pixel data in a pf32bit bitmap. The mouse cursor can be used to inspect the value at any point, which is shown below and to the left of the image. In this experiment of displaying floating point values, the floating-point exponent is ignored, and the floating-point fraction becomes the 24-bit RGB value that is displayed. (I'm curious how this technique might work in displaying other computations, such as Fourier transforms.)
[Markus89] also suggests speeding up the computation process by using a logarithm lookup table. He used 5000 values with equidistant arguments in the interval [0, 4]. I just computed all base-2 logarithms in a brute force way: Remember "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth.

Click on any of the color boxes above to change the color using the standard color dialog.
The various regions of the ab parameter map are either "stable" or "chaotic." Different coloring schemes can be used to empahsize each region. Feel free to experiment with various color schemes.
[Markus89] often used a shades-of-gray gradient, or a black-to-yellow gradient for coloring "order" and a black-to-red gradient for color "chaos." In some images in [Markus90], a black-to-gray gradient was used to color order and a solid black was used to color chaos. Another color scheme used in [Markus90] was the black-to-yellow as described in [Markus89] for order, but a back-to-blue color mapping for chaos -- these are the current color scheme defaults.
Computation of the "rainbow" colors are explained in more detail in the Spectra Lab Report.

Press the Save button to store the image in a pf24bit
BMP or a JPG.
Press the Print button and select portrait or landscape orientation and any other desired printer properties. The following table summarizes the header and footer information printed with the above image:
| Lyapunov Image: efg1112 | Sequence: ab |
| [image] | |
| a(3.8360 to 3.8405, 360 pixels) vs b(3.845 to
3.851, 480 pixels); Iterations/point: 600 warmup, 4000 maximum 428 seconds creation time; Coloring: Order=Rainbow, Chaos=Gradient (clBlack to clBlue) |
|
Discussion
(Outline for now)
ScreenLyapunov unit and form:
- LyapunovUpdateCallback
- 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 IEEE singles as "pixels" in pf32bit bitmap; displaying floating-point
value with ImageLyapunovRawMouseMove
- 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
LyapunovLibrary unit (separates computations from user interface):
- LyapunovExponent Function
- TLyapunovLambdaMap Class with methods Compute, SetColorScheme, ColorLambdaBitmap, ...
SpectraLibrary unit:
- Rainbow Function
- WavelengthToRGB Function (overloaded)
- ColorToRGBTriple Function
Lyapunov Benchmark
640-by-480 bitmap, 600 warmup + 4000 iterations
| Dewdney's Name | Hours:Minutes:Seconds | |||
| Sun SparcStation 2 C February 1992 |
33 MHz 486 Turbo Pascal July 1992 |
450 MHz Pentium II Delphi 5/Win 98 April 2000 |
650 MHz Pentium III Delphi 5/ Win 2000 April 2000 |
|
| LyapunovSpace | 3:41:06 | 8:50:59 | 0:12:39 | 0:7:55 |
| Jellyfish | 3:38:33 | 8:49:20 | 0:12:40 | 0:7:52 |
| Swallow | 3:39:24 | 8:49:46 | 0:12:39 | 0:7:53 |
| ZirconZity | 3:32:16 | 9:04:25 | 0:12:53 | 0:7:59 |
pf32bit Enigma. One Win 98 Pentium reports $FFFFFFFF for the values in a scanline for a new pf32bit bitmap, while two others report a value of $01FFFFFF? Why should this vary by machine? Both are valid values for "white" and this should be implemented in a deterministic way. The $FFFFFFFF value was treated as a -NaN and caused problems in the LambdaValueColor routine in the LyapunovLibrar unit when floating point values were compared. As a kludge workaround, code was added in the constructor to initialize the bitmap to black instead of the default white. I posted a note to borland.public.delphi.graphics to discuss "pf32bit enigma: 'alpha byte' indeterminate in new bitmap?" efg, 10 April 2000.
Conclusions
Whether you care about the mathematics in this project or not, the images
of the Lyapunov Exponent maps can be quite interesting, but take considerable time to
compute.
Keywords
Lyapunov Exponent, Logistic Map, Logistic Equation, Chaos, Fractals, Rainbow,
WavelengthToRGB, pf32bit, IEEE single, Delphi, DecimalSeparator, Localization
Download
Delphi 4.02/5 Source and EXE: Lyapunov.ZIP
(280 KB)
Improved version of LyapunovLibrary by Adreas Schmidt with roughly 25% speed improvement in the LyapunovExponent function.
Update Log
| 22 April 2000 | Added ability to print images, along with annotations sufficient to reproduce image |
| 17 May 2000 | Fixed localization problem. DecimalSeparator ('.' or ',' or
whatever) should work correctly with floats now. Thanks to Andreas Schmidt from Germany for bringing this problem to my attention. |
Future
Many additional features could be added to this project:
Add FormResize handler.
Correctly handle NaN/INF values in LambdaValueColor method.
Setup Tab
Provide additional validation of inputs and illegal states (e.g., "single-pixel" invalid state).
Allow experimentation with various X0 values, instead of only forcing X0 to be 0.5 in all cases.
Allow additions/deletions to items in "Quick Settings" list.
Raw Image Tab
Allow way to save/restore pf32bit image with IEEE single values to a file.
Color Scheme Tab
Provide additional color map options.
Final Image Tab
Save a .DAT file along with the .BMP or .JPG to retain all parameters and color setting information about an image.
Links: (Also see Fractals and Chaos Section of efg's Mathematics Reference page)
| "Lyapunov Exponent and Dimension of the
Lorenz Attractor" by J.C. Sprott http://sprott.physics.wisc.edu/chaos/lorenzle.htm |
| Lyapunov Notes and Images by Jan Thor www.janthor.de/Lyapunov |
| Markus-Lyapunov Fractals http://perso.wanadoo.fr/charles.vassallo/en/lyap_art/lyapdoc.html (English) http://perso.wanadoo.fr/charles.vassallo/fr/lyap_art/lyapdoc.html (French) |
| Measuring Chaos: Lyapunov Space (shows
very interesting sequences) http://hypertextbook.com/chaos/44.shtml |
References: (also see efg's Fractals and Chaos Bookstore)
Updated 31 Jul 2006
since 9 Apr 2000