The Computational Beauty of Nature
Source code

henwarp

warps a square into the phase space of the Henon system

Full screen →

henwarp -help
  or
henwarp
       [-width  integer]  [-height  integer] [-swap] [-len
       integer] [-count integer] [-A double]  [-B  double]
       [-ulx  double]  [-uly  double] [-lly double] [-inv]
       [-mag integer] [-term string]

Takes a square of a specified area and “warps” it a fixed number of times by the Hénon system. This illustrates the stretching and folding motion of chaotic systems as well as shows how points within an attractor's basin of attraction are eventually forced into a strange attractor.

A square (initially centered about the origin) is transformed by the Henon system, which is described by the equation x(t+1) = A - x(t)^2 + B * x(t - 1), a fixed number of times according to the specified parameters.

Miscellany

You may wish to try this with a small length for the size of square and watch how the resulting plot changes as you slowly increase the value passed to the -count option starting at zero. The square will slowly spread out and converge to the attractor of the system.

The method for choosing the viewable region may seem counter-intuitive at first, but it has some nice properties. In particular, selecting the exact (x, y) coordinates for the upper-left corner and only selecting the lower right y coordinate forces both the x and y scales to be identical since all scales are uniquely determined by these values along with the plot width and height. If you then change the width or height of the plot, the relative scales will still match up. The options for making a box work similarly.

Bugs

The length of the square is in pixels and works best if it is an odd value. With even numbered values it can produce a gap in the plot for small values supplied with the -count option.

No sanity checks are performed to make sure that any of the options make sense.

Options

-widthWidth of the plot in pixels.480
-heightHeight of the plot in pixels.480
-swapSwap the x and y axis.True
-lenLength of edge of square.301
-countNumber of transformations.1
-AValue of the A parameter.1.29
-BValue of the B parameter.0.3
-ulxUpper-left corner x-coordinate.-1.75
-ulyUpper-left corner y-coordinate.1.75
-llyLower-left corner y-coordinate.-1.75
-invInvert all colors?False
-magMagnification factor.1
-termHow to plot points.None

henwarp.c on GitHub