Package org.opensourcephysics.numerics
Class AbstractODESolver
java.lang.Object
org.opensourcephysics.numerics.AbstractODESolver
- All Implemented Interfaces:
ODESolver
- Direct Known Subclasses:
Butcher5
,Euler
,EulerRichardson
,Fehlberg8
,Heun3
,LeapFrog
,Ralston2
,RK4
,Verlet
AbstractODE provides a common superclass for ODESolvers.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractODESolver
(ODE _ode) Constructs the ODESolver for a system of ordinary differential equations. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the step size.void
initialize
(double _stepSize) Initializes the ODE solver.void
setStepSize
(double _stepSize) Sets the step size.abstract double
step()
Steps (advances) the differential equations by the stepSize.
-
Field Details
-
stepSize
protected double stepSize -
numEqn
protected int numEqn -
ode
-
-
Constructor Details
-
AbstractODESolver
Constructs the ODESolver for a system of ordinary differential equations.- Parameters:
_ode
- the system of differential equations.
-
-
Method Details
-
step
public abstract 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 at the end of the solution step. -
setStepSize
public void setStepSize(double _stepSize) Sets the step size. The step size remains fixed in this algorithm- Specified by:
setStepSize
in interfaceODESolver
- Parameters:
_stepSize
-
-
initialize
public void initialize(double _stepSize) Initializes the ODE solver. The rate array is allocated. The number of differential equations is determined by invoking getState().length on the ODE.- Specified by:
initialize
in interfaceODESolver
- Parameters:
_stepSize
-
-
getStepSize
public double getStepSize()Gets the step size. The stepsize is constant in this algorithm- Specified by:
getStepSize
in interfaceODESolver
- Returns:
- the step size
-