/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-21 Bradley M. Bell

  CppAD is distributed under the terms of the
               Eclipse Public License Version 2.0.

  This Source Code may also be made available under the following
  Secondary License when the conditions for such availability set forth
  in the Eclipse Public License, Version 2.0 are satisfied:
        GNU General Public License, Version 2.0 or later.
-------------------------------------------------------------------------- */
$begin forward_zero$$
$spell
    std::cout
    ostream
    const
    Taylor
    dy
    Jacobian
$$

$section Zero Order Forward Mode: Function Values$$

$head Syntax$$
$icode%y0% = %f%.Forward(0, %x0%)
%$$
$icode%y0% = %f%.Forward(0, %x0%, %s%)%$$

$head Purpose$$
We use $latex F : \B{R}^n \rightarrow \B{R}^m$$ to denote the
$cref/AD function/glossary/AD Function/$$ corresponding to $icode f$$.
The result of the syntax above is
$latex \[
    y0 = F(x0)
\] $$
See the $cref/FunCheck discussion/FunCheck/Discussion/$$ for
possible differences between $latex F(x)$$ and the algorithm that defined
the operation sequence.

$head f$$
The object $icode f$$ has prototype
$codei%
    ADFun<%Base%> %f%
%$$
Note that the $cref ADFun$$ object $icode f$$ is not $code const$$.
After this call to $code Forward$$, the value returned by
$codei%
    %f%.size_order()
%$$
will be equal to one (see $cref size_order$$).

$head x0$$
The argument $icode x0$$ has prototype
$codei%
    const %Vector%& %x0%
%$$
(see $cref/Vector/forward_zero/Vector/$$ below)
and its size must be equal to $icode n$$, the dimension of the
$cref/domain/fun_property/Domain/$$ space for $icode f$$.

$head s$$
If the argument $icode s$$ is not present, $code std::cout$$
is used in its place.
Otherwise, this argument has prototype
$codei%
    std::ostream& %s%
%$$
It specifies where the output corresponding to $cref PrintFor$$,
and this zero order forward mode call, will be written.

$head y0$$
The result $icode y0$$ has prototype
$codei%
    %Vector% %y0%
%$$
(see $cref/Vector/forward_zero/Vector/$$ below)
and its value is $latex F(x)$$ at $icode%x% = %x0%$$.
The size of $icode y0$$ is equal to $icode m$$, the dimension of the
$cref/range/fun_property/Range/$$ space for $icode f$$.

$head Vector$$
The type $icode Vector$$ must be a $cref SimpleVector$$ class with
$cref/elements of type/SimpleVector/Elements of Specified Type/$$
$icode Base$$.
The routine $cref CheckSimpleVector$$ will generate an error message
if this is not the case.

$head Example$$
The file
$cref forward.cpp$$
contains an example and test of this operation.

$head Special Case$$
This is special case of $cref forward_order$$ where
$latex \[
\begin{array}{rcl}
Y(t) & = & F[ X(t) ]
\\
X(t) & = & x^{(0)} t^0 + x^{(1)} * t^1 + \cdots, + x^{(q)} * t^q + o( t^q )
\\
Y(t) & = & y^{(0)} t^0 + y^{(1)} * t^1 + \cdots, + y^{(q)} * t^q + o( t^q )
\end{array}
\] $$
and $latex o( t^q ) * t^{-q} \rightarrow 0$$ as $latex t \rightarrow 0$$.
For this special case, $latex q = 0$$,
$latex x^{(0)}$$ $codei%= %x0%$$,
$latex X(t) = x^{(0)}$$, and
$latex \[
    y^{(0)} = Y(t) = F[ X(t) ] = F( x^{(0)} )
\] $$
which agrees with the specifications for
$icode y0$$ in the $cref/purpose/forward_zero/Purpose/$$ above.



$end
