|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectintegrators.Integrator
integrators.MidpointIntegrator
Modified Midpoint Method as described in Numerical Recipes in C; this is NOT a translation of their code (which I didn't even look at), but merely my implementation of the recipe outlined in the text. This should be used as a subsidiary of an Bulirsch-Stoer-type Integrator, but can also be used as an integrator in it own right, although since I have a hard time imagining why anyone would do so, the error control implemented here is rudimentary and inefficient. The goal of this approach is to cross a large interval H with a series of n substeps h. The first substep is a forward Euler step. Subsequent steps are midpoint estimates with y(t+h) = y(t-h) + 2hf(y(t)). The final step averages the first estimate of y(t+nh) with a backward Euler step from y(t+(n-1)h). Calling MidpointIntegrator.IntegrateOneStep(int n) causes the Integrator to cross the interval set by its timestep using n substeps. This is the call to make if the MidpointIntegrater is being used as a susidiary method. The generic IntegrateOneStep() method, on the other hand, allows one to use this method in its own right according to a formula in NRC (see comment in MidpointIntegrator.IntegrateOneStep()).
Nested Class Summary |
Nested classes inherited from class integrators.Integrator |
Integrator.NVmatrix, Integrator.NVvector |
Constructor Summary | |
MidpointIntegrator()
no-argument constructor allows instantiating a MidpointIntegrator generically from its name alone, with default number of substeps = 8. |
Method Summary | |
void |
init(Model model)
init() allocates the necessary storage, nothing else. |
float |
IntegrateOneStep()
Call IntegrateOneStep() to use the Modified Midpoint Method by itself; this call uses an estimate give in NRC based on a weighted sum of results from crossing the interval with n/2 substeps and then with n substeps... |
float |
IntegrateOneStep(int num_substeps)
Call IntegrateOneStep(int) with the desired number of substeps as the argument when using the Modified Midpoint Method as part of another method, like the BulirschStoerIntegrator. |
void |
setNumberOfSubsteps(int n)
If one is going to use this object as an integrator in its own right, rather than as a subsidiary of a more sophisticate one, then one has the option of setting how many substeps it uses to cross an interval. |
Methods inherited from class integrators.Integrator |
copyNVarray, getCurrentValues, getDerivatives, getErrorEstimate, isType, reset, setDefaultStepSize, setErrorTolerance, setFinalValues, setIntegrationValues, setStepSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MidpointIntegrator()
Method Detail |
public void init(Model model)
init
in class Integrator
public float IntegrateOneStep()
IntegrateOneStep
in class Integrator
public float IntegrateOneStep(int num_substeps)
public void setNumberOfSubsteps(int n)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |