$Id: atan_forward.omh 3757 2015-11-30 12:03:07Z bradbell $
// BEGIN SHORT COPYRIGHT
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 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 atan_forward$$
$spell
	atan
	atanh
	Taylor
$$

$section Inverse Tangent and Hyperbolic Tangent Forward Mode Theory$$
$mindex atan atanh$$

$head Derivatives$$
$latex \[
\begin{array}{rcl}
\R{atan}^{(1)} (x)  & = & 1 / ( 1 + x * x )
\\
\R{atanh}^{(1)} (x) & = & 1 / ( 1 - x * x )
\end{array}
\] $$
If $latex F(x)$$ is $latex \R{atan} (x)$$ or $latex \R{atanh} (x)$$,
the corresponding derivative satisfies the equation
$latex \[
	(1 \pm x * x ) * F^{(1)} (x) - 0 * F (x)  = 1
\] $$
and in the
$cref/standard math function differential equation
	/ForwardTheory
	/Standard Math Functions
	/Differential Equation
/$$,
$latex A(x) = 0$$,
$latex B(x) = 1 \pm x * x $$,
and $latex D(x) = 1$$.
We use $latex a$$, $latex b$$, $latex d$$ and $latex z$$ to denote the
Taylor coefficients for
$latex A [ X (t) ] $$,
$latex B [ X (t) ]$$,
$latex D [ X (t) ] $$,
and $latex F [ X(t) ] $$ respectively.

$head Taylor Coefficients Recursion$$
For $latex j = 0 , 1, \ldots$$,
$latex \[
\begin{array}{rcl}
z^{(0)} & = & F( x^{(0)} )
\\
b^{(j)}
& = &  \left\{ \begin{array}{ll}
	1 \pm x^{(0)} * x^{(0)}            & {\rm if} \; j = 0 \\
	\pm \sum_{k=0}^j x^{(k)} x^{(j-k)} & {\rm otherwise}
\end{array} \right.
\\
e^{(j)}
& = & d^{(j)} + \sum_{k=0}^{j} a^{(j-k)} * z^{(k)}
\\
& = & \left\{ \begin{array}{ll}
	1 & {\rm if} \; j = 0 \\
	0 & {\rm otherwise}
\end{array} \right.
\\
z^{(j+1)} & = & \frac{1}{j+1} \frac{1}{ b^{(0)} }
\left(
	\sum_{k=0}^j e^{(k)} (j+1-k) x^{(j+1-k)}
	- \sum_{k=1}^j b^{(k)} (j+1-k) z^{(j+1-k)}
\right)
\\
z^{(j+1)} & = & \frac{1}{j+1} \frac{1}{ b^{(0)} }
\left(
	(j+1) x^{(j+1)}
	- \sum_{k=1}^j k z^{(k)}  b^{(j+1-k)}
\right)
\end{array}
\] $$

$end
