<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>An Error Controller for ODE Solvers</title>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
<meta name="description" id="description" content="An Error Controller for ODE Solvers"/>
<meta name="keywords" id="keywords" content=" Odeerrcontrol Ode control error differential equation an controller for ode solvers syntax description include notation xf method step nan order ti tf xi smin smax scur eabs erel ef maxabs nstep criteria discussion scalar vector example theory source code "/>
<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='_odeerrcontrol_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="rosen_34.cpp.xml" target="_top">Prev</a>
</td><td><a href="ode_err_control.cpp.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-></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-></option>
<option>CppAD</option>
<option>library</option>
<option>OdeErrControl</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>CppAD-></option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>preprocessor</option>
<option>multi_thread</option>
<option>library</option>
<option>ipopt_solve</option>
<option>Example</option>
<option>speed</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>library-></option>
<option>ErrorHandler</option>
<option>NearEqual</option>
<option>speed_test</option>
<option>SpeedTest</option>
<option>time_test</option>
<option>NumericType</option>
<option>CheckNumericType</option>
<option>SimpleVector</option>
<option>CheckSimpleVector</option>
<option>nan</option>
<option>pow_int</option>
<option>Poly</option>
<option>LuDetAndSolve</option>
<option>RombergOne</option>
<option>RombergMul</option>
<option>Runge45</option>
<option>Rosen34</option>
<option>OdeErrControl</option>
<option>OdeGear</option>
<option>OdeGearControl</option>
<option>CppAD_vector</option>
<option>thread_alloc</option>
<option>index_sort</option>
<option>BenderQuad</option>
<option>opt_val_hes</option>
<option>LuRatio</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>OdeErrControl-></option>
<option>ode_err_control.cpp</option>
<option>ode_err_maxabs.cpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-></option>
<option>Syntax</option>
<option>Description</option>
<option>Include</option>
<option>Notation</option>
<option>xf</option>
<option>Method</option>
<option>---..step</option>
<option>---..Nan</option>
<option>---..order</option>
<option>ti</option>
<option>tf</option>
<option>xi</option>
<option>smin</option>
<option>smax</option>
<option>scur</option>
<option>eabs</option>
<option>erel</option>
<option>ef</option>
<option>maxabs</option>
<option>nstep</option>
<option>Error Criteria Discussion</option>
<option>Scalar</option>
<option>Vector</option>
<option>Example</option>
<option>Theory</option>
<option>Source Code</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>An Error Controller for ODE Solvers</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>
<code><font color="blue"><br/>
# include <cppad/ode_err_control.hpp></font></code>
<code><span style='white-space: nowrap'><br/>
</span></code>
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i><font color="blue"><span style='white-space: nowrap'> = OdeErrControl(</span></font><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>ti</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>tf</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>xi</span></font></i><font color="blue"><span style='white-space: nowrap'>,<br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>smax</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>scur</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>eabs</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>erel</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i><font color="blue"><span style='white-space: nowrap'> , </span></font><i><font color="black"><span style='white-space: nowrap'>maxabs</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>nstep</span></font></i><font color="blue"><span style='white-space: nowrap'> )</span></font></code>
<br/>
<br/>
<b><big><a name="Description" id="Description">Description</a></big></b>
<br/>
Let
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>R</mi>
</mstyle></mrow>
</mrow></math>
denote the real numbers
and let
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">:</mo>
<mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>R</mi>
</mstyle></mrow>
<mo stretchy="false">×</mo>
<msup><mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>R</mi>
</mstyle></mrow>
<mi mathvariant='italic'>n</mi>
</msup>
<mo stretchy="false">→</mo>
<msup><mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>R</mi>
</mstyle></mrow>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>
be a smooth function.
We define
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">:</mo>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">]</mo>
<mo stretchy="false">→</mo>
<msup><mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>R</mi>
</mstyle></mrow>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>
by
the following initial value problem:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mi mathvariant='italic'>xi</mi>
</mtd></mtr><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">'</mo>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mtd><mtd columnalign="center" >
<mo stretchy="false">=</mo>
</mtd><mtd columnalign="left" >
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">]</mo>
</mtd></mtr></mtable>
</mrow></math>
The routine <code><font color="blue">OdeErrControl</font></code> can be used to adjust the step size
used an arbitrary integration methods in order to be as fast as possible
and still with in a requested error bound.
<br/>
<br/>
<b><big><a name="Include" id="Include">Include</a></big></b>
<br/>
The file <code><font color="blue">cppad/ode_err_control.hpp</font></code> is included by
<code><font color="blue">cppad/cppad.hpp</font></code>
but it can also be included separately with out the rest of
the <code><font color="blue">CppAD</font></code> routines.
<br/>
<br/>
<b><big><a name="Notation" id="Notation">Notation</a></big></b>
<br/>
The template parameter types <a href="odeerrcontrol.xml#Scalar" target="_top"><span style='white-space: nowrap'>Scalar</span></a>
and
<a href="odeerrcontrol.xml#Vector" target="_top"><span style='white-space: nowrap'>Vector</span></a>
are documented below.
<br/>
<br/>
<b><big><a name="xf" id="xf">xf</a></big></b>
<br/>
The return value
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
has the prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> </span></font><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
(see description of <a href="odeerrcontrol.xml#Vector" target="_top"><span style='white-space: nowrap'>Vector</span></a>
below).
and the size of
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
is equal to
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
If
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
contains not a number <a href="nan.xml" target="_top"><span style='white-space: nowrap'>nan</span></a>
,
see the discussion of <a href="odeerrcontrol.xml#Method.Nan" target="_top"><span style='white-space: nowrap'>step</span></a>
.
<br/>
<br/>
<b><big><a name="Method" id="Method">Method</a></big></b>
<br/>
The class
<code><i><font color="black"><span style='white-space: nowrap'>Method</span></font></i></code>
and the object
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
satisfy the following syntax
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Method</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The object
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
must support <code><font color="blue">step</font></code> and
<code><font color="blue">order</font></code> member functions defined below:
<br/>
<br/>
<b><a name="Method.step" id="Method.step">step</a></b>
<br/>
The syntax
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'>.step(</span></font><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>xa</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i><font color="blue"><span style='white-space: nowrap'>)<br/>
</span></font></code>
executes one step of the integration method.
<code><font color="blue"><span style='white-space: nowrap'><br/>
<br/>
</span></font><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the initial time for this step in the
ODE integration.
(see description of <a href="odeerrcontrol.xml#Scalar" target="_top"><span style='white-space: nowrap'>Scalar</span></a>
below).
<code><font color="blue"><span style='white-space: nowrap'><br/>
<br/>
</span></font><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the final time for this step in the
ODE integration.
<code><font color="blue"><span style='white-space: nowrap'><br/>
<br/>
</span></font><i><font color="black"><span style='white-space: nowrap'>xa</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>xa</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>xa</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
It specifies the value of
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>ta</mi>
<mo stretchy="false">)</mo>
</mrow></math>
.
(see description of <a href="odeerrcontrol.xml#Vector" target="_top"><span style='white-space: nowrap'>Vector</span></a>
below).
<code><font color="blue"><span style='white-space: nowrap'><br/>
<br/>
</span></font><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The argument value
<code><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
The input value of its elements does not matter.
On output,
it contains the approximation for
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">)</mo>
</mrow></math>
that the method obtains.
<code><font color="blue"><span style='white-space: nowrap'><br/>
<br/>
</span></font><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The argument value
<code><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
The input value of its elements does not matter.
On output,
it contains an estimate for the error in the approximation
<code><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i></code>
.
It is assumed (locally) that the error bound in this approximation
nearly equal to
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>K</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ta</mi>
<msup><mo stretchy="false">)</mo>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>
where
<code><i><font color="black"><span style='white-space: nowrap'>K</span></font></i></code>
is a fixed constant and
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
is the corresponding argument to <code><font color="blue">CodeControl</font></code>.
<br/>
<br/>
<b><a name="Method.Nan" id="Method.Nan">Nan</a></b>
<br/>
If any element of the vector
<code><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i></code>
or
<code><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i></code>
are
not a number <code><font color="blue">nan</font></code>,
the current step is considered to large.
If this happens with the current step size equal to
<code><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i></code>
,
<code><font color="blue">OdeErrControl</font></code> returns with
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
and
<code><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i></code>
as vectors
of <code><font color="blue">nan</font></code>.
<br/>
<br/>
<b><a name="Method.order" id="Method.order">order</a></b>
<br/>
If
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
is <code><font color="blue">size_t</font></code>,
the object
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
must also support the following syntax
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>m</span></font></i><font color="blue"><span style='white-space: nowrap'> = </span></font><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'>.order()<br/>
</span></font></code>
The return value
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
is the order of the error estimate;
i.e., there is a constant K such that if
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">≤</mo>
<mi mathvariant='italic'>ta</mi>
<mo stretchy="false">≤</mo>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">≤</mo>
<mi mathvariant='italic'>tf</mi>
</mrow></math>
,
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mo stretchy="false">|</mo>
<mi mathvariant='italic'>eb</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">|</mo>
<mo stretchy="false">≤</mo>
<mi mathvariant='italic'>K</mi>
<mo stretchy="false">|</mo>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ta</mi>
<msup><mo stretchy="false">|</mo>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>
where
<code><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i></code>
,
<code><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i></code>
, and
<code><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i></code>
are as in
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'>.step(</span></font><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>xa</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>xb</span></font></i><font color="blue"><span style='white-space: nowrap'>, </span></font><i><font color="black"><span style='white-space: nowrap'>eb</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
<br/>
<br/>
<b><big><a name="ti" id="ti">ti</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>ti</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>ti</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the initial time for the integration of
the differential equation.
<br/>
<br/>
<b><big><a name="tf" id="tf">tf</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>tf</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>tf</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the final time for the integration of
the differential equation.
<br/>
<br/>
<b><big><a name="xi" id="xi">xi</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>xi</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>xi</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
It specifies value of
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
</mrow></math>
.
<br/>
<br/>
<b><big><a name="smin" id="smin">smin</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The step size during a call to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
is defined as
the corresponding value of
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ta</mi>
</mrow></math>
.
If
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">≤</mo>
<mi mathvariant='italic'>smin</mi>
</mrow></math>
,
the integration will be done in one step of size
<code><i><font color="black"><span style='white-space: nowrap'>tf - ti</span></font></i></code>
.
Otherwise,
the minimum value of
<code><i><font color="black"><span style='white-space: nowrap'>tb - ta</span></font></i></code>
will be
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>smin</mi>
</mrow></math>
except for the last two calls to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
where it may be
as small as
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>smin</mi>
<mo stretchy="false">/</mo>
<mn>2</mn>
</mrow></math>
.
<br/>
<br/>
<b><big><a name="smax" id="smax">smax</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>smax</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>smax</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the maximum step size to use during the integration;
i.e., the maximum value for
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ta</mi>
</mrow></math>
in a call to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
.
The value of
<code><i><font color="black"><span style='white-space: nowrap'>smax</span></font></i></code>
must be greater than or equal
<code><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i></code>
.
<br/>
<br/>
<b><big><a name="scur" id="scur">scur</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>scur</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>scur</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The value of
<code><i><font color="black"><span style='white-space: nowrap'>scur</span></font></i></code>
is the suggested next step size,
based on error criteria, to try in the next call to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
.
On input it corresponds to the first call to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
,
in this call to <code><font color="blue">OdeErrControl</font></code> (where
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>ta</mi>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>ti</mi>
</mrow></math>
).
On output it corresponds to the next call to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i></code>
,
in a subsequent call to <code><font color="blue">OdeErrControl</font></code> (where
<code><i><font color="black"><span style='white-space: nowrap'>ta = tf</span></font></i></code>
).
<br/>
<br/>
<b><big><a name="eabs" id="eabs">eabs</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>eabs</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>eabs</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
Each of the elements of
<code><i><font color="black"><span style='white-space: nowrap'>eabs</span></font></i></code>
must be
greater than or equal zero.
It specifies a bound for the absolute
error in the return value
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
as an approximation for
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">)</mo>
</mrow></math>
.
(see the
<a href="odeerrcontrol.xml#Error Criteria Discussion" target="_top"><span style='white-space: nowrap'>error criteria discussion</span></a>
below).
<br/>
<br/>
<b><big><a name="erel" id="erel">erel</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>erel</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     const </span></font><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>erel</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and is greater than or equal zero.
It specifies a bound for the relative
error in the return value
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
as an approximation for
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">)</mo>
</mrow></math>
(see the
<a href="odeerrcontrol.xml#Error Criteria Discussion" target="_top"><span style='white-space: nowrap'>error criteria discussion</span></a>
below).
<br/>
<br/>
<b><big><a name="ef" id="ef">ef</a></big></b>
<br/>
The argument value
<code><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i></code>
has prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
The input value of its elements does not matter.
On output,
it contains an estimated bound for the
absolute error in the approximation
<code><i><font color="black"><span style='white-space: nowrap'>xf</span></font></i></code>
; i.e.,
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msub><mi mathvariant='italic'>ef</mi>
<mi mathvariant='italic'>i</mi>
</msub>
<mo stretchy="false">></mo>
<mo stretchy="false">|</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>i</mi>
</msub>
<mo stretchy="false">-</mo>
<msub><mi mathvariant='italic'>xf</mi>
<mi mathvariant='italic'>i</mi>
</msub>
<mo stretchy="false">|</mo>
</mrow></math>
If on output
<code><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i></code>
contains not a number <code><font color="blue">nan</font></code>,
see the discussion of <a href="odeerrcontrol.xml#Method.Nan" target="_top"><span style='white-space: nowrap'>step</span></a>
.
<br/>
<br/>
<b><big><a name="maxabs" id="maxabs">maxabs</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>maxabs</span></font></i></code>
is optional in the call to <code><font color="blue">OdeErrControl</font></code>.
If it is present, it has the prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>maxabs</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
The input value of its elements does not matter.
On output,
it contains an estimate for the
maximum absolute value of
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>
; i.e.,
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mi mathvariant='italic'>maxabs</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">]</mo>
<mo stretchy="false">≈</mo>
<mi>max</mi>
<mrow><mo stretchy="true">{</mo><mrow><mo stretchy="false">|</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>i</mi>
</msub>
<mo stretchy="false">|</mo>
<mspace width='.3em'/>
<mo stretchy="false">:</mo>
<mspace width='.3em'/>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">∈</mo>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">]</mo>
</mrow><mo stretchy="true">}</mo></mrow>
</mrow></math>
<br/>
<b><big><a name="nstep" id="nstep">nstep</a></big></b>
<br/>
The argument
<code><i><font color="black"><span style='white-space: nowrap'>nstep</span></font></i></code>
is optional in the call to <code><font color="blue">OdeErrControl</font></code>.
If it is present, it has the prototype
<code><font color="blue"><span style='white-space: nowrap'><br/>
     </span></font><i><font color="black"><span style='white-space: nowrap'>size_t</span></font></i><font color="blue"><span style='white-space: nowrap'> &</span></font><i><font color="black"><span style='white-space: nowrap'>nstep</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
