org.opensourcephysics.numerics.rk
Class Radau5

java.lang.Object
  extended by org.opensourcephysics.numerics.rk.irk.Radau5Light
      extended by org.opensourcephysics.numerics.rk.irk.Radau5Adaptive
          extended by org.opensourcephysics.numerics.rk.Radau5
All Implemented Interfaces:
ODESolverInterpolator

public class Radau5
extends Radau5Adaptive
implements ODESolverInterpolator

Title: Radau5 Description: 5th order implicit RK Radau solver

Version:
1.0 January 2009
Author:
Francisco Esquembre (based on code by Andrei Goussev / based on Fortran code by E. Hairer and G. Wanner)

Constructor Summary
Radau5(ODE ode)
           
 
Method Summary
 double[] bestInterpolate(double _time, double[] _state)
          Similar to interpolate(), but using the best estimate the algorith can provide and only between the current time and getMaximumTime().
 double[] getCurrentRate()
          Returns the rate of the current state
 double getInternalStepSize()
          Returns the actual internal step size
 double getMaximumTime()
          Returns the maximum time forward in time (or minimum, if the step is negative) for which the solver can interpolate without doing any internal step.
 StateMemory getStateMemory()
          Provides access to the internal StateMemory responsible for interpolations.
 double internalStep()
          Steps the internal step as much as possible (respecting the step size and the tolerance, if any).
 double[] interpolate(double _time, boolean useLeftApproximation, double[] _state)
          Implements continuous vector function that approximates the solution of the ODE.
 double[] interpolate(double _time, boolean _useLeftApproximation, double[] _state, int _beginIndex, int _length)
           
 double interpolate(double _time, boolean _useLeftApproximation, int _index)
           
 void reinitialize(double[] _state)
          Does the minimum (soft) initialization of the solver to a given state.
 void setEstimateFirstStep(boolean _estimate)
          Makes adaptive steps estimate the best initial step after reinitialize().
 void setMemoryLength(double length)
          Sets the length of the memory requested to the solver.
 
Methods inherited from class org.opensourcephysics.numerics.rk.irk.Radau5Adaptive
doStep, getErrorCode, setTolerances
 
Methods inherited from class org.opensourcephysics.numerics.rk.irk.Radau5Light
getCounter, getODE, getStepSize, initialize, setMaximumStepSize, setStepSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.numerics.ODESolverInterpolator
getCounter, getODE, getStepSize, initialize, setMaximumStepSize, setStepSize, setTolerances
 

Constructor Detail

Radau5

public Radau5(ODE ode)
Method Detail

reinitialize

public void reinitialize(double[] _state)
Description copied from interface: ODESolverInterpolator
Does the minimum (soft) initialization of the solver to a given state. The memory is preserved. Users of an ODESolverInterpolator MUST call reinitialize (or the harder initialize) whenever they change the state. Typically, solvers synchronize their internal states and auxiliary variables using the provided state.

Specified by:
reinitialize in interface ODESolverInterpolator
Overrides:
reinitialize in class Radau5Adaptive
Parameters:
_state - double[]

getCurrentRate

public double[] getCurrentRate()
Description copied from interface: ODESolverInterpolator
Returns the rate of the current state

Specified by:
getCurrentRate in interface ODESolverInterpolator
Returns:

setEstimateFirstStep

public final void setEstimateFirstStep(boolean _estimate)
Description copied from interface: ODESolverInterpolator
Makes adaptive steps estimate the best initial step after reinitialize(). If false, the given initial step (as set by setStepSize()) is used.

Specified by:
setEstimateFirstStep in interface ODESolverInterpolator

getMaximumTime

public final double getMaximumTime()
Description copied from interface: ODESolverInterpolator
Returns the maximum time forward in time (or minimum, if the step is negative) for which the solver can interpolate without doing any internal step.

Specified by:
getMaximumTime in interface ODESolverInterpolator
Returns:
double The maximum advance time or NaN if there was any error.

internalStep

public final double internalStep()
Description copied from interface: ODESolverInterpolator
Steps the internal step as much as possible (respecting the step size and the tolerance, if any).

Specified by:
internalStep in interface ODESolverInterpolator
Returns:
double Same as getMaximumTime()

getInternalStepSize

public double getInternalStepSize()
Description copied from interface: ODESolverInterpolator
Returns the actual internal step size

Specified by:
getInternalStepSize in interface ODESolverInterpolator
Returns:

setMemoryLength

public void setMemoryLength(double length)
Description copied from interface: ODESolverInterpolator
Sets the length of the memory requested to the solver. Must be a positive value. The user will then be able to ask for values of the state as far as the current time minus this length. 0 is the default for plain ODE, getMaximumDelay() is the minimum used by DDEs. Setting a value of Infinity makes the solver to remmeber for ever (i.e. as much as computer memory permits)

Specified by:
setMemoryLength in interface ODESolverInterpolator

getStateMemory

public StateMemory getStateMemory()
Description copied from interface: ODESolverInterpolator
Provides access to the internal StateMemory responsible for interpolations.

Specified by:
getStateMemory in interface ODESolverInterpolator
Returns:

interpolate

public double[] interpolate(double _time,
                            boolean useLeftApproximation,
                            double[] _state)
Implements continuous vector function that approximates the solution of the ODE. Value of the vector function constructs using interpolation coefficients

Specified by:
interpolate in interface ODESolverInterpolator
Parameters:
time - the point where approximation to the solution to be obtained. (0 < time < takenstepSize corresponds to the interpolation, in other cases output will indeed the extrapolation)
result - the result, i.e. approximated solution of ODE
Returns:
The state provided as argument or null if there is no interpolation available at this time.

interpolate

public double[] interpolate(double _time,
                            boolean _useLeftApproximation,
                            double[] _state,
                            int _beginIndex,
                            int _length)

interpolate

public double interpolate(double _time,
                          boolean _useLeftApproximation,
                          int _index)

bestInterpolate

public double[] bestInterpolate(double _time,
                                double[] _state)
Description copied from interface: ODESolverInterpolator
Similar to interpolate(), but using the best estimate the algorith can provide and only between the current time and getMaximumTime(). In some RK schemes, this results in computing the RK algorithm from the initial point. Therefore, this method typically involves a bigger computational load.

Specified by:
bestInterpolate in interface ODESolverInterpolator
Returns:
The state provided as argument or null if there was any previous error.