Class DormandPrince853Integrator

  • All Implemented Interfaces:
    ButcherArrayProvider, ODEIntegrator

    public class DormandPrince853Integrator
    extends EmbeddedRungeKuttaIntegrator
    This class implements the 8(5,3) Dormand-Prince integrator for Ordinary Differential Equations.

    This integrator is an embedded Runge-Kutta integrator of order 8(5,3) used in local extrapolation mode (i.e. the solution is computed using the high order formula) with stepsize control (and automatic step initialization) and continuous output. This method uses 12 functions evaluations per step for integration and 4 evaluations for interpolation. However, since the first interpolation evaluation is the same as the first integration evaluation of the next step, we have included it in the integrator rather than in the interpolator and specified the method was an fsal. Hence, despite we have 13 stages here, the cost is really 12 evaluations per step even if no interpolation is done, and the overcost of interpolation is only 3 evaluations.

    This method is based on an 8(6) method by Dormand and Prince (i.e. order 8 for the integration and order 6 for error estimation) modified by Hairer and Wanner to use a 5th order error estimator with 3rd order correction. This modification was introduced because the original method failed in some cases (wrong steps can be accepted when step size is too large, for example in the Brusselator problem) and also had severe difficulties when applied to problems with discontinuities. This modification is explained in the second edition of the first volume (Nonstiff Problems) of the reference book by Hairer, Norsett and Wanner: Solving Ordinary Differential Equations (Springer-Verlag, ISBN 3-540-56670-8).

    • Constructor Detail

      • DormandPrince853Integrator

        public DormandPrince853Integrator​(double minStep,
                                          double maxStep,
                                          double scalAbsoluteTolerance,
                                          double scalRelativeTolerance)
        Simple constructor. Build a fifth order Dormand-Prince integrator with the given step bounds
        Parameters:
        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
      • DormandPrince853Integrator

        public DormandPrince853Integrator​(double minStep,
                                          double maxStep,
                                          double[] vecAbsoluteTolerance,
                                          double[] vecRelativeTolerance)
        Simple constructor. Build a fifth order Dormand-Prince integrator with the given step bounds
        Parameters:
        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
    • Method Detail

      • getC

        public double[] getC()
        Get the time steps from Butcher array (without the first zero).
        Returns:
        time steps from Butcher array (without the first zero
      • getA

        public double[][] getA()
        Get the internal weights from Butcher array (without the first empty row).
        Returns:
        internal weights from Butcher array (without the first empty row)
      • getB

        public double[] getB()
        Get the external weights for the high order method from Butcher array.
        Returns:
        external weights for the high order method from Butcher array
      • createInterpolator

        protected org.hipparchus.ode.nonstiff.DormandPrince853StateInterpolator createInterpolator​(boolean forward,
                                                                                                   double[][] yDotK,
                                                                                                   ODEStateAndDerivative globalPreviousState,
                                                                                                   ODEStateAndDerivative globalCurrentState,
                                                                                                   EquationsMapper mapper)
        Create an interpolator.
        Specified by:
        createInterpolator in class EmbeddedRungeKuttaIntegrator
        Parameters:
        forward - integration direction indicator
        yDotK - slopes at the intermediate points
        globalPreviousState - start of the global step
        globalCurrentState - end of the global step
        mapper - equations mapper for the all equations
        Returns:
        external weights for the high order method from Butcher array
      • estimateError

        protected double estimateError​(double[][] yDotK,
                                       double[] y0,
                                       double[] y1,
                                       double h)
        Compute the error ratio.
        Specified by:
        estimateError in class EmbeddedRungeKuttaIntegrator
        Parameters:
        yDotK - derivatives computed during the first stages
        y0 - estimate of the step at the start of the step
        y1 - estimate of the step at the end of the step
        h - current step
        Returns:
        error ratio, greater than 1 if step should be rejected