Package org.apache.commons.math4.legacy.ode
This package provides classes to solve Ordinary Differential Equations problems.
This package solves Initial Value Problems of the form
y'=f(t,y)
with t_{0}
and
y(t_{0})=y_{0}
known. The provided
integrators compute an estimate of y(t)
from
t=t_{0}
to t=t_{1}
.
It is also possible to get the derivatives with respect to the initial state
dy(t)/dy(t_{0})
or the derivatives with
respect to some ODE parameters dy(t)/dp
.
All integrators provide dense output. This means that besides
computing the state vector at discrete times, they also provide a
cheap mean to get the state between the time steps. They do so through
classes extending the StepInterpolator
abstract class, which are made available to the user at the end of
each step.
All integrators handle multiple discrete events detection based on switching functions. This means that the integrator can be driven by user specified discrete events. The steps are shortened as needed to ensure the events occur at step boundaries (even if the integrator is a fixedstep integrator). When the events are triggered, integration can be stopped (this is called a Gstop facility), the state vector can be changed, or integration can simply go on. The latter case is useful to handle discontinuities in the differential equations gracefully and get accurate dense output even close to the discontinuity.
The user should describe his problem in his own classes
(UserProblem
in the diagram below) which should implement
the FirstOrderDifferentialEquations
interface. Then he should pass it to
the integrator he prefers among all the classes that implement the
FirstOrderIntegrator
interface.
The solution of the integration problem is provided by two means. The
first one is aimed towards simple use: the state vector at the end of
the integration process is copied in the y
array of the
FirstOrderIntegrator.integrate
method. The second one should be used
when more indepth information is needed throughout the integration
process. The user can register an object implementing the StepHandler
interface or a
StepNormalizer
object wrapping a userspecified object implementing the FixedStepHandler
interface into the integrator before calling the FirstOrderIntegrator.integrate
method. The user object will be called
appropriately during the integration process, allowing the user to
process intermediate results. The default step handler does nothing.
ContinuousOutputModel
is a specialpurpose step handler that is able
to store all steps and to provide transparent access to any
intermediate result once the integration is over. An important feature
of this class is that it implements the Serializable
interface. This means that a complete continuous model of the
integrated function throughout the integration range can be serialized
and reused later (if stored into a persistent medium like a file system
or a database) or elsewhere (if sent to another application). Only the
result of the integration is stored, there is no reference to the
integrated problem by itself.
Other default implementations of the StepHandler
interface are
available for general needs (DummyStepHandler
, StepNormalizer
) and custom
implementations can be developed for specific needs. As an example,
if an application is to be completely driven by the integration
process, then most of the application code will be run inside a step
handler specific to this application.
Some integrators (the simple ones) use fixed steps that are set at
creation time. The more efficient integrators use variable steps that
are handled internally in order to control the integration error with
respect to a specified accuracy (these integrators extend the AdaptiveStepsizeIntegrator
abstract class). In this case, the step
handler which is called after each successful step shows up the
variable stepsize. The StepNormalizer
class can
be used to convert the variable stepsize into a fixed stepsize that
can be handled by classes implementing the FixedStepHandler
interface. Adaptive stepsize integrators can automatically compute the
initial stepsize by themselves, however the user can specify it if he
prefers to retain full control over the integration or if the
automatic guess is wrong.
Fixed Step Integrators  
Name  Order 
Euler  1 
Midpoint  2 
Classical RungeKutta  4 
Gill  4 
3/8  4 
Luther  6 
Adaptive Stepsize Integrators  
Name  Integration Order  Error Estimation Order 
Higham and Hall  5  4 
DormandPrince 5(4)  5  4 
DormandPrince 8(5,3)  8  5 and 3 
GraggBulirschStoer  variable (up to 18 by default)  variable 
AdamsBashforth  variable  variable 
AdamsMoulton  variable  variable 
In the table above, the AdamsBashforth
and AdamsMoulton
integrators appear as variablestep ones. This is an experimental extension
to the classical algorithms using the Nordsieck vector representation.

Interface Summary Interface Description FieldSecondaryEquations<T extends RealFieldElement<T>> This interface allows users to add secondary differential equations to a primary set of differential equations.FirstOrderDifferentialEquations This interface represents a first order differential equations set.FirstOrderFieldDifferentialEquations<T extends RealFieldElement<T>> This interface represents a first order differential equations set.FirstOrderFieldIntegrator<T extends RealFieldElement<T>> This interface represents a first order integrator for differential equations.FirstOrderIntegrator This interface represents a first order integrator for differential equations.MainStateJacobianProvider Interface expandingfirst order differential equations
in order to compute exactly the main state jacobian matrix forpartial derivatives equations
.MultistepIntegrator.NordsieckTransformer Deprecated. as of 3.6 this unused interface is deprecatedODEIntegrator This interface defines the common parts shared by integrators for first and second order differential equations.Parameterizable This interface enables to process any parameterizable object.ParameterizedODE Interface to compute by finite difference Jacobian matrix for some parameter when computingpartial derivatives equations
.ParameterJacobianProvider Interface to compute exactly Jacobian matrix for some parameter when computingpartial derivatives equations
.SecondaryEquations This interface allows users to add secondary differential equations to a primary set of differential equations.SecondOrderDifferentialEquations This interface represents a second order differential equations set.SecondOrderIntegrator This interface represents a second order integrator for differential equations. 
Class Summary Class Description AbstractFieldIntegrator<T extends RealFieldElement<T>> Base class managing common boilerplate for all integrators.AbstractIntegrator Base class managing common boilerplate for all integrators.AbstractParameterizable This abstract class provides boilerplate parameters list.ContinuousOutputFieldModel<T extends RealFieldElement<T>> This class stores all information provided by an ODE integrator during the integration process and build a continuous model of the solution from this.ContinuousOutputModel This class stores all information provided by an ODE integrator during the integration process and build a continuous model of the solution from this.EquationsMapper Class mapping the part of a complete state or derivative that pertains to a specific differential equation.ExpandableStatefulODE This class represents a combined set of first order differential equations, with at least a primary set of equations expandable by some sets of secondary equations.FieldEquationsMapper<T extends RealFieldElement<T>> Class mapping the part of a complete state or derivative that pertains to a set of differential equations.FieldExpandableODE<T extends RealFieldElement<T>> This class represents a combined set of first order differential equations, with at least a primary set of equations expandable by some sets of secondary equations.FieldODEState<T extends RealFieldElement<T>> Container for time, main and secondary state vectors.FieldODEStateAndDerivative<T extends RealFieldElement<T>> Container for time, main and secondary state vectors as well as their derivatives.FirstOrderConverter This class converts second order differential equations to first order ones.JacobianMatrices This class defines a set ofsecondary equations
to compute the Jacobian matrices with respect to the initial state vector and, if any, to some parameters of the primary ODE set.MultistepFieldIntegrator<T extends RealFieldElement<T>> This class is the base class for multistep integrators for Ordinary Differential Equations.MultistepIntegrator This class is the base class for multistep integrators for Ordinary Differential Equations. 
Exception Summary Exception Description JacobianMatrices.MismatchedEquations Special exception for equations mismatch.UnknownParameterException Exception to be thrown when a parameter is unknown.