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. The function must map the interval 0<x<1 onto itself ( i.e. for any value of x in this range, f(x) must also be in this range). There is no error checking for iterated values diverging! The program also must return a value for the derivative. Up two two parameters (e.g. a,b) are allowed. Some quantities are plotted as a function of the first map parameter a. If the maximum value of a for which the function is a map of the unit interval depends on b, this can be calculated in the getAMaximum method.

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

Program Template

import java.util.*;                                    // Only needed if Math calls are used

/** Class to return iterate of user's map function. */

public class Map1DMyFunction extends Map1DFunction {

      Map1DMyFunction() {
            nParameters=2;                              // Number of parameters of map (1 or 2)
            a=new double[nParameters];                  // Required
            aDefault = new double[nParameters];         // Required
            aDefault[0]=2.0;                            // Default value of first parameter a
            aDefault[1]=0.3;                            // Same for second parameter b if present
            aMinimum=0.;                                // Mimimum value of a in parameter scans
            aMaximum=4.;                                // Maximum value of a in parameter scans
            enforceARange=true;                         // "true" if a-range must be enforced
            enforceBRange=true;                         // "true" if b-range must be enforced
            bMinimum=0.;                                // Mimimum value of b allowed
            bMaximum=1.;                                // Maximum value of b allowed
            x0Default=0.2;                              // Default starting value of x
            title = "Shifted tent";                     // Title of function to label plot      
      public double evaluateFunction(double x) {        // Must return f(x)   
	        return .......;
      public double evaluateDerivative(double x) {      // Must return derivative f'(x)
             return .......;
      public double getAMaximum(double d) {             // If maximum value of a depends on the
            return .......;                             // second parameter, return the expression
      }                                                 // here (otherwise aMaximum is used).     

Last modified Monday, October 13, 1997
Michael Cross