$Id: cos_forward.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 Eclipse Public License Version 1.0. 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 CosForward$$ $spell cos Taylor $$ $index cos, forward theory$$ $index theory, cos forward$$ $index forward, cos theory$$ $section Cosine Function Forward Taylor Polynomial Theory$$ If $latex F(x) = \cos(x) $$ $latex \[ 1 * F^{(1)} (x) - 0 * F (x) = - \sin(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) = - \sin(x)$$. We use $latex a$$, $latex b$$, $latex d$$, $latex s$$ and $latex z$$ to denote the Taylor coefficients for $latex A [ X (t) ] $$, $latex B [ X (t) ]$$, $latex D [ X (t) ] $$, $latex \sin [ 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)} & = & \cos ( x^{(0)} ) \\ e^{(j)} & = & d^{(j)} + \sum_{k=0}^{j} a^{(j-k)} * z^{(k)} \\ & = & -s^{(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)} s^{(j+1-k)} \end{array} \] $$ Using $latex c$$ for the Taylor coefficients of $latex \cos[ 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 \[ c^{(j+1)} = - \frac{1}{j+1} \sum_{k=1}^{j+1} k x^{(k)} s^{(j+1-k)} \] $$ $end