org.apache.commons.math3.ode.nonstiff

## Class RungeKuttaIntegrator

- java.lang.Object
- - org.apache.commons.math3.ode.AbstractIntegrator
  - - org.apache.commons.math3.ode.nonstiff.RungeKuttaIntegrator

All Implemented Interfaces:
  FirstOrderIntegrator, ODEIntegrator

Direct Known Subclasses:
  ClassicalRungeKuttaIntegrator, EulerIntegrator, GillIntegrator, MidpointIntegrator, ThreeEighthesIntegrator

    public abstract class RungeKuttaIntegrator
    extends AbstractIntegrator

This class implements the common part of all fixed step Runge-Kutta integrators for Ordinary Differential Equations.

These methods are explicit Runge-Kutta methods, their Butcher arrays are as follows :

        0  |
       c2  | a21
       c3  | a31  a32
       ... |        ...
       cs  | as1  as2  ...  ass-1
           |--------------------------
           |  b1   b2  ...   bs-1  bs

Since:
  1.2
Version:
  $Id: RungeKuttaIntegrator.java 1416643 2012-12-03 19:37:14Z tn $
See Also:
  `EulerIntegrator`, `ClassicalRungeKuttaIntegrator`, `GillIntegrator`, `MidpointIntegrator`

### Field Summary

Fields
`private double[][]` `a` Internal weights from Butcher array (without the first empty row).
`private double[]` `b` External weights for the high order method from Butcher array.
`private double[]` `c` Time steps from Butcher array (without the first zero).
`private RungeKuttaStepInterpolator` `prototype` Prototype of the step interpolator.
`private double` `step` Integration step.

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

`isLastStep, resetOccurred, stepHandlers, stepSize, stepStart`

### Constructor Summary

Constructors
`protected` `RungeKuttaIntegrator(String name, double[] c, double[][] a, double[] b, RungeKuttaStepInterpolator prototype, double step)` Simple constructor.

### Method Summary

Methods
`void` `integrate(ExpandableStatefulODE equations, double t)` Integrate a set of differential equations up to the given time.

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

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

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

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

### Field Detail

#### c

    private final double[] c

Time steps from Butcher array (without the first zero).

#### a

    private final double[][] a

Internal weights from Butcher array (without the first empty row).

#### b

    private final double[] b

External weights for the high order method from Butcher array.

#### prototype

    private final RungeKuttaStepInterpolator prototype

Prototype of the step interpolator.

#### step

    private final double step

Integration step.

### Constructor Detail

#### RungeKuttaIntegrator

    protected RungeKuttaIntegrator(String name,
                        double[] c,
                        double[][] a,
                        double[] b,
                        RungeKuttaStepInterpolator prototype,
                        double step)

Simple constructor. Build a Runge-Kutta integrator with the given step. The default step handler does nothing.

Parameters:
  `name` - name of the method
  `c` - time steps from Butcher array (without the first zero)
  `a` - internal weights from Butcher array (without the first empty row)
  `b` - propagation weights for the high order method from Butcher array
  `prototype` - prototype of the step interpolator to use
  `step` - integration step

### Method Detail

#### integrate

    public void integrate(ExpandableStatefulODE equations,
                 double t)
                   throws NumberIsTooSmallException,
                          DimensionMismatchException,
                          MaxCountExceededException,
                          NoBracketingException

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 `AbstractIntegrator`
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:
  `NumberIsTooSmallException` - if integration step is too small
  `DimensionMismatchException` - if the dimension of the complete state does not match the complete equations sets dimension
  `MaxCountExceededException` - if the number of functions evaluations is exceeded
  `NoBracketingException` - if the location of an event cannot be bracketed