Prev
Next
Index->
contents
reference
index
search
external
Up->
CppAD
AD
ADValued
atomic
atomic_four
atomic_four_example
atomic_four_lin_ode
atomic_four_lin_ode_implement
atomic_four_lin_ode_reverse.hpp
atomic_four_lin_ode_reverse_2
atomic_four_lin_ode_reverse_2
Headings->
x^1 Partial
x^0 Partial
@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
This is cppad-20221105 documentation
. Here is a link to its
current documentation
.
Atomic Linear ODE Second Order Reverse
x^1 Partial
We need to compute
@[@ \R{partial\_x} [ j * q + 1 ] = \sum_{i=0}^{m-1} \R{partial\_y} [ i * q + 1] ( \partial y_i^1 ( x^0 , x^1 ) / \partial x_j^1 ) @]@
where
@(@ q = 2 @)@
and
@(@ j = 0 , \ldots , n-1 @)@
. Using the
reverse_identity
we have
@[@ \partial y_i^1 ( x^0 , x^1 ) / \partial x_j^1 = \partial y_i^0 ( x^0 ) / \partial x_j^0 @]@
@[@ \R{partial\_x} [ j * q + 1 ] = \sum_{i=0}^{m-1} \R{partial\_y} [ i * q + 1] ( \partial y_i^0 ( x^0 ) / \partial x_j^0 ) @]@
which is the same as the first order
theory
with
@[@ w_i = \R{partial\_y} [ i * q + 1] @]@
x^0 Partial
We also need to compute
@[@ \R{partial\_x} [ j * q + 0 ] = \sum_{i=0}^{m-1} \R{partial\_y} [ i * q + 0] ( \partial y_i^0 ( x^0 ) / \partial x_j^0 ) + \R{partial\_y} [ i * q + 1] ( \partial y_i^1 ( x^0 , x^1 ) / \partial x_j^0 ) @]@
Note that we can solve for
@[@ y^1 ( x^0 , x^1 ) = z^1 ( r , x^0 , x^1 ) @]@
using the following extended ODE; see
forward theory
.
@[@ \left[ \begin{array}{c} z^0_t (t, x^0 ) \\ z^1_t (t, x^0 , x^1 ) \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^0 ) \\ z^1 (t, x^0 , x^1 ) \end{array} \right] \; , \; \left[ \begin{array}{c} z^0 (0, x^0 ) \\ z^1 (0, x^0 , x^1 ) \end{array} \right] = \left[ \begin{array}{c} b^0 \\ b^1 \end{array} \right] @]@
Note that
@(@ A^0 @)@
,
@(@ b^0 @)@
are components of
@(@ x^0 @)@
and
@(@ A^1 @)@
,
@(@ b^1 @)@
are components of
@(@ x^1 @)@
. We use the following notation
@[@ \bar{x} = \left[ \begin{array}{c} x^0 \\ x^1 \end{array} \right] \W{,} \bar{z}(t , \bar{x} ) = \left[ \begin{array}{c} z^0 (t, x^0) \\ z^1 ( t, x^0 , x^1 ) \end{array} \right] \W{,} \bar{A} = \left[ \begin{array}{cc} A^0 & 0 \\ A^1 & A^0 \end{array} \right] \W{,} \bar{b} = \left[ \begin{array}{c} b^0 \\ b^1 \end{array} \right] @]@
Using this notation we have
@[@ \bar{z}_t ( t , \bar{x} ) = \bar{A} \bar{z} (t, \bar{x} ) \W{,} \bar{z} (0, \bar{x} ) = \bar{b} @]@
Define
@(@ \bar{w} \in \B{R}^{m + m} @)@
by
@[@ \bar{w}_i = \R{partial\_y}[ i * q + 0 ] \W{,} \bar{w}_{m + i} = \R{partial\_y}[ i * q + 1 ] @]@
For this case, we can compute
@[@ \partial_\bar{x} \bar{w}^\R{T} \bar{z}(r, \bar{x} ) @]@
which is same as the first order case but with the extended variables and extended ODE. We will only use the components of
@(@ \partial_\bar{x} @)@
that correspond to partials w.r.t.
@(@ x^0 @)@
.
Input File: include/cppad/example/atomic_four/lin_ode/reverse_2.omh