|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcnuphys.rk4.RungeKutta4
public class RungeKutta4
A fourth order Runge-Kutta integrator with constant step size..
| Constructor Summary | |
|---|---|
RungeKutta4()
A RungeKutta integrator |
|
| Method Summary | |
|---|---|
void |
advance(double t,
double[] y,
double[] dydt,
double h,
IDerivative deriv,
double[] yout)
Advance the solution by one step of the independent variable. |
static void |
main(java.lang.String[] args)
Main program for testing. |
int |
uniformStep(double[] yo,
double to,
double tf,
double[][] y,
double[] t,
IDerivative deriv,
ISwimmer swimmer)
Driver that uses the RungeKutta advance with a uniform step size. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RungeKutta4()
| Method Detail |
|---|
public void advance(double t,
double[] y,
double[] dydt,
double h,
IDerivative deriv,
double[] yout)
advance in interface ISteppert - the value of the independent variable (usually t) (input).y - the values of the state vector (usually [x,y,z,vx,vy,vz]) at t (input).dydt - will be filled with the values of the derivatives at t (input).h - the current step size (input)deriv - the function (interface) that can compute the derivatives.
That is where the problem specificity resides (input).yout - where the state vector at the next step will be stored (iutput)
public int uniformStep(double[] yo,
double to,
double tf,
double[][] y,
double[] t,
IDerivative deriv,
ISwimmer swimmer)
yo - initial values. Probably something like (xo, yo, zo, vxo, vyo,
vzo).to - the initial value of the independent variable, e.g., time.tf - the maximum value of the independent variable.y - will be filled with results. The first index is small-- the
dimensionality of the problem-- i.e., often it is 6 for (xo,
yo, zo, vxo, vyo, vzo). The second dimension is for storing
results and determining stepsize. If it is 1000, we will have
a thousand steps and the stepsize will be (tf-to)/1000
(actually 999).t - will filled with the locations of t--should have the exact same
large dimension as the second index of y--i.e., something like
1000.derive - the derivative computer (interface). This is where the problem specificity resides.swimmer - if not null will be used to exit the
integration early because some condition has been reached.
public static void main(java.lang.String[] args)
args - command line arguments.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||