1/* -------------------------------------------------------------------------- 2CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-18 Bradley M. Bell 3 4 CppAD is distributed under the terms of the 5 Eclipse Public License Version 2.0. 6 7 This Source Code may also be made available under the following 8 Secondary License when the conditions for such availability set forth 9 in the Eclipse Public License, Version 2.0 are satisfied: 10 GNU General Public License, Version 2.0 or later. 11-------------------------------------------------------------------------- */ 12 13$begin sin_cos_forward$$ 14$spell 15 sin 16 cos 17 sinh 18 cosh 19 Taylor 20$$ 21 22 23$section Trigonometric and Hyperbolic Sine and Cosine Forward Theory$$ 24 25$head Differential Equation$$ 26The 27$cref/standard math function differential equation 28 /ForwardTheory 29 /Standard Math Functions 30 /Differential Equation 31/$$ 32is 33$latex \[ 34 B(u) * F^{(1)} (u) - A(u) * F (u) = D(u) 35\] $$ 36In this sections we consider forward mode for the following choices: 37 38$table 39$pre $$ 40 $cnext $cnext $latex F(u)$$ 41 $cnext $cnext $latex \sin(u)$$ 42 $cnext $cnext $latex \cos(u)$$ 43 $cnext $cnext $latex \sinh(u)$$ 44 $cnext $cnext $latex \cosh(u)$$ 45$rnext 46 $cnext $cnext $latex A(u)$$ 47 $cnext $cnext $latex 0$$ 48 $cnext $cnext $latex 0$$ 49 $cnext $cnext $latex 0$$ 50 $cnext $cnext $latex 0$$ 51$rnext 52 $cnext $cnext $latex B(u)$$ 53 $cnext $cnext $latex 1$$ 54 $cnext $cnext $latex 1$$ 55 $cnext $cnext $latex 1$$ 56 $cnext $cnext $latex 1$$ 57$rnext 58 $cnext $cnext $latex D(u)$$ 59 $cnext $cnext $latex \cos(u)$$ 60 $cnext $cnext $latex - \sin(u)$$ 61 $cnext $cnext $latex \cosh(u)$$ 62 $cnext $cnext $latex \sinh(u)$$ 63$tend 64 65We use $latex a$$, $latex b$$, $latex d$$ and $latex f$$ for the 66Taylor coefficients of 67$latex A [ X (t) ]$$, 68$latex B [ X (t) ]$$, 69$latex D [ X (t) ] $$, 70and $latex F [ X(t) ] $$ respectively. 71It now follows from the general 72$xref/ 73 ForwardTheory/ 74 Standard Math Functions/ 75 Taylor Coefficients Recursion Formula/ 76 Taylor coefficients recursion formula/ 77 1 78/$$ 79that for $latex j = 0 , 1, \ldots$$, 80$latex \[ 81\begin{array}{rcl} 82f^{(0)} & = & D ( x^{(0)} ) 83\\ 84e^{(j)} 85& = & d^{(j)} + \sum_{k=0}^{j} a^{(j-k)} * f^{(k)} 86\\ 87& = & d^{(j)} 88\\ 89f^{(j+1)} & = & \frac{1}{j+1} \frac{1}{ b^{(0)} } 90\left( 91 \sum_{k=1}^{j+1} k x^{(k)} e^{(j+1-k)} 92 - \sum_{k=1}^j k f^{(k)} b^{(j+1-k)} 93\right) 94\\ 95& = & \frac{1}{j+1} 96 \sum_{k=1}^{j+1} k x^{(k)} d^{(j+1-k)} 97\end{array} 98\] $$ 99The formula above generates the 100order $latex j+1$$ coefficient of $latex F[ X(t) ]$$ from the 101lower order coefficients for $latex X(t)$$ and $latex D[ X(t) ]$$. 102 103$end 104