//***********************************************************************************
/** Class to return rhs of differential equations.
* To be subclassed by specific functions, which must provide:
*
- a method derivs(double[] x, double t) to return the rhs of the equations
* given x and t
*
- an int variable nParameters giving the number of ode parameters
*
- the initialization of a[nParamters] and aDefault[nParameters]
*
- x[0] giving default initial values of x
* Optional parameters are:
* - boolean wrapX true if x-range is to be wrapped
*
- double wrapXValue giving value at which x is wrapped if wrapX true
*
- boolean wrapY true if y-range is to be wrapped
*
- double wrapYValue giving value at which y is wrapped if wrapY true
*
- boolean wrapZ true if z-range is to be wrapped
*
- double wrapZValue giving value at which z is wrapped if wrapZ true
*
- double dt giving the default value of the time step dt
*
- double trans giving the default value of the transient trans
*
- double ghostTime giving the default value of the time for which the preplot
* is evaluated
*
- double poincareSection giving the default value for the Poimcare section
*
- String title giving the name of the function to use as a graph title
*
*/
//***********************************************************************************
public class OdesFunction {
/** number of parameters */
int nParameters;
/** number of map variables */
int nVariables;
/** array giving map paramters */
double[] a;
/** array giving default values of map parameters */
double[] aDefault;
public boolean wrapX=false;
public double wrapXValue;
public boolean wrapY=false;
public double wrapYValue;
public boolean wrapZ=false;
public double wrapZValue;
/** the default value of the initial value of x */
double[] x0;
double dt=0.1;
double trans=10.;
double ghostTime=10.;
double poincareSection=1.;
/** the name of the function to use as a graph title */
String title = "Function";
OdesFunction(int n) {
nVariables=n;
}
//***********************************************************************************
/** 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; i