<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xml:space="preserve"><head>
<!-- saved from url=(0014)about:internet -->
<title>
    NAG C Library Manual, Mark 8 : 
   e04abc</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a href="../../pdf/E04/e04abc.pdf">e04abc (pdf version)</a></div><div><a href="e04_conts.xml">Chapter Contents</a></div><div><a href="e04_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark8.xml">NAG C Library Manual</a></div><hr/><h1 class="libdoc">NAG C Library Function Document<br/><br/>nag_opt_one_var_no_deriv (e04abc)</h1><div class="htmltoc">
<h2><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#purpose">&#160;1&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">&#160;2&#160;<b>Specification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">&#160;3&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">&#160;4&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">&#160;5&#160;<b>Arguments</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">&#160;6&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">&#160;7&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">&#160;8&#160;<b>Further Comments</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocexample');"><span class="htmltocplus" id="tocexampleplus">+</span><span class="htmltocminus" id="tocexampleminus">&#8722;</span></span>
<a class="htmltoc" href="#example">&#160;9&#160;<b>Example</b></a>
<div class="htmltocitem" id="tocexample">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examtext">&#160;9.1&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">&#160;9.2&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">&#160;9.3&#160;<b>Program Results</b></a>
</div>
</div>
</div>
</div>
</div><h2><a name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2><div class="paramtext">nag_opt_one_var_no_deriv (e04abc) searches for a minimum, in a given finite interval, of a continuous function of a single variable, using function values only.  The method (based on quadratic interpolation) is intended for functions which have a continuous first derivative (although it will usually work if the derivative has occasional discontinuities).</div><h2><a name="specification" id="specification"/>2&#160;&#160;Specification</h2><table class="cspec">
<tr><td class="tdcspec" colspan="2">#include &lt;nag.h&gt;<br/>
#include &lt;nage04.h&gt;<br/><br/></td></tr>
<tr><td class="tdcspec">
void&#160;nag_opt_one_var_no_deriv</td><td class="tdcspec">(<table class="subspec"><tr><td class="tdcspec">void</td><td class="tdcspec">(*<a class="argref" href="#funct">funct</a>)(double&#160;<a class="argref" href="#funct_xc">xc</a>, double&#160;*<a class="argref" href="#funct_fc">fc</a>, Nag_Comm&#160;*<a class="argref" href="#funct_comm">comm</a>), </td></tr></table>double&#160;<a class="argref" href="#e1">e1</a>, double&#160;<a class="argref" href="#e2">e2</a>, double&#160;*<a class="argref" href="#a">a</a>, double&#160;*<a class="argref" href="#b">b</a>, Integer&#160;<a class="argref" href="#max_fun">max_fun</a>, double&#160;*<a class="argref" href="#x">x</a>, double&#160;*<a class="argref" href="#f">f</a>, Nag_Comm&#160;*<a class="argref" href="#comm">comm</a>, NagError&#160;*<a class="argref" href="#fail">fail</a>)
</td></tr>
</table><h2><a name="description" id="description"/>3&#160;&#160;Description</h2><div class="paramtext">nag_opt_one_var_no_deriv (e04abc) is applicable to problems of the form:
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><m:math xmlns:m="http://www.w3.org/1998/Math/MathML" display="block">
 <m:mtext>Minimize &#8195;</m:mtext>
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mtext>&#8195; subject to &#8195;</m:mtext>
 <m:mi>a</m:mi>
 <m:mo>&#8804;</m:mo>
 <m:mi>x</m:mi>
 <m:mo>&#8804;</m:mo>
 <m:mi>b</m:mi>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
It normally computes a sequence of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;values which tend in the limit to a minimum of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;subject to the given bounds.  It also progressively reduces the interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>&#160;in which the minimum is known to lie.  It uses the safeguarded quadratic-interpolation method described in <a class="litref" href="#ref335">Gill  and Murray (1973)</a>.</div>
<div class="paramtext">The user must supply a function <a class="argref" href="#funct">funct</a> to evaluate <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>.  The parameters <a class="argref" href="#e1">e1</a> and <a class="argref" href="#e2">e2</a> together specify the accuracy
</div><ul class="listind"><li class="listind"><m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:maction actiontype="link" dsi:href="#e1" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e1</m:mi></m:maction>
 <m:mo>&#215;</m:mo>
 <m:mfenced open="|" close="|" separators="">
  <m:mi>x</m:mi>
 </m:mfenced>
 <m:mo>+</m:mo>
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
</m:math></li></ul><div class="paramtext">
to which the position of the minimum is required.  Note that <a class="argref" href="#funct">funct</a> is never called at any point which is closer than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;to a previous point.</div>
<div class="paramtext">If the original interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>&#160;contains more than one minimum, nag_opt_one_var_no_deriv (e04abc) will normally find one of the minima.</div><h2><a name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext">
<p><a name="ref335" id="ref335"/>Gill P E and Murray W (1973) Safeguarded steplength algorithms for optimization using descent methods <i>NPL Report NAC 37</i> National Physical Laboratory </p>
</div><h2><a name="parameters" id="parameters"/>5&#160;&#160;Arguments</h2><dl><dt class="paramhead"><a name="funct" id="funct"/>1:
 &#160;&#160;&#8194;
 <b>funct</b> &#8211; function, supplied by the user&#160;<span class="pclass">External Function</span></dt><dd>
