The Computational Beauty of Nature
Source code

phase1d

plot phase-space of a one-dimensional map

phase1d -help
  or
phase1d
       [-width  integer]  [-height integer] [-points inte-
       ger] [-skip integer] [-r double] [-aux double] [-x0
       double]   [-dx  double]  [-func  string]  [-arrows]
       [-inv] [-mag integer] [-term string]

Plots the phase space and trajectories of a one-dimensional map. Showing trajectories in the phase space more clearly illustrates why fixed-points and limit cycles occur. This can also be used to show the exponential divergence of nearby trajectories.

A phase-space diagram is plotted for a one-dimensional map according to the specified options. If the option for -dx is non-zero, then two trajectories are plotted: one staring at x0, and the other starting at (x0 + dx). See the MAPS section of the manual page for details of what maps are supported. User defined maps can be added to the file maps1d.c, but you must recompile the program.

Maps

The following four one-dimensional maps are allowed:

Logistic Map: x(t+1) = 4 r x(t) * (1.0 - x(t))

Tent Map: x(t+1) = (x(t) <= 0.5) ? 2 r x(t) : 2r * (1.0 x(t))

Sine Map: x(t+1) = sin(x(t) PI aux 2 r) / 2 + 0.5

Gaussian Map: x(t+1) = r exp(-aux (x(t) - 0.5) * (x(t) - 0.5))

See the file "maps1d.c" to see how to add user-defined maps.

Bugs

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

Options

-widthWidth of the plot in pixels.640
-heightHeight of the plot in pixels.480
-pointsNumber of points to plot.10
-skipNumber of points to skip.0
-rValue for r.1.0
-auxAuxiliary map parameter.1.0
-x0Initial value for x.0.123456
-dxDifference for second trajectory.0.0
-funcMap function to use (one of 'log', 'tent', 'sin', or 'gauss').log
-arrowsShow arrows to indicate directions?True
-invInvert all colors?False
-magMagnification factor.1
-termHow to plot points.None

phase1d.c on GitHub