core.math
Class RungeKuttaIntegration

java.lang.Object
  extended bycore.math.RungeKuttaIntegration

public class RungeKuttaIntegration
extends java.lang.Object

Runge Kutta Integration 4th order.

Version:
1.0
Author:
Andreas Sundquist, John Belcher

Field Summary
(package private)  int dim
          The number of first order equations we are integrating.
private  VecTimeField field
          The derivative matrix of the dependent variables we are integrating.
(package private)  double maxStep
          The maxstep we take to get to the point requested if stepped is true.
(package private)  boolean stepped
          If this is true then we step to the requested point in steps of maxstep, and if it is false we step to the requested point directly in the one step requested.
private  Vec x
          Variables used to compute the stages of the RK step.
 
Constructor Summary
RungeKuttaIntegration()
          Constructor for the straight Runge Kutta 4th order integration.
RungeKuttaIntegration(double maxStep)
          Constructor for the stepped Runge Kutta 4th order integration.
 
Method Summary
private  void ComputeStep(double s, double ds)
          Compute one RK step from s to s + ds.
 void Evolve(VecTimeField field, Vec x, double s, double ds)
          Evolve the system from x at s to the new x at x + ds, in one step or a number of small steps, depending on what is requested.
 void SetStep(double maxStep)
          Sets the maxStep if it has not already been set in the constructor call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stepped

boolean stepped
If this is true then we step to the requested point in steps of maxstep, and if it is false we step to the requested point directly in the one step requested.


maxStep

double maxStep
The maxstep we take to get to the point requested if stepped is true.


dim

int dim
The number of first order equations we are integrating. That is, this is the number of dependent variables.


x

private Vec x
Variables used to compute the stages of the RK step.


field

private VecTimeField field
The derivative matrix of the dependent variables we are integrating. These are set in the Motion method of the experiment.

Constructor Detail

RungeKuttaIntegration

public RungeKuttaIntegration()
Constructor for the straight Runge Kutta 4th order integration. We step directly to where we want to go in one step.


RungeKuttaIntegration

public RungeKuttaIntegration(double maxStep)
Constructor for the stepped Runge Kutta 4th order integration. We step to where we want to go in steps that do not exceed maxstep.

Parameters:
maxStep - The maximum step we take.
Method Detail

SetStep

public void SetStep(double maxStep)
Sets the maxStep if it has not already been set in the constructor call.

Parameters:
maxStep - The maximum step we can take.

Evolve

public void Evolve(VecTimeField field,
                   Vec x,
                   double s,
                   double ds)
Evolve the system from x at s to the new x at x + ds, in one step or a number of small steps, depending on what is requested. Returns the value of x at x + ds in the value of x. DOES NOT UPDATE THE VALUE OF S TO S + DS!!!!!

Parameters:
field - gives the time derivatives of the variables in x
x - the vector state of the system, which depends on time
s - independent variable, e.g. time
ds - step size in the independent variable

ComputeStep

private void ComputeStep(double s,
                         double ds)
Compute one RK step from s to s + ds. This is the fourth order RK step.

Parameters:
s - the independent variable
ds - the step in the independent variable