<div class="paramtext"><a class="argref" href="#funct">funct</a>, supplied by the user, must calculate the value of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;at any point <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;in <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>.</div><div class="paramtext"/><div class="paramtext">Its specification is:</div>
<div class="subprog"><table class="cspec"><tr><td class="tdcspec">
void&#160;funct</td><td class="tdcspec">(double&#160;<a class="argref" href="#funct_xc">xc</a>, double&#160;*<a class="argref" href="#funct_fc">fc</a>, Nag_Comm&#160;*<a class="argref" href="#funct_comm">comm</a>)
</td></tr>
</table><dl><dt class="paramhead"><a name="funct_xc" id="funct_xc"/>1:
 &#160;&#160;&#8194;
 <b>xc</b> &#8211; double&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>, the point at which the value of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;is required.</div>
</dd><dt class="paramhead"><a name="funct_fc" id="funct_fc"/>2:
 &#160;&#160;&#8194;
 <b>fc</b> &#8211; double&#160;*<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the value of the function <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
</m:math>&#160;at the current point <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>.</div>
</dd><dt class="paramhead"><a name="funct_comm" id="funct_comm"/>3:
 &#160;&#160;&#8194;
 <b>comm</b> &#8211; Nag_Comm&#160;*</dt><dd>
<div class="paramtext">Pointer to structure of type <b>Nag_Comm</b>; the following members are relevant to <a class="argref" href="#funct">funct</a>.</div>
<div>
<dl><dt class="memberhead"><a name="funct_comm_first" id="funct_comm_first"/><b>first</b> &#8211; Nag_Boolean&#160;<span class="pclass">Input</span></dt><dd>
<div class="membertext"><i>On entry</i>: will be set to <b>Nag_True</b> on the first call to <a class="argref" href="#funct">funct</a> and <b>Nag_False</b> for all subsequent calls.</div>
</dd></dl>
<dl>
<dt class="memberhead"><a name="funct_comm_nf" id="funct_comm_nf"/><b>nf</b> &#8211; Integer&#160;<span class="pclass">Input</span></dt><dd>
<div class="membertext"><i>On entry</i>: the number of calls made to <a class="argref" href="#funct">funct</a> so far.</div>
</dd></dl>
<dl>
<dt class="memberhead"><a name="funct_comm_user" id="funct_comm_user"/><b>user</b> &#8211; double&#160;*<span class="pclass"/></dt>
<dt class="multi-memberhead"><a name="funct_comm_iuser" id="funct_comm_iuser"/><b>iuser</b> &#8211; Integer&#160;*<span class="pclass"/></dt>
<dt class="multi-memberhead"><a name="funct_comm_p" id="funct_comm_p"/><b>p</b> &#8211; Pointer&#160;<span class="pclass"/></dt><dd>
<div class="membertext">The type Pointer will be <span class="mono">void *</span> with a C compiler that defines <span class="mono">void *</span> and <span class="mono">char *</span> otherwise.  Before calling nag_opt_one_var_no_deriv (e04abc) these pointers may be allocated memory by the user and initialized with various quantities for use by <a class="argref" href="#funct">funct</a> when called from nag_opt_one_var_no_deriv (e04abc).</div>
</dd></dl>
</div>
</dd></dl>
</div>
<div class="paramtext"><b>Note:</b> <a class="argref" href="#funct">funct</a> should be tested separately before being used in conjunction with nag_opt_one_var_no_deriv (e04abc).</div>
</dd><dt class="paramhead"><a name="e1" id="e1"/>2:
 &#160;&#160;&#8194;
 <b>e1</b> &#8211; double&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the relative accuracy to which the position of a minimum is required.  (Note that since <a class="argref" href="#e1">e1</a> is a relative tolerance, the scaling of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;is automatically taken into account.)
