lines 7-49 of file: example/utility/runge_45.cpp

{xrst_begin runge_45.cpp}

Runge45: Example and Test
#########################

Define
:math:`X : \B{R} \times \B{R} \rightarrow \B{R}^n` by

.. math::

   X_j (b, t) =  b \left( \sum_{k=0}^j t^k / k ! \right)

for :math:`j = 0 , \ldots , n-1`.
It follows that

.. math::
   :nowrap:

   \begin{eqnarray}
   X_j  (b, 0)   & = & b                                                     \\
   \partial_t X_j (b, t)   & = & b \left( \sum_{k=0}^{j-1} t^k / k ! \right) \\
   \partial_t X_j (b, t)   & = & \left\{ \begin{array}{ll}
      0               & {\rm if} \; j = 0  \\
      X_{j-1} (b, t)  & {\rm otherwise}
   \end{array} \right.
   \end{eqnarray}

For a fixed :math:`t_f`,
we can use :ref:`Runge45-name` to define
:math:`f : \B{R} \rightarrow \B{R}^n` as an approximation for
:math:`f(b) = X(b, t_f )`.
We can then compute :math:`f^{(1)} (b)` which is an approximation for

.. math::

   \partial_b X(b, t_f ) =  \sum_{k=0}^j t_f^k / k !

{xrst_literal
   // BEGIN C++
   // END C++
}

{xrst_end runge_45.cpp}
