lines 8-88 of file: include/cppad/example/atomic_four/lin_ode/forward.hpp

{xrst_begin atomic_four_lin_ode_forward.hpp}

Atomic Linear ODE Forward Mode: Example Implementation
######################################################

Purpose
*******
The ``forward`` routine overrides the virtual functions
used by the atomic_four base; see
:ref:`forward<atomic_four_forward-name>` .

Theory
******
Suppose we are given Taylor coefficients
:math:`x^0`, :math:`x^1`, for
:ref:`atomic_four_lin_ode@x` .
The zero order Taylor coefficient for
:ref:`atomic_four_lin_ode@z(t, x)` solves
the following initial value ODE:

.. math::

   z_t^0 (t) = A^0 z(t) \W{,} z^0 (0) = b^0

Note that :math:`A^0` and :math:`b^0`
are just certain components of :math:`x^0`; see
:ref:`atomic_four_lin_ode@x@A(x)` and
:ref:`atomic_four_lin_ode@x@b(x)` .
The first order Taylor coefficient for :math:`z(t, x)` solves
the following initial value ODE:

.. math::

   z_t^1 (t)
   =
   A^0 z^1 (t) + A^1 z^0 (t) \W{,} z^1 (0) = b^1

Note that :math:`A^1` and :math:`c^1`
are just certain components of :math:`x^1`.
We can solve for :math:`z^1 (t)` using the following extended
initial value ODE:

.. math::

   \left[ \begin{array}{c}
   z^0_t (t, x) \\
   z^1_t (t, x)
   \end{array} \right]
   =
   \left[ \begin{array}{cc}
   A^0 & 0   \\
   A^1 & A^0
   \end{array} \right]
   \left[ \begin{array}{c}
   z^0 (t, x) \\
   z^1 (t, x)
   \end{array} \right]
   \; , \;
   \left[ \begin{array}{c}
   z^0 (0, x) \\
   z^1 (0, x)
   \end{array} \right]
   =
   \left[ \begin{array}{c}
   b^0 \\
   b^1
   \end{array} \right]

extend_ode
**********
The extended system above is created form the original system by the
``extend_ode`` function defined below:

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

{xrst_end atomic_four_lin_ode_forward.hpp}
