<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory</title>
<meta name="description" id="description" content="Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory"/>
<meta name="keywords" id="keywords" content=" tan forward theory "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_tan_forward_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td><a href="acosforward.xml" target="_top">Prev</a>
</td><td><a href="reversetheory.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>CppAD</option>
<option>Appendix</option>
<option>Theory</option>
<option>ForwardTheory</option>
<option>tan_forward</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>Appendix-&gt;</option>
<option>Faq</option>
<option>Theory</option>
<option>glossary</option>
<option>Bib</option>
<option>Bugs</option>
<option>WishList</option>
<option>whats_new</option>
<option>deprecated</option>
<option>compare_c</option>
<option>License</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>Theory-&gt;</option>
<option>ForwardTheory</option>
<option>ReverseTheory</option>
<option>reverse_identity</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>ForwardTheory-&gt;</option>
<option>ExpForward</option>
<option>LogForward</option>
<option>SqrtForward</option>
<option>SinCosForward</option>
<option>AtanForward</option>
<option>AsinForward</option>
<option>AcosForward</option>
<option>tan_forward</option>
</select>
</td>
<td>tan_forward</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Derivatives</option>
<option>Taylor Coefficients Recursion</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>Tangent and Hyperbolic Tangent Forward Taylor Polynomial Theory</big></big></b></center>
<br/>
<b><big><a name="Derivatives" id="Derivatives">Derivatives</a></big></b>


<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<msup><mi>tan</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mo stretchy="false">[</mo>
<mi>cos</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
<mo stretchy="false">+</mo>
<mi>sin</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
<mo stretchy="false">]</mo>
<mo stretchy="false">/</mo>
<mi>cos</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mtd></mtr><mtr><mtd columnalign="right" >
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mn>1</mn>
<mo stretchy="false">+</mo>
<mi>tan</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mtd></mtr><mtr><mtd columnalign="right" >
<msup><mi>tanh</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mo stretchy="false">[</mo>
<mi>cosh</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
<mo stretchy="false">-</mo>
<mi>sinh</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
<mo stretchy="false">]</mo>
<mo stretchy="false">/</mo>
<mi>cosh</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mtd></mtr><mtr><mtd columnalign="right" >
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mn>1</mn>
<mo stretchy="false">-</mo>
<mi>tanh</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mtd></mtr></mtable>
</mrow></math>

If 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 is 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi>tan</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 or 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi>tanh</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
</mrow></math>


the corresponding derivative is given by 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msup><mi mathvariant='italic'>F</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<mn>1</mn>
<mo stretchy="false">&#x000B1;</mo>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>u</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mrow></math>

Given 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

, we define the function 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Z</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">]</mo>
</mrow></math>

.
It follows that

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msup><mi mathvariant='italic'>Z</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<msup><mi mathvariant='italic'>F</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">]</mo>
<msup><mi mathvariant='italic'>X</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<mo stretchy="false">[</mo>
<mn>1</mn>
<mo stretchy="false">&#x000B1;</mo>
<mi mathvariant='italic'>Y</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">]</mo>
<msup><mi mathvariant='italic'>X</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

where we define the function 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Y</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>Z</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<msup><mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mrow></math>

.

<br/>
<br/>
<b><big><a name="Taylor Coefficients Recursion" id="Taylor Coefficients Recursion">Taylor Coefficients Recursion</a></big></b>
<br/>
Suppose that we are given the Taylor coefficients 
up to order 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>j</mi>
</mrow></math>

 for the function 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 and 
up to order 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>j</mi>
<mn>-1</mn>
</mrow></math>

 for the functions 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Y</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 and 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Z</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

.
We need a formula that computes the coefficient of order 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>j</mi>
</mrow></math>


for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Y</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 and 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>Z</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

.
Using the equation above for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>Z</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>

, we have

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<mi mathvariant='italic'>k</mi>
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mi mathvariant='italic'>k</mi>
<mn>-1</mn>
</mrow>
</msup>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<mi mathvariant='italic'>k</mi>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mi mathvariant='italic'>k</mi>
<mn>-1</mn>
</mrow>
</msup>
<mo stretchy="false">&#x000B1;</mo>
<mrow><mo stretchy="true">[</mo><mrow><munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow>
<mrow><mi mathvariant='italic'>j</mi>
<mn>-1</mn>
</mrow>
</munderover>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>t</mi>
<mi mathvariant='italic'>k</mi>
</msup>
</mrow><mo stretchy="true">]</mo></mrow>
<mrow><mo stretchy="true">[</mo><mrow><munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<mi mathvariant='italic'>k</mi>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mi mathvariant='italic'>k</mi>
<mn>-1</mn>
</mrow>
</msup>
</mrow><mo stretchy="true">]</mo></mrow>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>o</mi>
<mo stretchy="false">(</mo>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mi mathvariant='italic'>j</mi>
<mn>-1</mn>
</mrow>
</msup>
<mo stretchy="false">)</mo>
</mtd></mtr></mtable>
</mrow></math>

Setting the coefficients of 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mi mathvariant='italic'>j</mi>
<mn>-1</mn>
</mrow>
</msup>
</mrow></math>

 equal, we have

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>j</mi>
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>j</mi>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">&#x000B1;</mo>
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<mi mathvariant='italic'>k</mi>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mtd></mtr><mtr><mtd columnalign="right" >
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">&#x000B1;</mo>
<mfrac><mrow><mn>1</mn>
</mrow>
<mrow><mi mathvariant='italic'>j</mi>
</mrow>
</mfrac>
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<mi mathvariant='italic'>k</mi>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mtd></mtr></mtable>
</mrow></math>

Once we have computed 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">+</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

,
we can compute 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">+</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

 as follows:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
<munderover><mo displaystyle='true' largeop='true'>&#x02211;</mo>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow>
<mi mathvariant='italic'>j</mi>
</munderover>
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<msup><mi mathvariant='italic'>z</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>


<hr/>Input File: omh/theory/tan_forward.omh

</body>
</html>
