// $Id: forward_zero.omh 3757 2015-11-30 12:03:07Z bradbell $
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell

CppAD is distributed under multiple licenses. This distribution is under
the terms of the
                    GNU General Public License Version 3.

A copy of this license is included in the COPYING file of this distribution.
Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
-------------------------------------------------------------------------- */
$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^n \rightarrow B^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/seq_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/seq_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.
It returns true if it succeeds and false otherwise.

$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
