<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Multiple Order Forward Mode</title>
<meta name="description" id="description" content="Multiple Order Forward Mode"/>
<meta name="keywords" id="keywords" content=" forward mode order any multiple "/>
<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='_forward_order_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="forward_two.xml" target="_top">Prev</a>
</td><td><a href="forward.cpp.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>ADFun</option>
<option>FunEval</option>
<option>Forward</option>
<option>forward_order</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>ADFun-&gt;</option>
<option>Independent</option>
<option>FunConstruct</option>
<option>Dependent</option>
<option>abort_recording</option>
<option>seq_property</option>
<option>FunEval</option>
<option>Drivers</option>
<option>FunCheck</option>
<option>optimize</option>
<option>check_for_nan</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>FunEval-&gt;</option>
<option>Forward</option>
<option>Reverse</option>
<option>Sparse</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>Forward-&gt;</option>
<option>forward_zero</option>
<option>forward_one</option>
<option>forward_two</option>
<option>forward_order</option>
<option>size_order</option>
<option>CompareChange</option>
<option>capacity_order</option>
<option>number_skip</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>forward_order-&gt;</option>
<option>forward.cpp</option>
<option>forward_order.cpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>---..Function Values</option>
<option>---..Derivative Values</option>
<option>Notation</option>
<option>---..n</option>
<option>---..m</option>
<option>f</option>
<option>One Order</option>
<option>q</option>
<option>xq</option>
<option>---..One Order</option>
<option>---..Multiple Orders</option>
<option>---..Restrictions</option>
<option>s</option>
<option>X(t)</option>
<option>Y(t)</option>
<option>yq</option>
<option>---..One Order</option>
<option>---..Multiple Orders</option>
<option>Vector</option>
<option>Zero Order</option>
<option>First Order</option>
<option>Second Order</option>
<option>Example</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>Multiple Order Forward Mode</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.Forward(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;)<br/>
</span></font></code>

