| Home | Libraries | People | FAQ | More

## Class template runge_kutta_cash_karp54_classic

boost::numeric::odeint::runge_kutta_cash_karp54_classic — The Runge-Kutta Cash-Karp method implemented without the generic Runge-Kutta algorithm.

## Synopsis

    // In header: <boost/numeric/odeint/stepper/runge_kutta_cash_karp54_classic.hpp>

    template<typename State, typename Value = double, typename Deriv = State,
             typename Time = Value,
             typename Algebra = typename algebra_dispatcher< State >::algebra_type,
             typename Operations = typename operations_dispatcher< State >::operations_type,
             typename Resizer = initially_resizer>
    class runge_kutta_cash_karp54_classic : public explicit_error_stepper_base {
    public:
      // types
      typedef explicit_error_stepper_base< runge_kutta_cash_karp54_classic< ... >,... > stepper_base_type;
      typedef stepper_base_type::state_type                                             state_type;
      typedef stepper_base_type::value_type                                             value_type;
      typedef stepper_base_type::deriv_type                                             deriv_type;
      typedef stepper_base_type::time_type                                              time_type;
      typedef stepper_base_type::algebra_type                                           algebra_type;
      typedef stepper_base_type::operations_type                                        operations_type;
      typedef stepper_base_type::resizer_type                                           resizer_type;

      // construct/copy/destruct
      runge_kutta_cash_karp54_classic(const algebra_type & = algebra_type());

      // public member functions
      template<typename System, typename StateIn, typename DerivIn,
               typename StateOut, typename Err>
        void do_step_impl(System, const StateIn &, const DerivIn &, time_type,
                          StateOut &, time_type, Err &);
      template<typename System, typename StateIn, typename DerivIn,
               typename StateOut>
        void do_step_impl(System, const StateIn &, const DerivIn &, time_type,
                          StateOut &, time_type);
      template<typename StateIn> void adjust_size(const StateIn &);

      // private member functions
      template<typename StateIn> bool resize_impl(const StateIn &);
    };

## Description

The Runge-Kutta Cash-Karp method is one of the standard methods for solving ordinary differential equations, see en.wikipedia.org/wiki/Cash-Karp_method. The method is explicit and fulfills the Error Stepper concept. Step size control is provided but continuous output is not available for this method.

This class derives from explicit_error_stepper_base and inherits its interface via CRTP (current recurring template pattern). This class implements the method directly, hence the generic Runge-Kutta algorithm is not used.

### Template Parameters

1.     typename State

   The state type.

2.     typename Value = double

   The value type.

3.     typename Deriv = State

   The type representing the time derivative of the state.

4.     typename Time = Value

   The time representing the independent variable - the time.

5.     typename Algebra = typename algebra_dispatcher< State >::algebra_type

   The algebra type.

6.     typename Operations = typename operations_dispatcher< State >::operations_type

   The operations type.

7.     typename Resizer = initially_resizer

   The resizer policy type.

### `runge_kutta_cash_karp54_classic` public construct/copy/destruct

1.     runge_kutta_cash_karp54_classic(const algebra_type & algebra = algebra_type());

   Constructs the `runge_kutta_cash_karp54_classic` class. This constructor can be used as a default constructor if the algebra has a default constructor.

   Parameters:

   `algebra` | A copy of algebra is made and stored inside explicit_stepper_base.

### `runge_kutta_cash_karp54_classic` public member functions

1.     template<typename System, typename StateIn, typename DerivIn,
                typename StateOut, typename Err>
         void do_step_impl(System system, const StateIn & in, const DerivIn & dxdt,
                           time_type t, StateOut & out, time_type dt, Err & xerr);

2.     template<typename System, typename StateIn, typename DerivIn,
                typename StateOut>
         void do_step_impl(System system, const StateIn & in, const DerivIn & dxdt,
                           time_type t, StateOut & out, time_type dt);

3.     template<typename StateIn> void adjust_size(const StateIn & x);

   Adjust the size of all temporaries in the stepper manually.

   Parameters:

   `x` | A state from which the size of the temporaries to be resized is deduced.

### `runge_kutta_cash_karp54_classic` private member functions

1.     template<typename StateIn> bool resize_impl(const StateIn & x);