org.apache.commons.math.ode.nonstiff
Class AdamsIntegrator

java.lang.Object
  extended by org.apache.commons.math.ode.AbstractIntegrator
      extended by org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator
          extended by org.apache.commons.math.ode.MultistepIntegrator
              extended by org.apache.commons.math.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:
$Revision: 790368 $ $Date: 2009-07-01 16:31:50 -0400 (Wed, 01 Jul 2009) $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.commons.math.ode.MultistepIntegrator
MultistepIntegrator.NordsieckTransformer
 
Field Summary
private  AdamsNordsieckTransformer transformer
          Transformer.
 
Fields inherited from class org.apache.commons.math.ode.MultistepIntegrator
nordsieck, scaled
 
Fields inherited from class org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator
scalAbsoluteTolerance, scalRelativeTolerance, vecAbsoluteTolerance, vecRelativeTolerance
 
Fields inherited from class org.apache.commons.math.ode.AbstractIntegrator
eventsHandlersManager, stepHandlers, stepSize, stepStart
 
Constructor Summary
AdamsIntegrator(java.lang.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(java.lang.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 prameters.
 
Method Summary
protected  Array2DRowRealMatrix initializeHighOrderDerivatives(double[] first, double[][] multistep)
          Initialize the high order scaled derivatives at step start.
abstract  double integrate(FirstOrderDifferentialEquations equations, double t0, double[] y0, double t, double[] y)
          Integrate the 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.math.ode.MultistepIntegrator
computeStepGrowShrinkFactor, getMaxGrowth, getMinReduction, getSafety, getStarterIntegrator, setMaxGrowth, setMinReduction, setSafety, setStarterIntegrator, start
 
Methods inherited from class org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator
filterStep, getCurrentStepStart, getMaxStep, getMinStep, initializeStep, resetInternalState, sanityChecks, setInitialStepSize
 
Methods inherited from class org.apache.commons.math.ode.AbstractIntegrator
addEndTimeChecker, addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, computeDerivatives, getCurrentSignedStepsize, getEvaluations, getEventHandlers, getMaxEvaluations, getName, getStepHandlers, requiresDenseOutput, resetEvaluations, setEquations, setMaxEvaluations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transformer

private final AdamsNordsieckTransformer transformer
Transformer.

Constructor Detail

AdamsIntegrator

public AdamsIntegrator(java.lang.String name,
                       int nSteps,
                       int order,
                       double minStep,
                       double maxStep,
                       double scalAbsoluteTolerance,
                       double scalRelativeTolerance)
                throws java.lang.IllegalArgumentException
Build an Adams integrator with the given order and step control prameters.

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 (must be positive even for backward integration), the last step can be smaller than this
maxStep - maximal step (must be positive even for backward integration)
scalAbsoluteTolerance - allowed absolute error
scalRelativeTolerance - allowed relative error
Throws:
java.lang.IllegalArgumentException - if order is 1 or less

AdamsIntegrator

public AdamsIntegrator(java.lang.String name,
                       int nSteps,
                       int order,
                       double minStep,
                       double maxStep,
                       double[] vecAbsoluteTolerance,
                       double[] vecRelativeTolerance)
                throws java.lang.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 (must be positive even for backward integration), the last step can be smaller than this
maxStep - maximal step (must be positive even for backward integration)
vecAbsoluteTolerance - allowed absolute error
vecRelativeTolerance - allowed relative error
Throws:
java.lang.IllegalArgumentException - if order is 1 or less
Method Detail

integrate

public abstract double integrate(FirstOrderDifferentialEquations equations,
                                 double t0,
                                 double[] y0,
                                 double t,
                                 double[] y)
                          throws DerivativeException,
                                 IntegratorException
Integrate the differential equations up to the given time.

This method solves an Initial Value Problem (IVP).

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

Specified by:
integrate in interface FirstOrderIntegrator
Specified by:
integrate in class AdaptiveStepsizeIntegrator
Parameters:
equations - differential equations to integrate
t0 - initial time
y0 - initial value of the state vector at t0
t - target time for the integration (can be set to a value smaller than t0 for backward integration)
y - placeholder where to put the state vector at each successful step (and hence at the end of integration), can be the same object as y0
Returns:
stop time, will be the same as target time if integration reached its target, but may be different if some EventHandler stops it at some point.
Throws:
DerivativeException - this exception is propagated to the caller if the underlying user function triggers one
IntegratorException - if the integrator cannot perform integration

initializeHighOrderDerivatives

protected Array2DRowRealMatrix initializeHighOrderDerivatives(double[] first,
                                                              double[][] multistep)
Initialize the high order scaled derivatives at step start.

Specified by:
initializeHighOrderDerivatives in class MultistepIntegrator
Parameters:
first - first scaled derivative at step start
multistep - scaled derivatives after step start (hy'1, ..., hy'k-1) will be modified
Returns:
high order scaled derivatives at step start

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 (c) 2003-2012 Apache Software Foundation