math.numerics
Class RK45

java.lang.Object
  extended by math.numerics.RK45
All Implemented Interfaces:
ODEAdaptiveSolver, ODESolver
Direct Known Subclasses:
RK45MultiStep

public class RK45
extends java.lang.Object
implements ODEAdaptiveSolver

Title: RK45 Description: RK4/5 ODE solver with variable step size.

Version:
1.0
Author:
Wolfgang Christian

Constructor Summary
RK45(ODE _ode)
          Constructs the RK45 ODESolver for a system of ordinary differential equations.
 
Method Summary
 double getStepSize()
          Gets the step size.
 double getTolerance()
          Method getTolerance
 void initialize(double _stepSize)
          Initializes the ODE solver.
 void setStepSize(double _stepSize)
          Sets the step size.
 void setTolerance(double _tol)
          Method setTolerance
 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
 

Constructor Detail

RK45

public RK45(ODE _ode)
Constructs the RK45 ODESolver for a system of ordinary differential equations.

Parameters:
_ode - the system of differential equations.
Method Detail

initialize

public void initialize(double _stepSize)
Initializes the ODE solver. Temporary state and rate arrays are allocated. The number of differential equations is determined by invoking getState2().length on the ODE.

Specified by:
initialize in interface ODESolver
Parameters:
_stepSize -

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.

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

setStepSize

public void setStepSize(double _stepSize)
Sets the step size. The step size may change when the step method is invoked.

Specified by:
setStepSize in interface ODESolver
Parameters:
_stepSize -

getStepSize

public double getStepSize()
Gets the step size. The stepsize is adaptive and may change as the step() method is invoked.

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

setTolerance

public void setTolerance(double _tol)
Method setTolerance

Specified by:
setTolerance in interface ODEAdaptiveSolver
Parameters:
_tol -

getTolerance

public double getTolerance()
Method getTolerance

Specified by:
getTolerance in interface ODEAdaptiveSolver
Returns: