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

java.lang.Object
  extended by org.apache.commons.math.ode.AbstractIntegrator
      extended by org.apache.commons.math.ode.nonstiff.MultistepIntegrator
          extended by org.apache.commons.math.ode.nonstiff.AdamsBashforthIntegrator
All Implemented Interfaces:
Serializable, FirstOrderIntegrator, ODEIntegrator

public class AdamsBashforthIntegrator
extends MultistepIntegrator

This class implements explicit Adams-Bashforth integrators for Ordinary Differential Equations.

Adams-Bashforth (in fact due to Adams alone) methods are explicit multistep ODE solvers witch fixed stepsize. The value of state vector at step n+1 is a simple combination of the value at step n and of the derivatives at steps n, n-1, n-2 ... Depending on the number k of previous steps one wants to use for computing the next value, different formulas are available:

A k-steps Adams-Bashforth method is of order k. There is no limit to the value of k.

These methods are explicit: fn+1 is not used to compute yn+1. More accurate implicit Adams methods exist: the Adams-Moulton methods (which are also due to Adams alone). They are provided by the AdamsMoultonIntegrator class.

Since:
2.0
Version:
$Revision: 676891 $ $Date: 2008-07-15 13:53:23 +0200 (mar., 15 juil. 2008) $
See Also:
AdamsMoultonIntegrator, BDFIntegrator, Serialized Form

Field Summary
 
Fields inherited from class org.apache.commons.math.ode.nonstiff.MultistepIntegrator
previousF, previousT, prototype
 
Fields inherited from class org.apache.commons.math.ode.AbstractIntegrator
eventsHandlersManager, stepHandlers, stepSize, stepStart
 
Constructor Summary
AdamsBashforthIntegrator(int order, double step)
          Build an Adams-Bashforth integrator with the given order and step size.
 
Method Summary
 double[] getCoeffs()
          Get the coefficients of the method.
 double integrate(FirstOrderDifferentialEquations equations, double t0, double[] y0, double t, double[] y)
          Integrate the differential equations up to the given time.
 
Methods inherited from class org.apache.commons.math.ode.nonstiff.MultistepIntegrator
getStarterIntegrator, rotatePreviousSteps, setStarterIntegrator, start
 
Methods inherited from class org.apache.commons.math.ode.AbstractIntegrator
addEndTimeChecker, addEventHandler, addStepHandler, clearEventHandlers, clearStepHandlers, getCurrentSignedStepsize, getCurrentStepStart, getEventHandlers, getName, getStepHandlers, requiresDenseOutput, sanityChecks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdamsBashforthIntegrator

public AdamsBashforthIntegrator(int order,
                                double step)
Build an Adams-Bashforth integrator with the given order and step size.

Parameters:
order - order of the method (must be strictly positive)
step - integration step size
Method Detail

integrate

public 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.

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

getCoeffs

public double[] getCoeffs()
Get the coefficients of the method.

The coefficients are the ci terms in the following formula:

   yn+1 = yn + h × ∑i=0i=k-1 cifn-i
 

Returns:
a copy of the coefficients of the method


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