<div class="paramtext">It is recommended that <a class="argref" href="#e1">e1</a> should be no smaller than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mn>2</m:mn>
 <m:mi>&#949;</m:mi>
</m:math>, and preferably not much less than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:msqrt>
  <m:mi>&#949;</m:mi>
 </m:msqrt>
</m:math>, where <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>&#949;</m:mi>
</m:math>&#160;is the <span class="bitalic">machine precision</span>.
</div>
<div class="paramtext">If <a class="argref" href="#e1">e1</a> is set to a value less than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>&#949;</m:mi>
</m:math>, its value is ignored and the default value of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:msqrt>
  <m:mi>&#949;</m:mi>
 </m:msqrt>
</m:math>&#160;is used instead.  In particular, the user may set <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#e1" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e1</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn>
</m:math>&#160;to ensure that the default value is used.
</div>
</div>
</dd><dt class="paramhead"><a name="e2" id="e2"/>3:
 &#160;&#160;&#8194;
 <b>e2</b> &#8211; double&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the absolute accuracy to which the position of a minimum is required.  It is recommended that <a class="argref" href="#e2">e2</a> should be no smaller than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mn>2</m:mn>
 <m:mi>&#949;</m:mi>
</m:math>.
<div class="paramtext">If <a class="argref" href="#e2">e2</a> is set to a value less than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>&#949;</m:mi>
</m:math>, its value is ignored and the default value of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:msqrt>
  <m:mi>&#949;</m:mi>
 </m:msqrt>
</m:math>&#160;is used instead.  In particular, the user may set <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn>
</m:math>&#160;to ensure that the default value is used.</div>
</div>
</dd><dt class="paramhead"><a name="a" id="a"/>4:
 &#160;&#160;&#8194;
 <b>a</b> &#8211; double&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the lower bound <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>a</m:mi>
</m:math>&#160;of the interval containing a minimum.</div>
<div class="paramtext"><i>On exit</i>: an improved lower bound on the position of the minimum.</div>
</dd><dt class="paramhead"><a name="b" id="b"/>5:
 &#160;&#160;&#8194;
 <b>b</b> &#8211; double&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the upper bound <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>b</m:mi>
</m:math>&#160;of the interval containing a minimum.</div>
<div class="paramtext"><i>On exit</i>: an improved upper bound on the position of the minimum.</div><div class="paramtext"><i>Constraint</i>:
  <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#b" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">b</m:mi></m:maction>
 <m:mo>&gt;</m:mo>
 <m:maction actiontype="link" dsi:href="#a" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">a</m:mi></m:maction>
 <m:mo>+</m:mo>
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
</m:math>..<div class="paramtext">Note that the value <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
 <m:mo>=</m:mo>
 <m:msqrt>
  <m:mi>&#949;</m:mi>
 </m:msqrt>
</m:math>&#160;applies here if <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction><m:mo>&lt;</m:mo><m:mi>&#949;</m:mi>
</m:math>&#160;on entry to nag_opt_one_var_no_deriv (e04abc).</div></div>
</dd><dt class="paramhead"><a name="max_fun" id="max_fun"/>6:
 &#160;&#160;&#8194;
 <b>max_fun</b> &#8211; Integer&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the maximum number of function evaluations (calls to <a class="argref" href="#funct">funct</a>) which the user is prepared to allow.
<div class="paramtext">The number of evaluations actually performed by nag_opt_one_var_no_deriv (e04abc) may be determined by supplying a non-NULL parameter <a class="argref" href="#comm">comm</a> (see below) and examining the structure member <a class="memberref" href="#funct_comm_nf">nf</a> on exit.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#max_fun" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">max_fun</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>3</m:mn>
</m:math>..<div class="paramtext">(Few problems will require more than 30 function evaluations.)</div></div>
</dd><dt class="paramhead"><a name="x" id="x"/>7:
 &#160;&#160;&#8194;
 <b>x</b> &#8211; double&#160;*<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the estimated position of the minimum.</div>
</dd><dt class="paramhead"><a name="f" id="f"/>8:
 &#160;&#160;&#8194;
 <b>f</b> &#8211; double&#160;*<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the value of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
</m:math>&#160;at the final point <a class="argref" href="#x">x</a>.</div>
</dd><dt class="paramhead"><a name="comm" id="comm"/>9:
 &#160;&#160;&#8194;
 <b>comm</b> &#8211; Nag_Comm&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry/exit</i>: structure containing pointers for communication to user-supplied functions; see the above description of <a class="argref" href="#funct">funct</a> for details.  The number of times the function <a class="argref" href="#funct">funct</a> was called is returned in the member <a class="memberref" href="#funct_comm_nf">nf</a>.