<code><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.Forward(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>s</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
</span></font></code>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
We use 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">:</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>n</mi>
</msup>
<mo stretchy="false">&#x02192;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>

 to denote the
<a href="glossary.xml#AD Function" target="_top"><span style='white-space: nowrap'>AD&#xA0;function</span></a>
 corresponding to 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
.
Given a 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'>B</mi>
<mo stretchy="false">&#x02192;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>

,
defined by its 
<a href="glossary.xml#Taylor Coefficient" target="_top"><span style='white-space: nowrap'>Taylor&#xA0;coefficients</span></a>
,
forward mode computes the Taylor coefficients for the function 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><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'>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>

<br/>
<b><a name="Purpose.Function Values" id="Purpose.Function Values">Function Values</a></b>
<br/>
If you are using forward mode to compute values for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
</mrow></math>

,
<a href="forward_zero.xml" target="_top"><span style='white-space: nowrap'>forward_zero</span></a>
 is simpler to understand
than this explanation of the general case.

<br/>
<br/>
<b><a name="Purpose.Derivative Values" id="Purpose.Derivative Values">Derivative Values</a></b>
<br/>
If you are using forward mode to compute values for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><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'>x</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">*</mo>
<mi mathvariant='italic'>dx</mi>
</mrow></math>

,
<a href="forward_one.xml" target="_top"><span style='white-space: nowrap'>forward_one</span></a>
 is simpler to understand
than this explanation of the general case.

<br/>
<br/>
<b><big><a name="Notation" id="Notation">Notation</a></big></b>


<br/>
<br/>
<b><a name="Notation.n" id="Notation.n">n</a></b>
<br/>
We use 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
 to denote the dimension of the
<a href="seq_property.xml#Domain" target="_top"><span style='white-space: nowrap'>domain</span></a>
 space for 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
.

<br/>
<br/>
<b><a name="Notation.m" id="Notation.m">m</a></b>
<br/>
We use 
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
 to denote the dimension of the
<a href="seq_property.xml#Range" target="_top"><span style='white-space: nowrap'>range</span></a>
 space for 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
.


<br/>
<br/>
<b><big><a name="f" id="f">f</a></big></b>
<br/>
The <a href="adfun.xml" target="_top"><span style='white-space: nowrap'>ADFun</span></a>
 object 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;ADFun&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
Note that the <a href="adfun.xml" target="_top"><span style='white-space: nowrap'>ADFun</span></a>
 object 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
 is not <code><font color="blue">const</font></code>.
After this call we will have

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.size_order()&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;+&#xA0;1<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.size_direction()&#xA0;==&#xA0;1<br/>
</span></font></code>
<br/>
<b><big><a name="One Order" id="One Order">One Order</a></big></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
then we are only computing one order.
In this case, before this call we must have

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.size_order()&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&gt;=&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.size_direction()&#xA0;==&#xA0;1<br/>
</span></font></code>
<br/>
<b><big><a name="q" id="q">q</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>q</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and specifies the highest order of the Taylor coefficients to be calculated.

<br/>
<br/>
<b><big><a name="xq" id="xq">xq</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'>&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
(see <a href="forward_order.xml#Vector" target="_top"><span style='white-space: nowrap'>Vector</span></a>
 below).
As above, we use 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
 to denote the dimension of the
<a href="seq_property.xml#Domain" target="_top"><span style='white-space: nowrap'>domain</span></a>
 space for 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
.
The size of 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i></code>
 must be either 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
 or 

<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i><font color="blue"><span style='white-space: nowrap'>*(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>+1)</span></font></code>
.
After this call we will have

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.size_order()&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;+&#xA0;1<br/>
</span></font></code>
<br/>
<b><a name="xq.One Order" id="xq.One Order">One Order</a></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
the <i>q</i>-th order Taylor coefficient for 
<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>

 
is defined by
<code><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></code> 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
</mrow></math>

 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i></code>
.
For 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>q</mi>
<mn>-1</mn>
</mrow></math>

,
the Taylor coefficient 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

 
is defined by 
<code><i><font color="black"><span style='white-space: nowrap'>xk</span></font></i></code>
 in the previous call to

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>f</span></font></i><font color="blue"><span style='white-space: nowrap'>.Forward(</span></font><i><font color="black"><span style='white-space: nowrap'>k</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>xk</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
</span></font></code>
<br/>
<b><a name="xq.Multiple Orders" id="xq.Multiple Orders">Multiple Orders</a></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i><font color="blue"><span style='white-space: nowrap'>*(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>+1)</span></font></code>
,
For 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>q</mi>
</mrow></math>

,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>n</mi>
<mn>-1</mn>
</mrow></math>

,
the <i>j</i>-th component of the <i>k</i>-th order Taylor coefficient 
for 
<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>

 is defined by
<code><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></code> 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msubsup><mi mathvariant='italic'>x</mi>
<mi mathvariant='italic'>j</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msubsup>
<mo stretchy="false">=</mo>
</mrow></math>

 
<code><i><font color="black"></font></i><font color="blue"><span style='white-space: nowrap'>xq</span></font><i><font color="black"><span style='white-space: nowrap'>[&#xA0;(</span></font></i><font color="blue"><span style='white-space: nowrap'>q</span></font><i><font color="black"><span style='white-space: nowrap'>+1)&#xA0;*&#xA0;</span></font></i><font color="blue"><span style='white-space: nowrap'>j</span></font><i><font color="black"><span style='white-space: nowrap'>&#xA0;+&#xA0;</span></font></i><font color="blue"><span style='white-space: nowrap'>k</span></font><i><font color="black"><span style='white-space: nowrap'>&#xA0;]</span></font></i></code>


<br/>
<br/>
<b><a name="xq.Restrictions" id="xq.Restrictions">Restrictions</a></b>
<br/>
Note if 
<code><i><font color="black"><span style='white-space: nowrap'>f</span></font></i></code>
 uses <a href="old_atomic.xml" target="_top"><span style='white-space: nowrap'>old_atomic</span></a>
 functions,
the size of 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i></code>
 must be 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.

<br/>
<br/>
<b><big><a name="s" id="s">s</a></big></b>
<br/>
If the argument 
<code><i><font color="black"><span style='white-space: nowrap'>s</span></font></i></code>
 is not present, <code><font color="blue">std::cout</font></code>
is used in its place.
Otherwise, this argument has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;std::ostream&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>s</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
If order zero is begin calculated,

<code><i><font color="black"><span style='white-space: nowrap'>s</span></font></i></code>
 specifies where the output corresponding to <a href="printfor.xml" target="_top"><span style='white-space: nowrap'>PrintFor</span></a>

will be written.
If order zero is not being calculated,

<code><i><font color="black"><span style='white-space: nowrap'>s</span></font></i></code>
 is not used

<br/>
<br/>
<b><big><a name="X(t)" id="X(t)">X(t)</a></big></b>
<br/>
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'>B</mi>
<mo stretchy="false">&#x02192;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>

 is defined using
the Taylor coefficients 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">&#x02208;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>

:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<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>0</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mn>0</mn>
</msup>
<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>
<msup><mi mathvariant='italic'>t</mi>
<mn>1</mn>
</msup>
<mo stretchy="false">+</mo>
<mo stretchy="false">&#x022EF;</mo>
<mo stretchy="false">+</mo>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mi mathvariant='italic'>q</mi>
</msup>
</mrow></math>

Note that for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>q</mi>
</mrow></math>

,
the <i>k</i>-th derivative of 
<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>

 is related to the 
Taylor coefficients by the equation

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msup><mi mathvariant='italic'>x</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
<mfrac><mrow><mn>1</mn>
</mrow>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">!</mo>
</mrow>
</mfrac>
<msup><mi mathvariant='italic'>X</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mn>0</mn>
<mo stretchy="false">)</mo>
</mrow></math>

<br/>
<b><big><a name="Y(t)" id="Y(t)">Y(t)</a></big></b>
<br/>
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'>B</mi>
<mo stretchy="false">&#x02192;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>

 is defined by

<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'>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>

.
We use 
<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'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">&#x02208;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>

 
to denote the <i>k</i>-th order Taylor coefficient of 
<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>

; i.e.,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<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'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mn>0</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mn>0</mn>
</msup>
<mo stretchy="false">+</mo>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mn>1</mn>
</msup>
<mo stretchy="false">+</mo>
<mo stretchy="false">&#x022EF;</mo>
<mo stretchy="false">+</mo>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mi mathvariant='italic'>q</mi>
</msup>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>o</mi>
<mo stretchy="false">(</mo>
<msup><mi mathvariant='italic'>t</mi>
<mi mathvariant='italic'>q</mi>
</msup>
<mo stretchy="false">)</mo>
</mrow></math>

where 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>o</mi>
<mo stretchy="false">(</mo>
<msup><mi mathvariant='italic'>t</mi>
<mi mathvariant='italic'>q</mi>
</msup>
<mo stretchy="false">)</mo>
<mo stretchy="false">*</mo>
<msup><mi mathvariant='italic'>t</mi>
<mrow><mo stretchy="false">-</mo>
<mi mathvariant='italic'>q</mi>
</mrow>
</msup>
<mo stretchy="false">&#x02192;</mo>
<mn>0</mn>
</mrow></math>

 as 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">&#x02192;</mo>
<mn>0</mn>
</mrow></math>

.
Note that 
<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'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

 is related to 
the <i>k</i>-th derivative of 
<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>

 by the equation

<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'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">=</mo>
<mfrac><mrow><mn>1</mn>
</mrow>
<mrow><mi mathvariant='italic'>k</mi>
<mo stretchy="false">!</mo>
</mrow>
</mfrac>
<msup><mi mathvariant='italic'>Y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mn>0</mn>
<mo stretchy="false">)</mo>
</mrow></math>

<br/>
<b><big><a name="yq" id="yq">yq</a></big></b>
<br/>
The return value 
<code><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
(see <a href="forward_order.xml#Vector" target="_top"><span style='white-space: nowrap'>Vector</span></a>
 below).

<br/>
<br/>
<b><a name="yq.One Order" id="yq.One Order">One Order</a></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
the vector 
<code><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i></code>
 has size 
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
.
The <i>q</i>-th order Taylor coefficient 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>

 
is returned as 

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i></code>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mo stretchy="false">=</mo>
<msup><mi mathvariant='italic'>y</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

.

<br/>
<br/>
<b><a name="yq.Multiple Orders" id="yq.Multiple Orders">Multiple Orders</a></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i><font color="blue"><span style='white-space: nowrap'>*(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>+1)</span></font></code>
,
the vector 
<code><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i></code>
 has size 
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i><font color="blue"><span style='white-space: nowrap'>*(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>+1)</span></font></code>
.
For 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>q</mi>
</mrow></math>

,
for 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
<mo stretchy="false">,</mo>
<mo stretchy="false">&#x02026;</mo>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>m</mi>
<mn>-1</mn>
</mrow></math>

,
the <i>i</i>-th component of the <i>k</i>-th order Taylor coefficient 
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>

 is returned as

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>yq</span></font></i><font color="blue"><span style='white-space: nowrap'>[&#xA0;(</span></font><i><font color="black"><span style='white-space: nowrap'>q</span></font></i><font color="blue"><span style='white-space: nowrap'>+1)&#xA0;*&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>i</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;+&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>k</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;]</span></font></code>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mo stretchy="false">=</mo>
<msubsup><mi mathvariant='italic'>y</mi>
<mi mathvariant='italic'>i</mi>
<mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>k</mi>
<mo stretchy="false">)</mo>
</mrow>
</msubsup>
</mrow></math>

 

<br/>
<br/>
<b><big><a name="Vector" id="Vector">Vector</a></big></b>
<br/>
The type 
<code><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i></code>
 must be a <a href="simplevector.xml" target="_top"><span style='white-space: nowrap'>SimpleVector</span></a>
 class with
<a href="simplevector.xml#Elements of Specified Type" target="_top"><span style='white-space: nowrap'>elements&#xA0;of&#xA0;type</span></a>


<code><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i></code>
.
The routine <a href="checksimplevector.xml" target="_top"><span style='white-space: nowrap'>CheckSimpleVector</span></a>
 will generate an error message
if this is not the case.

<br/>
<br/>
<b><big><a name="Zero Order" id="Zero Order">Zero Order</a></big></b>
<br/>
The case where 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">=</mo>
<mn>0</mn>
</mrow></math>

 and 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
corresponds to the zero order
<a href="forward_zero.xml#Special Case" target="_top"><span style='white-space: nowrap'>special&#xA0;case</span></a>
. 

<br/>
<br/>
<b><big><a name="First Order" id="First Order">First Order</a></big></b>
<br/>
The case where 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">=</mo>
<mn>1</mn>
</mrow></math>

 and 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
corresponds to the first order
<a href="forward_one.xml#Special Case" target="_top"><span style='white-space: nowrap'>special&#xA0;case</span></a>
. 

<br/>
<br/>
<b><big><a name="Second Order" id="Second Order">Second Order</a></big></b>
<br/>
The case where 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>q</mi>
<mo stretchy="false">=</mo>
<mn>2</mn>
</mrow></math>

 and 
<code><i><font color="black"><span style='white-space: nowrap'>xq</span></font></i><font color="blue"><span style='white-space: nowrap'>.size()&#xA0;==&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
,
corresponds to the second order
<a href="forward_two.xml#Special Case" target="_top"><span style='white-space: nowrap'>special&#xA0;case</span></a>
. 


<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>
<br/>
The file
<a href="forward.cpp.xml" target="_top"><span style='white-space: nowrap'>forward.cpp</span></a>
 ( <a href="forward_order.cpp.xml" target="_top"><span style='white-space: nowrap'>forward_order.cpp</span></a>
 )
contains an example and test using one order (multiple orders).
They return true if they succeed and false otherwise.


<hr/>Input File: omh/forward/forward_order.omh

</body>
</html>
