Class Ralston2

  extended by org.opensourcephysics.numerics.AbstractODESolver
      extended by org.opensourcephysics.numerics.Ralston2
All Implemented Interfaces:

public class Ralston2
extends AbstractODESolver

Ralston2 implements Ralston's algorithm for solving ODEs by evaluating the rate at the initial state, estimating the rate for the final state, and using a weighted average of these two rates to advance the state.


Field Summary
Fields inherited from class org.opensourcephysics.numerics.AbstractODESolver
numEqn, ode, stepSize
Constructor Summary
Ralston2(ODE ode)
          Constructor Ralston2
Method Summary
 void initialize(double stepSize)
          Initializes the ODE solver and allocates the rate and state arrays.
 double step()
          Steps (advances) the differential equations by the stepSize.
Methods inherited from class org.opensourcephysics.numerics.AbstractODESolver
getStepSize, setStepSize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Ralston2(ODE ode)
Constructor Ralston2

ode -
Method Detail


public void initialize(double stepSize)
Initializes the ODE solver and allocates the rate and state arrays. The number of differential equations is determined by invoking getState().length on the superclass.

Specified by:
initialize in interface ODESolver
initialize in class AbstractODESolver
stepSize -


public double step()
Steps (advances) the differential equations by the stepSize. The ODESolver invokes the ODE's getState method to obtain the initial state of the system. The ODESolver then uses this state estimate the rate a intermediate points. Finally, the ODESolver advances the solution and copies the new state into the state array at the end of the solution step.

Specified by:
step in interface ODESolver
Specified by:
step in class AbstractODESolver
the step size