org.apache.commons.math3.ode.nonstiff

## Class AdamsIntegrator

- java.lang.Object
- - org.apache.commons.math3.ode.AbstractIntegrator
  - - org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator
    - - org.apache.commons.math3.ode.MultistepIntegrator
      - - org.apache.commons.math3.ode.nonstiff.AdamsIntegrator

- All Implemented Interfaces:
    FirstOrderIntegrator, ODEIntegrator
  Direct Known Subclasses:
    AdamsBashforthIntegrator, AdamsMoultonIntegrator

      public abstract class AdamsIntegrator
      extends MultistepIntegrator

  Base class for `Adams-Bashforth` and `Adams-Moulton` integrators.
  Since:
    2.0
  Version:
    $Id: AdamsIntegrator.java 1244107 2012-02-14 16:17:55Z erans $

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.commons.math3.ode.MultistepIntegrator

      `MultistepIntegrator.NordsieckTransformer`

  - ### Field Summary

    - ### Fields inherited from class org.apache.commons.math3.ode.MultistepIntegrator

      `nordsieck, scaled`

    - ### Fields inherited from class org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator

      `mainSetDimension, scalAbsoluteTolerance, scalRelativeTolerance, vecAbsoluteTolerance, vecRelativeTolerance`

    - ### Fields inherited from class org.apache.commons.math3.ode.AbstractIntegrator

      `isLastStep, resetOccurred, stepHandlers, stepSize, stepStart`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdamsIntegrator(String name, int nSteps, int order, double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance)` Build an Adams integrator with the given order and step control parameters.
    `AdamsIntegrator(String name, int nSteps, int order, double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance)` Build an Adams integrator with the given order and step control parameters.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Array2DRowRealMatrix` | `initializeHighOrderDerivatives(double h, double[] t, double[][] y, double[][] yDot)` Initialize the high order scaled derivatives at step start.
    `abstract void` | `integrate(ExpandableStatefulODE equations, double t)` Integrate a set of differential equations up to the given time.
    `Array2DRowRealMatrix` | `updateHighOrderDerivativesPhase1(Array2DRowRealMatrix highOrder)` Update the high order scaled derivatives for Adams integrators (phase 1).
    `void` | `updateHighOrderDerivativesPhase2(double[] start, double[] end, Array2DRowRealMatrix highOrder)` Update the high order scaled derivatives Adams integrators (phase 2).

    - ### Methods inherited from class org.apache.commons.math3.ode.MultistepIntegrator

      `computeStepGrowShrinkFactor, getMaxGrowth, getMinReduction, getSafety, getStarterIntegrator, setMaxGrowth, setMinReduction, setSafety, setStarterIntegrator, start`

    - ### Methods inherited from class org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator

      `filterStep, getCurrentStepStart, getMaxStep, getMinStep, initializeStep, resetInternalState, sanityChecks, setInitialStepSize, setStepSizeControl, setStepSizeControl`

    - ### Methods inherited from class org.apache.commons.math3.ode.AbstractIntegrator

      `acceptStep, addEventHandler, addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, computeDerivatives, getCurrentSignedStepsize, getEvaluations, getEventHandlers, getMaxEvaluations, getName, getStepHandlers, initIntegration, integrate, setEquations, setMaxEvaluations, setStateInitialized`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AdamsIntegrator

          public AdamsIntegrator(String name,
                         int nSteps,
                         int order,
                         double minStep,
                         double maxStep,
                         double scalAbsoluteTolerance,
                         double scalRelativeTolerance)
                          throws IllegalArgumentException

      Build an Adams integrator with the given order and step control parameters.
      Parameters:
        `name` - name of the method
        `nSteps` - number of steps of the method excluding the one being computed
        `order` - order of the method
        `minStep` - minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
        `maxStep` - maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
        `scalAbsoluteTolerance` - allowed absolute error
        `scalRelativeTolerance` - allowed relative error
      Throws:
        `IllegalArgumentException` - if order is 1 or less

    - #### AdamsIntegrator

          public AdamsIntegrator(String name,
                         int nSteps,
                         int order,
                         double minStep,
                         double maxStep,
                         double[] vecAbsoluteTolerance,
                         double[] vecRelativeTolerance)
                          throws IllegalArgumentException

      Build an Adams integrator with the given order and step control parameters.
      Parameters:
        `name` - name of the method
        `nSteps` - number of steps of the method excluding the one being computed
        `order` - order of the method
        `minStep` - minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
        `maxStep` - maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
        `vecAbsoluteTolerance` - allowed absolute error
        `vecRelativeTolerance` - allowed relative error
      Throws:
        `IllegalArgumentException` - if order is 1 or less

  - ### Method Detail

    - #### integrate

          public abstract void integrate(ExpandableStatefulODE equations,
                       double t)
                                  throws MathIllegalStateException,
                                         MathIllegalArgumentException

      Integrate a set of differential equations up to the given time.

      This method solves an Initial Value Problem (IVP).

      The set of differential equations is composed of a main set, which can be extended by some sets of secondary equations. The set of equations must be already set up with initial time and partial states. At integration completion, the final time and partial states will be available in the same object.

      Since this method stores some internal state variables made available in its public interface during integration (`AbstractIntegrator.getCurrentSignedStepsize()`), it is not thread-safe.

      Specified by:
        `integrate` in class `AdaptiveStepsizeIntegrator`
      Parameters:
        `equations` - complete set of differential equations to integrate
        `t` - target time for the integration (can be set to a value smaller than `t0` for backward integration)
      Throws:
        `MathIllegalStateException` - if the integrator cannot perform integration
        `MathIllegalArgumentException` - if integration parameters are wrong (typically too small integration span)

    - #### initializeHighOrderDerivatives

          protected Array2DRowRealMatrix initializeHighOrderDerivatives(double h,
                                                            double[] t,
                                                            double[][] y,
                                                            double[][] yDot)

      Initialize the high order scaled derivatives at step start.
      Specified by:
        `initializeHighOrderDerivatives` in class `MultistepIntegrator`
      Parameters:
        `h` - step size to use for scaling
        `t` - first steps times
        `y` - first steps states
        `yDot` - first steps derivatives
      Returns:
        Nordieck vector at first step (h2/2 y''n, h3/6 y'''n ... hk/k! y(k)n)

    - #### updateHighOrderDerivativesPhase1

          public Array2DRowRealMatrix updateHighOrderDerivativesPhase1(Array2DRowRealMatrix highOrder)

      Update the high order scaled derivatives for Adams integrators (phase 1).

      The complete update of high order derivatives has a form similar to:

           rn+1 = (s1(n) - s1(n+1)) P-1 u + P-1 A P rn

      this method computes the P-1 A P rn part.
      Parameters:
        `highOrder` - high order scaled derivatives (h2/2 y'', ... hk/k! y(k))
      Returns:
        updated high order derivatives
      See Also:
        `updateHighOrderDerivativesPhase2(double[], double[], Array2DRowRealMatrix)`

    - #### updateHighOrderDerivativesPhase2

          public void updateHighOrderDerivativesPhase2(double[] start,
                                              double[] end,
                                              Array2DRowRealMatrix highOrder)

      Update the high order scaled derivatives Adams integrators (phase 2).

      The complete update of high order derivatives has a form similar to:

           rn+1 = (s1(n) - s1(n+1)) P-1 u + P-1 A P rn

      this method computes the (s1(n) - s1(n+1)) P-1 u part.

      Phase 1 of the update must already have been performed.

      Parameters:
        `start` - first order scaled derivatives at step start
        `end` - first order scaled derivatives at step end
        `highOrder` - high order scaled derivatives, will be modified (h2/2 y'', ... hk/k! y(k))
      See Also:
        `updateHighOrderDerivativesPhase1(Array2DRowRealMatrix)`

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.