Its input value does not matter and its output value
is the number of calls to
<code><i><font color="black"><span style='white-space: nowrap'>method</span></font></i><font color="blue"><span style='white-space: nowrap'>.step</span></font></code>
used by <code><font color="blue">OdeErrControl</font></code>.
<br/>
<br/>
<b><big><a name="Error Criteria Discussion" id="Error Criteria Discussion">Error Criteria Discussion</a></big></b>
<br/>
The relative error criteria
<code><i><font color="black"><span style='white-space: nowrap'>erel</span></font></i></code>
and
absolute error criteria
<code><i><font color="black"><span style='white-space: nowrap'>eabs</span></font></i></code>
are enforced during each step of the
integration of the ordinary differential equations.
In addition, they are inversely scaled by the step size so that
the total error bound is less than the sum of the error bounds.
To be specific, if
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mover accent='false'><mrow><mi mathvariant='italic'>X</mi>
</mrow>
<mo stretchy='false'>˜</mo></mover>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>t</mi>
<mo stretchy="false">)</mo>
</mrow></math>
is the approximate solution
at time
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>t</mi>
</mrow></math>
,
<code><i><font color="black"><span style='white-space: nowrap'>ta</span></font></i></code>
is the initial step time,
and
<code><i><font color="black"><span style='white-space: nowrap'>tb</span></font></i></code>
is the final step time,
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mrow><mo stretchy="true">|</mo><mrow><mover accent='false'><mrow><mi mathvariant='italic'>X</mi>
</mrow>
<mo stretchy='false'>˜</mo></mover>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>j</mi>
</msub>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>j</mi>
</msub>
</mrow><mo stretchy="true">|</mo></mrow>
<mo stretchy="false">≤</mo>
<mfrac><mrow><mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
</mrow>
<mrow><mi mathvariant='italic'>tb</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ta</mi>
</mrow>
</mfrac>
<mrow><mo stretchy="true">[</mo><mrow><mi mathvariant='italic'>eabs</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">]</mo>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>erel</mi>
<mspace width='.3em'/>
<mo stretchy="false">|</mo>
<mover accent='false'><mrow><mi mathvariant='italic'>X</mi>
</mrow>
<mo stretchy='false'>˜</mo></mover>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>j</mi>
</msub>
<mo stretchy="false">|</mo>
</mrow><mo stretchy="true">]</mo></mrow>
</mrow></math>
If
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tb</mi>
<msub><mo stretchy="false">)</mo>
<mi mathvariant='italic'>j</mi>
</msub>
</mrow></math>
is near zero for some
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>tb</mi>
<mo stretchy="false">∈</mo>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">]</mo>
</mrow></math>
,
and one uses an absolute error criteria
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>eabs</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">]</mo>
</mrow></math>
of zero,
the error criteria above will force <code><font color="blue">OdeErrControl</font></code>
to use step sizes equal to
<a href="odeerrcontrol.xml#smin" target="_top"><span style='white-space: nowrap'>smin</span></a>
for steps ending near
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>tb</mi>
</mrow></math>
.
In this case, the error relative to
<code><i><font color="black"><span style='white-space: nowrap'>maxabs</span></font></i></code>
can be judged after
<code><font color="blue">OdeErrControl</font></code> returns.
If
<code><i><font color="black"><span style='white-space: nowrap'>ef</span></font></i></code>
is to large relative to
<code><i><font color="black"><span style='white-space: nowrap'>maxabs</span></font></i></code>
,
<code><font color="blue">OdeErrControl</font></code> can be called again
with a smaller value of
<code><i><font color="black"><span style='white-space: nowrap'>smin</span></font></i></code>
.
<br/>
<br/>
<b><big><a name="Scalar" id="Scalar">Scalar</a></big></b>
<br/>
The type
<code><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i></code>
must satisfy the conditions
for a <a href="numerictype.xml" target="_top"><span style='white-space: nowrap'>NumericType</span></a>
type.
The routine <a href="checknumerictype.xml" target="_top"><span style='white-space: nowrap'>CheckNumericType</span></a>
will generate an error message
if this is not the case.
In addition, the following operations must be defined for
<code><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i></code>
objects
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
and
<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
:
<table><tr><td align='left' valign='top'>
<b>Operation</b> </td><td align='left' valign='top'>
<b>Description</b> </td></tr><tr><td align='left' valign='top'>
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'> <= </span></font><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
</td><td align='left' valign='top'>
returns true (false) if
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
is less than or equal
(greater than)
<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
.
</td></tr><tr><td align='left' valign='top'>
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'> == </span></font><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
</td><td align='left' valign='top'>
returns true (false) if
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
is equal to
<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
.
</td></tr><tr><td align='left' valign='top'>
<code><font color="blue"><span style='white-space: nowrap'>log(</span></font><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
</td><td align='left' valign='top'>
returns a
<code><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i></code>
equal to the logarithm of
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
</td></tr><tr><td align='left' valign='top'>
<code><font color="blue"><span style='white-space: nowrap'>exp(</span></font><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
</td><td align='left' valign='top'>
returns a
<code><i><font color="black"><span style='white-space: nowrap'>Scalar</span></font></i></code>
equal to the exponential of
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
</td></tr>
</table>
<br/>
<b><big><a name="Vector" id="Vector">Vector</a></big></b>
<br/>
The type
<code><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i></code>
must be a <a href="simplevector.xml" target="_top"><span style='white-space: nowrap'>SimpleVector</span></a>
class with
<a href="simplevector.xml#Elements of Specified Type" target="_top"><span style='white-space: nowrap'>elements of type Scalar</span></a>
.
The routine <a href="checksimplevector.xml" target="_top"><span style='white-space: nowrap'>CheckSimpleVector</span></a>
will generate an error message
if this is not the case.
<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>
<br/>
The files
<a href="ode_err_control.cpp.xml" target="_top"><span style='white-space: nowrap'>ode_err_control.cpp</span></a>
and
<a href="ode_err_maxabs.cpp.xml" target="_top"><span style='white-space: nowrap'>ode_err_maxabs.cpp</span></a>
contain examples and tests of using this routine.
They return true if they succeed and false otherwise.
<br/>
<br/>
<b><big><a name="Theory" id="Theory">Theory</a></big></b>
<br/>
Let
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
</mrow></math>
be the error as a function of the
step size
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>s</mi>
</mrow></math>
and suppose that there is a constant
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>K</mi>
</mrow></math>
such that
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>K</mi>
<msup><mi mathvariant='italic'>s</mi>
<mi mathvariant='italic'>m</mi>
</msup>
</mrow></math>
.
Let
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>a</mi>
</mrow></math>
be our error bound.
Given the value of
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
</mrow></math>
, a step of size
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='normal'>λ</mi>
<mi mathvariant='italic'>s</mi>
</mrow></math>
would be ok provided that
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mtable rowalign="center" ><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>a</mi>
</mtd><mtd columnalign="center" >
<mo stretchy="false">≥</mo>
</mtd><mtd columnalign="left" >
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='normal'>λ</mi>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<mo stretchy="false">(</mo>
<mi mathvariant='normal'>λ</mi>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
</mtd></mtr><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>a</mi>
</mtd><mtd columnalign="center" >
<mo stretchy="false">≥</mo>
</mtd><mtd columnalign="left" >
<mi mathvariant='italic'>K</mi>
<msup><mi mathvariant='normal'>λ</mi>
<mi mathvariant='italic'>m</mi>
</msup>
<msup><mi mathvariant='italic'>s</mi>
<mi mathvariant='italic'>m</mi>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<mo stretchy="false">(</mo>
<mi mathvariant='normal'>λ</mi>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
</mtd></mtr><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>a</mi>
</mtd><mtd columnalign="center" >
<mo stretchy="false">≥</mo>
</mtd><mtd columnalign="left" >
<msup><mi mathvariant='normal'>λ</mi>
<mrow><mi mathvariant='italic'>m</mi>
<mn>-1</mn>
</mrow>
</msup>
<msup><mi mathvariant='italic'>s</mi>
<mrow><mi mathvariant='italic'>m</mi>
<mn>-1</mn>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<msup><mi mathvariant='italic'>s</mi>
<mi mathvariant='italic'>m</mi>
</msup>
</mtd></mtr><mtr><mtd columnalign="right" >
<mi mathvariant='italic'>a</mi>
</mtd><mtd columnalign="center" >
<mo stretchy="false">≥</mo>
</mtd><mtd columnalign="left" >
<msup><mi mathvariant='normal'>λ</mi>
<mrow><mi mathvariant='italic'>m</mi>
<mn>-1</mn>
</mrow>
</msup>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
<mo stretchy="false">)</mo>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<mi mathvariant='italic'>s</mi>
</mtd></mtr><mtr><mtd columnalign="right" >
<msup><mi mathvariant='normal'>λ</mi>
<mrow><mi mathvariant='italic'>m</mi>
<mn>-1</mn>
</mrow>
</msup>
</mtd><mtd columnalign="center" >
<mo stretchy="false">≤</mo>
</mtd><mtd columnalign="left" >
<mfrac><mrow><mi mathvariant='italic'>a</mi>
</mrow>
<mrow><mi mathvariant='italic'>e</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>s</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
<mfrac><mrow><mi mathvariant='italic'>s</mi>
</mrow>
<mrow><mi mathvariant='italic'>tf</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>ti</mi>
</mrow>
</mfrac>
</mtd></mtr></mtable>
</mrow></math>
Thus if the right hand side of the last inequality is greater
than or equal to one, the step of size
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>s</mi>
</mrow></math>
is ok.
<br/>
<br/>
<b><big><a name="Source Code" id="Source Code">Source Code</a></big></b>
<br/>
The source code for this routine is in the file
<code><font color="blue">cppad/ode_err_control.hpp</font></code>.
<hr/>Input File: cppad/ode_err_control.hpp
</body>
</html>