lines 7-55 of file: example/utility/rosen_34.cpp

{xrst_begin rosen_34.cpp}
{xrst_spell
   rclr
}

rosen_34: Example and Test
##########################

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

.. math::

   X_i (t) =  t^{i+1}

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

.. math::

   \begin{array}{rclr}
   X_i(0)     & = & 0                             & {\rm for \; all \;} i \\
   X_i ' (t)  & = & 1                             & {\rm if \;} i = 0      \\
   X_i '(t)   & = & (i+1) t^i = (i+1) X_{i-1} (t) & {\rm if \;} i > 0
   \end{array}

The example tests Rosen34 using the relations above:

Operation Sequence
******************
The :ref:`rosen34-name` method for solving ODE's requires the inversion
of a system of linear equations.
This indices used for pivoting may change with different values
for :math:`t` and :math:`x`.
This example checks the comparison operators.
If some of the comparisons change,
it makes a new recording of the function with the pivots for the current
:math:`t` and :math:`x`.
Note that one could skip this step and always use the same pivot.
This would not be as numerically stable,
but it would still solve the equations
(so long as none of the pivot elements are zero).

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

{xrst_end rosen_34.cpp}
