<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>exp_eps: Verify Second Order Forward Sweep</title>
<meta name="description" id="description" content="exp_eps: Verify Second Order Forward Sweep"/>
<meta name="keywords" id="keywords" content=" first order exp_2 "/>
<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='_exp_eps_for2.cpp_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="exp_eps_for2.xml" target="_top">Prev</a>
</td><td><a href="exp_eps_rev2.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>Introduction</option>
<option>exp_eps</option>
<option>exp_eps_for2</option>
<option>exp_eps_for2.cpp</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>Introduction-&gt;</option>
<option>get_started.cpp</option>
<option>exp_2</option>
<option>exp_eps</option>
<option>exp_apx_main.cpp</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>exp_eps-&gt;</option>
<option>exp_eps.hpp</option>
<option>exp_eps.cpp</option>
<option>exp_eps_for0</option>
<option>exp_eps_for1</option>
<option>exp_eps_rev1</option>
<option>exp_eps_for2</option>
<option>exp_eps_rev2</option>
<option>exp_eps_cppad</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>exp_eps_for2-&gt;</option>
<option>exp_eps_for2.cpp</option>
</select>
</td>
<td>exp_eps_for2.cpp</td>
<td>Headings</td>
</tr></table><br/>



<center><b><big><big>exp_eps: Verify Second Order Forward Sweep</big></big></b></center>
<code><font color='blue'><pre style='display:inline'> # include &lt;cmath&gt;                     // for fabs function
extern bool exp_eps_for0(double *v0); // computes zero order forward sweep
extern bool exp_eps_for1(double *v1); // computes first order forward sweep
bool exp_eps_for2(void)
{	bool ok = true;
	double v0[8], v1[8], v2[8];

	// set the value of v0[j], v1[j] for j = 1 , ... , 7
	ok &amp;= exp_eps_for0(v0);
	ok &amp;= exp_eps_for1(v1);

	v2[1] = 0.;                                      // v1 = x
	ok    &amp;= std::fabs( v2[1] - 0. ) &lt;= 1e-10;

	v2[2] = 1. * v2[1];                              // v2 = 1 * v1
	ok    &amp;= std::fabs( v2[2] - 0. ) &lt;= 1e-10;

	v2[3] = v2[2] / 1.;                              // v3 = v2 / 1
	ok    &amp;= std::fabs( v2[3] - 0. ) &lt;= 1e-10;

	v2[4] = v2[3];                                   // v4 = 1 + v3
	ok    &amp;= std::fabs( v2[4] - 0. ) &lt;= 1e-10;

	v2[5] = v2[3] * v0[1] + 2. * v1[3] * v1[1]       // v5 = v3 * v1
	      + v0[3] * v2[1];           
	ok    &amp;= std::fabs( v2[5] - 2. ) &lt;= 1e-10;

	v2[6] = v2[5] / 2.;                              // v6 = v5 / 2
	ok    &amp;= std::fabs( v2[6] - 1. ) &lt;= 1e-10;

	v2[7] = v2[4] + v2[6];                           // v7 = v4 + v6
	ok    &amp;= std::fabs( v2[7] - 1. ) &lt;= 1e-10;

	return ok;
}
</pre></font></code>


<hr/>Input File: introduction/exp_apx/exp_eps_for2.cpp

</body>
</html>
