$\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}$
Forward Mode: Derivative in One Domain Direction

Syntax
y_p = f.forward(p, x_p)

Purpose
We use $F : \B{R}^n \rightarrow \B{R}^m$ to denote the function corresponding to the adfun object f . Given the p-th order Taylor expansion for a function $X : \B{R} \rightarrow \B{R}^n$, this function can be used to compute the p-th order Taylor expansion for the function $Y : \B{R} \rightarrow \B{R}^m$ defined by $$Y(t) = F [ X(t) ]$$

x_k
For $k = 0 , \ldots , p$, we use $x^{(k)}$ to denote the value of x_k in the most recent call to       f.forward(k, x_k)  including $x^{(p)}$ as the value x_p in this call. We define the function $X(t)$ by $$X(t) = x^{(0)} + x^{(1)} * t + \cdots + x^{(p)} * t^p$$

y_k
For $k = 0 , \ldots , p$, we use $y^{(k)}$ to denote the Taylor coefficients for $Y(t) = F[ X(t) ]$ expanded about zero; i.e., $$\begin{array}{rcl} y^{(k)} & = & Y^{(k)} (0) / k ! \\ Y(t) & = & y^{(0)} + y^{(1)} * t + \cdots + y^{(p)} * t^p + o( t^p ) \end{array}$$ where $o( t^p ) / t^p \rightarrow 0$ as $t \rightarrow 0$. The coefficient $y^{(p)}$ is equal to the value y_p returned by this call.

f
The object f must be an adfun object. We use level for the AD ad level of this object.

p
The argument p is a non-negative int. It specifies the order of the Taylor coefficient for $Y(t)$ that is computed.

x_p
The argument x_p is a numpy.array with one dimension (i.e., a vector) with length equal to the domain size n for the function f . It specifies the p-th order Taylor coefficient for $X(t)$. If the AD level for f is zero, all the elements of x_p must be either int or instances of float. If the AD level for f is one, all the elements of x_p must be a_float objects.

y_p
The return value y_p is a numpy.array with one dimension (i.e., a vector) with length equal to the range size m for the function f . It is set to the p-th order Taylor coefficient for $Y(t)$. If the AD level for f is zero, all the elements of y_p will be instances of float. If the AD level for f is one, all the elements of y_p will be a_float objects.

Example
 forward_0.py Forward Order Zero: Example and Test forward_1.py Forward Order One: Example and Test