<div class="paramtext">If the user does not need to make use of this communication feature, the null pointer <span class="mono">NAGCOMM_NULL</span> may be used in the call to nag_opt_one_var_no_deriv (e04abc); <a class="argref" href="#comm">comm</a> will then be declared internally for use in calls to user-supplied functions.</div>
</div>
</dd><dt class="paramhead"><a name="fail" id="fail"/>10:
 &#8194;
 <b>fail</b> &#8211; NagError&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext">The NAG error parameter, see the <a class="secref" href="../genint/cl_essint.xml">Essential Introduction</a>.</div></dd></dl><h2><a name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2><dl><dt class="errorhead"><a name="NE_2_REAL_ARG_GE" id="NE_2_REAL_ARG_GE"/><b>NE_2_REAL_ARG_GE</b></dt>
<dd style="margin-top: .2em;"><div class="paramtext">On entry, <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#a" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">a</m:mi></m:maction>
 <m:mo>+</m:mo>
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
 <m:mo>=</m:mo>
 <m:mfenced open="&#9001;" close="&#9002;" separators=""><m:mtext mathvariant="italic">value</m:mtext></m:mfenced></m:math>&#160;while <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#b" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">b</m:mi></m:maction><m:mo>=</m:mo><m:mfenced open="&#9001;" close="&#9002;" separators=""><m:mtext mathvariant="italic">value</m:mtext></m:mfenced>
</m:math>.  These parameters must satisfy <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#a" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">a</m:mi></m:maction>
 <m:mo>+</m:mo>
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
 <m:mo>&lt;</m:mo>
 <m:maction actiontype="link" dsi:href="#b" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">b</m:mi></m:maction>
</m:math>.
</div></dd><dt class="errorhead"><a name="NE_INT_ARG_LT" id="NE_INT_ARG_LT"/><b>NE_INT_ARG_LT</b></dt>
<dd style="margin-top: .2em;"><div class="paramtext">On entry, <a class="argref" href="#max_fun">max_fun</a> must not be less than 3: <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:maction actiontype="link" dsi:href="#max_fun" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">max_fun</m:mi></m:maction><m:mo>=</m:mo><m:mfenced open="&#9001;" close="&#9002;" separators=""><m:mtext mathvariant="italic">value</m:mtext></m:mfenced>
</m:math>.
</div></dd><dt class="errorhead"><a name="NW_MAX_FUN" id="NW_MAX_FUN"/><b>NW_MAX_FUN</b></dt>
<dd style="margin-top: .2em;"><div class="paramtext">The maximum number of function calls, <m:math xmlns:m="http://www.w3.org/1998/Math/MathML"><m:mfenced open="&#9001;" close="&#9002;" separators=""><m:mtext mathvariant="italic">value</m:mtext></m:mfenced></m:math>, have been performed.
<div class="paramtext">This may have happened simply because <a class="argref" href="#max_fun">max_fun</a> was set too small for a particular problem, or may be due to a mistake in the user-supplied function, <a class="argref" href="#funct">funct</a>.  If no mistake can be found in <a class="argref" href="#funct">funct</a>, restart nag_opt_one_var_no_deriv (e04abc) (preferably with the values of <a class="argref" href="#a">a</a> and <a class="argref" href="#b">b</a> given on exit from the previous call to nag_opt_one_var_no_deriv (e04abc)).</div>
</div></dd></dl><h2><a name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2><div class="paramtext">If <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;is <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>&#948;</m:mi>
</m:math>-unimodal for some <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>&#948;</m:mi>
 <m:mo>&lt;</m:mo>
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>, where <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:maction actiontype="link" dsi:href="#e1" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e1</m:mi></m:maction>
 <m:mo>&#215;</m:mo>
 <m:mfenced open="|" close="|" separators="">
  <m:mi>x</m:mi>
 </m:mfenced>
 <m:mo>+</m:mo>
 <m:maction actiontype="link" dsi:href="#e2" dsi:type="simple"><m:mi mathcolor="#EE0000" mathvariant="bold">e2</m:mi></m:maction>
