Prev | Next |
yq = f.Forward(q, xq )
yq = f.Forward(q, xq, s)
f
.
Given a function @(@
X : \B{R} \rightarrow \B{R}^n
@)@,
defined by its
Taylor coefficients
,
forward mode computes the Taylor coefficients for the function
@[@
Y (t) = F [ X(t) ]
@]@
n
to denote the dimension of the
domain
space for
f
.
m
to denote the dimension of the
range
space for
f
.
f
has prototype
ADFun<Base> f
Note that the ADFun
object
f
is not const
.
After this call we will have
f.size_order() == q + 1
f.size_direction() == 1
xq.size() == n
,
then we are only computing one order.
In this case, before this call we must have
f.size_order() >= q
f.size_direction() == 1
q
has prototype
size_t q
and specifies the highest order of the Taylor coefficients to be calculated.
xq
has prototype
const BaseVector& xq
(see BaseVector
below).
As above, we use
n
to denote the dimension of the
domain
space for
f
.
The size of
xq
must be either
n
or
n*(q+1)
.
After this call we will have
f.size_order() == q + 1
xq.size() == n
,
the q
-th order Taylor coefficient for @(@
X(t)
@)@
is defined by
@(@
x^{(q)} =
@)@
xq
.
For @(@
k = 0 , \ldots , q-1
@)@,
the Taylor coefficient @(@
x^{(k)}
@)@
is defined by
xk
in the previous call to
f.Forward(k, xk)
xq.size() == n*(q+1)
,
For @(@
k = 0 , \ldots , q
@)@,
@(@
j = 0 , \ldots , n-1
@)@,
the j
-th component of the k
-th order Taylor coefficient
for @(@
X(t)
@)@ is defined by
@(@
x_j^{(k)} =
@)@
xq[ (q+1) * j + k ]
f
uses atomic_one
functions,
the size of
xq
must be
n
.
s
is not present, std::cout
is used in its place.
Otherwise, this argument has prototype
std::ostream& s
If order zero is begin calculated,
s
specifies where the output corresponding to PrintFor
will be written.
If order zero is not being calculated,
s
is not used
k
-th derivative of @(@
X(t)
@)@ is related to the
Taylor coefficients by the equation
@[@
x^{(k)} = \frac{1}{k !} X^{(k)} (0)
@]@
k
-th order Taylor coefficient of @(@
Y(t)
@)@; i.e.,
@[@
Y(t) = y^{(0)} * t^0 + y^{(1)} * t^1 + \cdots + y^{(q)} * t^q + o( t^q )
@]@
where @(@
o( t^q ) * t^{-q} \rightarrow 0
@)@ as @(@
t \rightarrow 0
@)@.
Note that @(@
y^{(k)}
@)@ is related to
the k
-th derivative of @(@
Y(t)
@)@ by the equation
@[@
y^{(k)} = \frac{1}{k !} Y^{(k)} (0)
@]@
yq
has prototype
BaseVector yq
(see BaseVector
below).
xq.size() == n
,
the vector
yq
has size
m
.
The q
-th order Taylor coefficient for @(@
Y(t)
@)@
is returned as
yq
@(@
= y^{(q)}
@)@.
xq.size() == n*(q+1)
,
the vector
yq
has size
m*(q+1)
.
For @(@
k = 0 , \ldots , q
@)@,
for @(@
i = 0 , \ldots , m-1
@)@,
the i
-th component of the k
-th order Taylor coefficient
for @(@
Y(t)
@)@ is returned as
yq[ (q+1) * i + k ]
@(@
= y_i^{(k)}
@)@
BaseVector
must be a SimpleVector
class with
elements of type
Base
.
The routine CheckSimpleVector
will generate an error message
if this is not the case.
xq.size() == n
,
corresponds to the zero order
special case
.
xq.size() == n
,
corresponds to the first order
special case
.
xq.size() == n
,
corresponds to the second order
special case
.