core.math
Class RungeKuttaErrorIntegration
java.lang.Object
core.math.RungeKuttaErrorIntegration
- public class RungeKuttaErrorIntegration
- extends java.lang.Object
RungeKutta Integration with error analysis
Method Summary |
Vec |
ComputeStep(double s,
double ds,
int dim)
|
void |
Evolve(VecTimeField field,
Vec xinput,
double s,
double ds,
double eps,
double hmin)
|
static Vec |
rungeKuttaFourthOrder(VecTimeField field,
Vec X_at_s,
Vec dXds_at_s,
double s_start,
double h,
int dim)
This is the basic fourth order RungeKutta stepping routine. |
static double[] |
rungeKuttaQualityControl(VecTimeField field,
Vec Xnew,
Vec dXds,
double sgiven,
double htry,
double eps,
Vec Xscal,
int dim)
Given a value of X and dX/ds at s, a stepsize h, an allowed error, and a way to
compute dX/ds at new points, this method will return a new value
of the dependent variables X at s, where s incremented over s by an amount
not more than h, but perhaps much less than h, but with an error in X of less
than the desired error. |
void |
SetStep(double maxStep)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stepped
boolean stepped
maxStep
double maxStep
dim
int dim
xinput
private Vec xinput
field
private VecTimeField field
eps
private double eps
hmin
private double hmin
RungeKuttaErrorIntegration
public RungeKuttaErrorIntegration()
RungeKuttaErrorIntegration
public RungeKuttaErrorIntegration(double maxStep)
SetStep
public void SetStep(double maxStep)
ComputeStep
public Vec ComputeStep(double s,
double ds,
int dim)
Evolve
public void Evolve(VecTimeField field,
Vec xinput,
double s,
double ds,
double eps,
double hmin)
rungeKuttaQualityControl
public static double[] rungeKuttaQualityControl(VecTimeField field,
Vec Xnew,
Vec dXds,
double sgiven,
double htry,
double eps,
Vec Xscal,
int dim)
- Given a value of X and dX/ds at s, a stepsize h, an allowed error, and a way to
compute dX/ds at new points, this method will return a new value
of the dependent variables X at s, where s incremented over s by an amount
not more than h, but perhaps much less than h, but with an error in X of less
than the desired error. The size of the step actually taken is hdid. If we are
taking too small a step for the error we desire, we return hnext as an estimate
of the step size for the next step which will still be just within our desired error.
- Parameters:
Xnew
- This is the valve of X at sdXds
- The derivative dX/ds at out initial value of the independent parameter.sgiven
- This is the initial value of the independent variable.htry
- The initial value of the stepsize to try, which is subsequently modified depending
on the estimated error and our desired error.eps
- Desired error.Xscal
- Defines the meaning of error.
- Returns:
- The new value the dependent values, with other things stored in array, e.g. the new s, hdid, hnext, and so on
rungeKuttaFourthOrder
public static Vec rungeKuttaFourthOrder(VecTimeField field,
Vec X_at_s,
Vec dXds_at_s,
double s_start,
double h,
int dim)
- This is the basic fourth order RungeKutta stepping routine.
Given the value X of the dependent variables at s, and a
step size h, and the ability to evaluate the derivatives
dX/ds at any s, the routine returns an estimate of the value
of X at s + h.
- Parameters:
X_at_s
- This is the initial value of X at the starting value of s.dXds_at_s
- This is the initial value of the derivatives dX/ds at the
starting value of s. This derivative must be provided to
the routine.s_start
- The initial value of the independent variable.h
- The step size.
- Returns:
- An estimate of the value of the dependent variables X at
s + h.