math.numerics
Class ODEMultistepSolver

java.lang.Object
  extended by math.numerics.ODEMultistepSolver
All Implemented Interfaces:
ODEAdaptiveSolver, ODESolver

public class ODEMultistepSolver
extends java.lang.Object
implements ODEAdaptiveSolver

ODEMultistepSolver performs multiple ODE steps so that a uniform step size is maintained.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
static int CONVERGE_ERROR
           
static int NO_ERROR
           
 
Constructor Summary
ODEMultistepSolver(ODE ode)
          Constructs an ODEMultiStep ODE solver for a system of ordinary differential equations.
 
Method Summary
 double getStepSize()
          Gets the step size.
 double getTolerance()
          Gets the tolerance of the adaptive ODE sovler.
 void initialize(double stepSize)
          Initializes the ODE solver.
static ODEAdaptiveSolver MultistepRK45(ODE ode)
          A factory method that creates a multisetp solver using the RK45 engine.
 void setStepSize(double stepSize)
          Sets the fixed step size.
 void setTolerance(double tol)
          Sets the tolerance of the adaptive ODE sovler.
 double step()
          Steps (advances) the differential equations by the stepSize.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ERROR

public static final int NO_ERROR
See Also:
Constant Field Values

CONVERGE_ERROR

public static final int CONVERGE_ERROR
See Also:
Constant Field Values
Constructor Detail

ODEMultistepSolver

public ODEMultistepSolver(ODE ode)
Constructs an ODEMultiStep ODE solver for a system of ordinary differential equations. The default ODESolver is RK45. Other solvers can be selected using factory methods.

Parameters:
ode -
Method Detail

MultistepRK45

public static ODEAdaptiveSolver MultistepRK45(ODE ode)
A factory method that creates a multisetp solver using the RK45 engine.

Parameters:
ode - ODE
Returns:
ODESolver

setTolerance

public void setTolerance(double tol)
Sets the tolerance of the adaptive ODE sovler.

Specified by:
setTolerance in interface ODEAdaptiveSolver
Parameters:
tol - the tolerance

getTolerance

public double getTolerance()
Gets the tolerance of the adaptive ODE sovler.

Specified by:
getTolerance in interface ODEAdaptiveSolver
Returns:

step

public double step()
Steps (advances) the differential equations by the stepSize. The ODESolver invokes the ODE's getRate method to obtain the initial state of the system. The ODESolver then advances the solution and copies the new state into the state array affineTransform the end of the solution step if desired tolerance was reached.

Specified by:
step in interface ODESolver
Returns:
the actual step

initialize

public void initialize(double stepSize)
Initializes the ODE solver. Temporary arrays may be allocated within the ODE solver.

Specified by:
initialize in interface ODESolver
Parameters:
stepSize -

setStepSize

public void setStepSize(double stepSize)
Sets the fixed step size. Multi-step solvers will perform one or more internal steps in order to perform a step with the given size.

Specified by:
setStepSize in interface ODESolver
Parameters:
stepSize -

getStepSize

public double getStepSize()
Gets the step size. The step size is the fixed step size, not the size of the ODEAdaptiveSolver steps that are combined into a single step.

Specified by:
getStepSize in interface ODESolver
Returns:
the step size