//***********************************************************************************
/** Class to return nf'th iterate of map function.
* To be subclassed by specific functions, which must provide:
*
- a method evaluateFunction(double x) to return the function which must map the
* interval 0 a method evaluateDerivative(double x) to return the derivative at x
*
- an int variable nParameters giving the number of map parameters (1 or 2)
*
- the initialization of a[nParamters] and aDefault[nParameters]
* Optional parameters are:
* - double aMinimum giving a constant minimum value of a
*
- double aMaximum giving a constant maximum value of a
*
- boolean enforceARange true if the range is to be enforced (i.e. user
* cannot override it
*
- double bMinimum giving a constant minimum value of b (if nParameters=2)
*
- double bMaximum giving a constant maximum value of b
*
- boolean enforceBRange true if the range is to be enforced
*
- double x0Default giving the default value of the initial value of x
*
- String title giving the name of the function to use as a graph title
*
- double[] aDefault(nParameters] giving default values for the map parameters
*
* Optional methods area:
* - getAMainmum(double d) gives the minimum value allowed for a (default returns
* aMinimum, but may be overridden.
*
- getAMaximum(double d) gives the maximum value allowed for a (default returns
* aMaximum, but may be overridden.
*
- boolean showWinding set to true if winding number to be displayed
*/
//***********************************************************************************
public class Map1DFunction {
/** number of map parameters (1 or 2) */
int nParameters;
/** array giving map paramters */
double[] a;
/** array giving default values of map parameters */
double[] aDefault;
/** minimum value of a */
double aMinimum=0.;
/** maximum value of a */
double aMaximum=4.;
/** true if the maximum is to be enforced */
boolean enforceARange=false;
/** minimum value of b */
double bMinimum;
/** maximum value of b */
double bMaximum=4.;
/** true if the minimum is to be enforced */
boolean enforceBRange=false;
/** the default value of the initial value of x */
double x0Default=0.2;
/** the name of the function to use as a graph title */
String title = "Function";
/** the composition number: i.e. how many times the map is iterated each call */
private int nf=1;
/** accumulates the product of the slopes at the nf iteration points */
public double slope;
/** winding number for circle map */
public int winding;
/** set to zero in transients so winding number not updated */
public int windingAdd=1;
/** number of iterations contributing to winding */
public int total=0;
/** true if winding number to be shown */
public boolean showWinding=false;
//***********************************************************************************
/** Sets the map paramters
* @param paramters the array of input paramters
*/
//***********************************************************************************
public void setParameters(double[] parameters) {
if(parameters.length < nParameters)
System.out.println("Incorrect number of parameters");
for(int i=0; i1.) {
winding=winding+windingAdd;
x=x-1.;
}
while (x<0.) {
winding=winding-windingAdd;
x=x+1.;
}
total=total+windingAdd;
return x;
}
//**********************************************************************
}