</m:math>, then, on exit, <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;approximates the minimum of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;in the original interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>&#160;with an error less than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mn>3</m:mn>
 <m:mo>&#215;</m:mo>
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>.</div><h2><a name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2><div class="paramtext">Timing depends on the behaviour of <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>, the accuracy demanded, and the length of the interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>.  Unless <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;can be evaluated very quickly, the run time will usually be dominated by the time spent in <a class="argref" href="#funct">funct</a>.</div>
<div class="paramtext">If <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;has more than one minimum in the original interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>, nag_opt_one_var_no_deriv (e04abc) will determine an approximation <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;(and improved bounds <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>a</m:mi>
</m:math>&#160;and <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>b</m:mi>
</m:math>) for one of the minima.</div>
<div class="paramtext">If nag_opt_one_var_no_deriv (e04abc) finds an <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>x</m:mi>
</m:math>&#160;such that <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators="">
  <m:mi>x</m:mi>
  <m:mo>-</m:mo>
  <m:msub>
   <m:mi>&#948;</m:mi>
   <m:mn>1</m:mn>
  </m:msub>
 </m:mfenced>
 <m:mo>&gt;</m:mo>
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>&lt;</m:mo>
 <m:mi>F</m:mi>
 <m:mfenced separators="">
  <m:mi>x</m:mi>
  <m:mo>+</m:mo>
  <m:msub>
   <m:mi>&#948;</m:mi>
   <m:mn>2</m:mn>
  </m:msub>
 </m:mfenced>
</m:math>&#160;for some <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:msub>
  <m:mi>&#948;</m:mi>
  <m:mn>1</m:mn>
 </m:msub>
 <m:mo>,</m:mo>
 <m:msub>
  <m:mi>&#948;</m:mi>
  <m:mn>2</m:mn>
 </m:msub>
 <m:mo>&#8805;</m:mo>
 <m:mi mathvariant="italic">Tol</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>, the interval <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mrow>
   <m:mi>x</m:mi>
   <m:mo>-</m:mo>
   <m:msub>
    <m:mi>&#948;</m:mi>
    <m:mn>1</m:mn>
   </m:msub>
  </m:mrow><m:mo>,</m:mo><m:mrow>
   <m:mi>x</m:mi>
   <m:mo>+</m:mo>
   <m:msub>
    <m:mi>&#948;</m:mi>
    <m:mn>2</m:mn>
   </m:msub>
  </m:mrow></m:mfenced>
</m:math>&#160;will be regarded as containing a minimum, even if <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;is less than <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators="">
  <m:mi>x</m:mi>
  <m:mo>-</m:mo>
  <m:msub>
   <m:mi>&#948;</m:mi>
   <m:mn>1</m:mn>
  </m:msub>
 </m:mfenced>
</m:math>&#160;and <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators="">
  <m:mi>x</m:mi>
  <m:mo>+</m:mo>
  <m:msub>
   <m:mi>&#948;</m:mi>
   <m:mn>2</m:mn>
  </m:msub>
 </m:mfenced>
</m:math>&#160;only due to rounding errors in the user-supplied function.  Therefore <a class="argref" href="#funct">funct</a> should be programmed to calculate <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
</m:math>&#160;as accurately as possible, so that nag_opt_one_var_no_deriv (e04abc) will not be liable to find a spurious minimum.</div><h2><a name="example" id="example"/>9&#160;&#160;Example</h2><div class="paramtext">A sketch of the function
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><m:math xmlns:m="http://www.w3.org/1998/Math/MathML" display="block">
 <m:mi>F</m:mi>
 <m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:mfrac>
  <m:mrow><m:mi>sin</m:mi><m:mo>&#8289;</m:mo><m:mi>x</m:mi></m:mrow>
  <m:mi>x</m:mi>
 </m:mfrac>
</m:math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
shows that it has a minimum somewhere in the range <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
 <m:mfenced separators="" open="[" close="]"><m:mn>3.5</m:mn><m:mo>,</m:mo><m:mn>5.0</m:mn></m:mfenced>
</m:math>.  The example program below shows how nag_opt_one_var_no_deriv (e04abc) can be used to obtain a good approximation to the position of a minimum.</div><h3><a name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
 
<p><a class="verbatimref" href="../../examples/source/e04abce.c">Program Text (e04abce.c)</a></p><h3><a name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3><div class="paramtext">None.</div><h3><a name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3><p><a class="verbatimref" href="../../examples/baseresults/e04abce.r">Program Results (e04abce.r)</a></p><hr/><div><a href="../../pdf/E04/e04abc.pdf">e04abc (pdf version)</a></div><div><a href="e04_conts.xml">Chapter Contents</a></div><div><a href="e04_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark8.xml">NAG C Library Manual</a></div>
<div><hr/>
  &#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2005
  </div></body></html>