Two Dimensional Maps - Adding your own function

To add your own function you first need to download all of the applet files to your hard drive. On a PC using Netscape you can do this by opening the "Java Console" and then typing "l" (lower case L) in this window before going to the first page of the applet (the one with the "Start" button). Alternatively you can download a zip file of all source files here.

You must now write a Java program called "" in the top directory in which the programs were downloaded. A template for the program follows (using the Henon map as an example).

The program must be compiled e.g. with javac.

Program Template

/** Class to return iterate of users 2d map function.
*/ //*********************************************************************************** public class Map2DMyFunction extends Map2DFunction { double X,Y; Map2DMyFunction() { nParameters=2; // Number of map parameters (1,2 or 3) a = new double[nParameters]; // Required aDefault = new double[nParameters]; // Required aDefault[0]=1.4; // Set default values of parameters aDefault[1]=0.3; title = "My Function"; // Title for plot xminDefault=-1.0; // Default for ranges xmaxDefault=1.5; yminDefault=-0.5; ymaxDefault=0.5; showWinding=false ; // True for winding number calculation } //*********************************************************************************** /** iterates the map function * @param x input value * @return iterated value */ //*********************************************************************************** public void iterate(double[] x) { X = x[0]; Y = x[1]; x[0] = Y + 1 - a[0]*X*X; // Replace with your function. x[1] = a[1]*X; // Replace with your function. x[2]=X; // The varibales x[2], x[3] store x[3]=Y; // the previous values of X,Y. } //*********************************************************************************** /** iterates a vector in the tangent space to the map for the Lyapunov calculation * @param x input value and returns updated values * x[0] and x[1] contain the values of X and Y - do NOT change in this method * @param t value of tangent vector (updated by iteration) */ //*********************************************************************************** public void iterateTangent(double[] x, double[] t) { X = t[0]; Y = t[1]; t[0] = Y - 2*a[0]*x[0]*X; t[1] = a[1]*X; } } //***********************************************************************************

The parent class contains a method mod(x) that reduces the range of x to 0 < x < 1 and keeps track the sum of the additions or subtractions to x which is used to calculate the winding number.
Last modified Sunday, December 28, 1997
Michael Cross