$Id: sin_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 SinForward$$
$spell
	sin
	Taylor
$$


$section Sine Function Forward Taylor Polynomial Theory$$
$mindex sin$$

If $latex F(x) = \sin(x) $$
$latex \[
	1 * F^{(1)} (x) - 0 * F (x)  = \cos(x)
\] $$
and in the
$xref/
	ForwardTheory/
	Standard Math Functions/
	Differential Equation/
	standard math function differential equation/
	1
/$$,
$latex A(x) = 0$$,
$latex B(x) = 1$$,
and $latex D(x) = \cos(x)$$.
We use $latex a$$, $latex b$$, $latex d$$, $latex c$$
and $latex z$$ to denote the
Taylor coefficients for
$latex A [ X (t) ] $$,
$latex B [ X (t) ]$$,
$latex D [ X (t) ] $$,
$latex \cos [ X(t) ]$$,
and $latex F [ X(t) ] $$ respectively.
It now follows from the general
$xref/
	ForwardTheory/
	Standard Math Functions/
	Taylor Coefficients Recursion Formula/
	Taylor coefficients recursion formula/
	1
/$$
that for $latex j = 0 , 1, \ldots$$,
$latex \[
\begin{array}{rcl}
z^{(0)} & = & \sin ( x^{(0)} )
\\
e^{(j)}
& = & d^{(j)} + \sum_{k=0}^{j} a^{(j-k)} * z^{(k)}
\\
& = & c^{(j)}
\\
z^{(j+1)} & = & \frac{1}{j+1} \frac{1}{ b^{(0)} }
\left(
	\sum_{k=1}^{j+1} k x^{(k)} e^{(j+1-k)}
	- \sum_{k=1}^j k z^{(k)}  b^{(j+1-k)}
\right)
\\
& = & \frac{1}{j+1}
	\sum_{k=1}^{j+1} k x^{(k)} c^{(j+1-k)}
\end{array}
\] $$
Using $latex s$$ for the Taylor coefficients of $latex \sin[ X(t) ]$$
the order $latex j+1$$ coefficient can be generated using the
lower order coefficients for $latex \sin[ X(t) ]$$ and $latex \cos[ X(t) ]$$
by the following formula:
$latex \[
s^{(j+1)} = \frac{1}{j+1}
	\sum_{k=1}^{j+1} k x^{(k)} c^{(j+1-k)}
\] $$

$end
