Codebase list cppad / upstream/2014.00.00.1 omh / atan_reverse.omh
upstream/2014.00.00.1

Tree @upstream/2014.00.00.1 (Download .tar.gz)

atan_reverse.omh @upstream/2014.00.00.1raw · history · blame

$Id: atan_reverse.omh 2506 2012-10-24 19:36:49Z bradbell $
// BEGIN SHORT COPYRIGHT
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-06 Bradley M. Bell

CppAD is distributed under multiple licenses. This distribution is under
the terms of the 
                    GNU General Public License Version 3.

A copy of this license is included in the COPYING file of this distribution.
Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
-------------------------------------------------------------------------- */
// END SHORT COPYRIGHT

$begin AtanReverse$$
$spell
	Arctangent
	atan
	Taylor
$$

$index atan, reverse theory$$
$index theory, atan reverse$$
$index reverse, atan theory$$

$section Arctangent Function Reverse Mode Theory$$


We use the reverse theory
$xref%
	ReverseTheory%
	Standard Math Functions%
	standard math function
%$$
definition for the functions $latex H$$ and $latex G$$.
In addition, 

we use $latex b$$ 
for the $th p$$ order Taylor coefficient 
row vectors corresponding to 
$latex 1 + X(t) * X(t)$$ 
and replace $latex z^{(j)}$$ by
$latex \[
	( z^{(j)} , b^{(j)} )
\] $$ 
in the definition for $latex G$$ and $latex H$$.
The forward mode formulas for the
$cref/arctangent/AtanForward/$$ 
function are
$latex \[
\begin{array}{rcl}
	z^{(j)}  & = & \arctan ( x^{(0)} ) \\
	b^{(j)}  & = & 1 + x^{(0)} x^{(0)}
\end{array}
\] $$

for the case $latex j = 0$$, and for $latex j > 0$$,

$latex \[
\begin{array}{rcl}
b^{(j)} & = &  
	\sum_{k=0}^j x^{(k)} x^{(j-k)} 
\\
z^{(j)} & = & \frac{1}{j} \frac{1}{ b^{(0)} } 
\left(
	j x^{(j)}
	- \sum_{k=1}^{j-1} k z^{(k)}  b^{(j-k)} 
\right)
\end{array}
\] $$ 

If $latex j = 0$$, we have the relation

$latex \[
\begin{array}{rcl}
\D{H}{ x^{(j)} } & = & 
\D{G}{ x^{(j)} }  
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(0)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ x^{(0)} }
\\
& = &
\D{G}{ x^{(j)} }  
+ \D{G}{ z^{(j)} } \frac{1}{ b^{(0)} }
+ \D{G}{ b^{(j)} } 2 x^{(0)}
\end{array}
\] $$ 

If $latex j > 0$$, then for $latex k = 1, \ldots , j-1$$

$latex \[
\begin{array}{rcl}
\D{H}{ b^{(0)} } & = & 
\D{G}{ b^{(0)} } 
- \D{G}{ z^{(j)} } \D{ z^{(j)} }{ b^{(0)} }
\\
& = &
\D{G}{ b^{(0)} } 
- \D{G}{ z^{(j)} } \frac{ z^{(j)} }{ b^{(0)} } 
\\
\D{H}{ x^{(j)} } & = & 
\D{G}{ x^{(j)} } 
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(j)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ x^{(j)} }
\\
& = &
\D{G}{ x^{(j)} } 
+ \D{G}{ z^{(j)} } \frac{1}{ b^{(0)} }
+ \D{G}{ b^{(j)} } 2 x^{(0)}
\\
\D{H}{ x^{(0)} } & = & 
\D{G}{ x^{(0)} } 
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(0)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ x^{(0)} }
\\
& = & 
\D{G}{ x^{(0)} } + 
\D{G}{ b^{(j)} } 2 x^{(j)}
\\
\D{H}{ x^{(k)} } & = & 
\D{G}{ x^{(k)} } 
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(k)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ x^{(k)} }
\\
& = & 
\D{G}{ x^{(k)} } 
+ \D{G}{ b^{(j)} } 2 x^{(j-k)}
\\
\D{H}{ z^{(k)} } & = & 
\D{G}{ z^{(k)} } 
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ z^{(k)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ z^{(k)} }
\\
& = & 
\D{G}{ z^{(k)} } 
- \D{G}{ z^{(j)} } \frac{k b^{(j-k)} }{ j b^{(0)} }
\\
\D{H}{ b^{(j-k)} } & = & 
\D{G}{ b^{(j-k)} } 
+ \D{G}{ z^{(j)} } \D{ z^{(j)} }{ b^{(j-k)} }
+ \D{G}{ b^{(j)} } \D{ b^{(j)} }{ b^{(j-k)} }
\\
& = & 
\D{G}{ b^{(j-k)} } 
- \D{G}{ z^{(j)} } \frac{k z^{(k)} }{ j b^{(0)} } 
\end{array}
\] $$ 

$end