org.opensourcephysics.numerics
Class Heun3

java.lang.Object
  extended by org.opensourcephysics.numerics.AbstractODESolver
      extended by org.opensourcephysics.numerics.Heun3
All Implemented Interfaces:
ODESolver

public class Heun3
extends AbstractODESolver

Heun3 implements Heun's third order algorithm for solving ODEs by evaluating the rate at the initial state, and two intermediate states. It then uses a weighted average to advance the state. Heun's method is known as a predictor-corrector method because it first predicts the state (estimated_state) and then corrects the rate based on the prediction.

Version:
1.0

Field Summary
 
Fields inherited from class org.opensourcephysics.numerics.AbstractODESolver
numEqn, ode, stepSize
 
Constructor Summary
Heun3(ODE ode)
          Constructor Heun3
 
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

Heun3

public Heun3(ODE ode)
Constructor Heun3

Parameters:
ode -
Method Detail

initialize

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
Overrides:
initialize in class AbstractODESolver
Parameters:
stepSize -

step

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
Returns:
the step size