Prev Next Index-> contents reference index search external Up-> CppAD Appendix Theory ForwardTheory tan_forward Appendix-> Faq directory Theory glossary Bib wish_list whats_new deprecated compare_c numeric_ad addon License Theory-> ForwardTheory ReverseTheory reverse_identity ForwardTheory-> exp_forward log_forward sqrt_forward sin_cos_forward atan_forward asin_forward acos_forward tan_forward erf_forward tan_forward Headings-> Derivatives Taylor Coefficients Recursion

Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory

Derivatives
$$\begin{array}{rcl} \tan^{(1)} ( u ) & = & [ \cos (u)^2 + \sin (u)^2 ] / \cos (u)^2 \\ & = & 1 + \tan (u)^2 \\ \tanh^{(1)} ( u ) & = & [ \cosh (u)^2 - \sinh (u)^2 ] / \cosh (u)^2 \\ & = & 1 - \tanh (u)^2 \end{array}$$If $F(u)$ is $\tan (u)$ or $\tanh (u)$ the corresponding derivative is given by $$F^{(1)} (u) = 1 \pm F(u)^2$$ Given $X(t)$, we define the function $Z(t) = F[ X(t) ]$. It follows that $$Z^{(1)} (t) = F^{(1)} [ X(t) ] X^{(1)} (t) = [ 1 \pm Y(t) ] X^{(1)} (t)$$ where we define the function $Y(t) = Z(t)^2$.

Taylor Coefficients Recursion
Suppose that we are given the Taylor coefficients up to order $j$ for the function $X(t)$ and up to order $j-1$ for the functions $Y(t)$ and $Z(t)$. We need a formula that computes the coefficient of order $j$ for $Y(t)$ and $Z(t)$. Using the equation above for $Z^{(1)} (t)$, we have $$\begin{array}{rcl} \sum_{k=1}^j k z^{(k)} t^{k-1} & = & \sum_{k=1}^j k x^{(k)} t^{k-1} \pm \left[ \sum_{k=0}^{j-1} y^{(k)} t^k \right] \left[ \sum_{k=1}^j k x^{(k)} t^{k-1} \right] + o( t^{j-1} ) \end{array}$$ Setting the coefficients of $t^{j-1}$ equal, we have $$\begin{array}{rcl} j z^{(j)} = j x^{(j)} \pm \sum_{k=1}^j k x^{(k)} y^{(j-k)} \\ z^{(j)} = x^{(j)} \pm \frac{1}{j} \sum_{k=1}^j k x^{(k)} y^{(j-k)} \end{array}$$ Once we have computed $z^{(j)}$, we can compute $y^{(j)}$ as follows: $$y^{(j)} = \sum_{k=0}^j z^{(k)} z^{(j-k)}$$
Input File: omh/appendix/theory/tan_forward.omh