<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>D01ATF : NAG Library, Mark 22</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 class="rout" href="../../pdf/D01/d01atf.pdf">D01ATF (PDF version)</a></div><div><a class="chap" href="d01conts.xml">D01 Chapter Contents</a></div><div><a class="chapint" href="d01intro.xml">D01 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>D01ATF</h1><div class="paramtext"><div class="header"><b>Note:</b>&#160; before using this routine, please read the Users' Note for your implementation to check the interpretation of <span class="bitalic">bold italicised</span> terms and other implementation-dependent details.</div></div> 
<div class="htmltoc">
<h2 class="htmltoc"><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">1&#160;&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">3&#160;&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">4&#160;&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">5&#160;&#160;<b>Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">6&#160;&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">7&#160;&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">8&#160;&#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">9&#160;&#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">9.1&#160;&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">9.2&#160;&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">9.3&#160;&#160;<b>Program Results</b></a>
</div>
</div>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>
<div class="paramtext">D01ATF is a general purpose integrator which calculates an approximation to the integral of a function <m:math><m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;over a finite interval <m:math><m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced></m:math>:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>I</m:mi><m:mo>=</m:mo>
 <m:munderover><m:mo>&#8747;</m:mo><m:mi>a</m:mi><m:mi>b</m:mi></m:munderover>
 <m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mrow><m:mi>d</m:mi><m:mi>x</m:mi></m:mrow>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;D01ATF&#160;(</td><td class="tdfspec2"><a class="arg" href="#F">F</a>, <a class="arg" href="#A">A</a>, <a class="arg" href="#B">B</a>, <a class="arg" href="#EPSABS">EPSABS</a>, <a class="arg" href="#EPSREL">EPSREL</a>, <a class="arg" href="#RESULT">RESULT</a>, <a class="arg" href="#ABSERR">ABSERR</a>, <a class="arg" href="#W">W</a>, <a class="arg" href="#LW">LW</a>, <a class="arg" href="#IW">IW</a>, <a class="arg" href="#LIW">LIW</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">LW, IW(LIW), LIW, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">A, B, EPSABS, EPSREL, RESULT, ABSERR, W(LW)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">F</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">D01ATF is based on the QUADPACK routine QAGS (see <a class="ref" href="#ref010">Piessens <span class="italic">et al.</span> (1983)</a>).  It is an adaptive routine, using the Gauss <m:math><m:mn>10</m:mn></m:math>-point and Kronrod <m:math><m:mn>21</m:mn></m:math>-point rules.  The algorithm, described in <a class="ref" href="#ref008">de Doncker (1978)</a>, incorporates a global acceptance criterion (as defined by <a class="ref" href="#ref009">Malcolm and Simpson (1976)</a>) together with the <m:math><m:mi>&#949;</m:mi></m:math>-algorithm (see <a class="ref" href="#ref011">Wynn (1956)</a>) to perform extrapolation.  The local error estimation is described in <a class="ref" href="#ref010">Piessens <span class="italic">et al.</span> (1983)</a>.</div><div class="paramtext">The routine is suitable as a general purpose integrator, and can be used when the integrand has singularities, especially when these are of algebraic or logarithmic type.</div><div class="paramtext">D01ATF requires a subroutine to evaluate the integrand at an array of different points and is therefore particularly efficient when the evaluation can be performed in vector mode on a vector-processing machine.  Otherwise the algorithm is identical to that used by <a class="rout" href="../D01/d01ajf.xml">D01AJF</a>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref008" id="ref008"/>de Doncker E (1978)  An adaptive extrapolation algorithm for automatic integration <i>ACM SIGNUM Newsl.</i> <b>13 (2)</b> 12&#8211;18 </div>
<div class="paramtext"><a name="ref009" id="ref009"/>Malcolm M A and Simpson R B (1976)  Local versus global strategies for adaptive quadrature <i>ACM Trans. Math. Software</i> <b>1</b> 129&#8211;146 </div>
<div class="paramtext"><a name="ref010" id="ref010"/>Piessens R, de Doncker&#8211;Kapenga E, &#220;berhuber C and Kahaner D (1983)  <i>QUADPACK, A Subroutine Package for Automatic Integration</i> Springer&#8211;Verlag </div>
<div class="paramtext"><a name="ref011" id="ref011"/>Wynn P (1956)  On a device for computing the <m:math><m:msub><m:mi>e</m:mi><m:mi>m</m:mi></m:msub><m:mfenced separators=""><m:msub><m:mi mathvariant="normal">S</m:mi><m:mi>n</m:mi></m:msub></m:mfenced></m:math>&#160;transformation <i>Math. Tables Aids Comput.</i> <b>10</b> 91&#8211;96 </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="F" id="F"/>1: &#160;&#160;&#8194; F &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd><div class="paramtext"><a class="arg" href="#F">F</a> must return the values of the integrand <m:math><m:mi>f</m:mi></m:math>&#160;at a set of points.</div><div class="subprog">
<div class="paramtext">The specification of <a class="arg" href="#F">F</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;F&#160;(</td><td class="tdfspec2"><a class="arg" href="../D01/d01atf.xml#F_X">X</a>, <a class="arg" href="../D01/d01atf.xml#F_FV">FV</a>, <a class="arg" href="../D01/d01atf.xml#F_N">N</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), FV(N)</td></tr></table>
<dl><dt class="paramhead"><a name="F_X" id="F_X"/>1: &#160;&#160;&#8194; X(<a class="arg" href="../D01/d01atf.xml#F_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the points at which the integrand <m:math><m:mi>f</m:mi></m:math>&#160;must be evaluated.</div></dd><dt class="paramhead"><a name="F_FV" id="F_FV"/>2: &#160;&#160;&#8194; FV(<a class="arg" href="../D01/d01atf.xml#F_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#F_FV"><m:mi mathcolor="#EE0000" mathvariant="bold">FV</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must contain the value of <m:math><m:mi>f</m:mi></m:math>&#160;at the point <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#F_X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#F_N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.</div></dd><dt class="paramhead"><a name="F_N" id="F_N"/>3: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the number of points at which the integrand is to be evaluated. The actual value of <a class="arg" href="../D01/d01atf.xml#F_N">N</a> is always <m:math><m:mn>21</m:mn></m:math>.</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#F">F</a> must be declared as EXTERNAL in the (sub)program from which D01ATF is called. Parameters denoted as <span class="italic">Input</span>  must <b>not</b>  be changed by this procedure.</div>
</dd><dt class="paramhead"><a name="A" id="A"/>2: &#160;&#160;&#8194; A &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>a</m:mi></m:math>, the lower limit of integration.</div></dd><dt class="paramhead"><a name="B" id="B"/>3: &#160;&#160;&#8194; B &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>b</m:mi></m:math>, the upper limit of integration. It is not necessary that <m:math><m:mi>a</m:mi><m:mo>&lt;</m:mo><m:mi>b</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="EPSABS" id="EPSABS"/>4: &#160;&#160;&#8194; EPSABS &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the absolute accuracy required. If <a class="arg" href="#EPSABS">EPSABS</a> is negative, the absolute value is used. See <a class="sec" href="#accuracy">Section 7</a>.</div></dd><dt class="paramhead"><a name="EPSREL" id="EPSREL"/>5: &#160;&#160;&#8194; EPSREL &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the relative accuracy required. If <a class="arg" href="#EPSREL">EPSREL</a> is negative, the absolute value is used. See <a class="sec" href="#accuracy">Section 7</a>.</div></dd><dt class="paramhead"><a name="RESULT" id="RESULT"/>6: &#160;&#160;&#8194; RESULT &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the approximation to the integral <m:math><m:mi>I</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="ABSERR" id="ABSERR"/>7: &#160;&#160;&#8194; ABSERR &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: an estimate of the modulus of the absolute error, which should be an upper bound for <m:math><m:mfenced open="|" close="|" separators=""><m:mi>I</m:mi><m:mo>-</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#RESULT"><m:mi mathcolor="#EE0000" mathvariant="bold">RESULT</m:mi></m:maction></m:mfenced></m:math>.</div></dd><dt class="paramhead"><a name="W" id="W"/>8: &#160;&#160;&#8194; W(<a class="arg" href="#LW">LW</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: details of the computation, as described in <a class="sec" href="#fcomments">Section 8</a>.</div></dd><dt class="paramhead"><a name="LW" id="LW"/>9: &#160;&#160;&#8194; LW &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the dimension of the array <a class="arg" href="#W">W</a> as declared in the (sub)program from which D01ATF is called. The value of <a class="arg" href="#LW">LW</a> (together with that of <a class="arg" href="#LIW">LIW</a>) imposes a bound on the number of sub-intervals into which the interval of integration may be divided by the routine. The number of sub-intervals cannot exceed <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>/</m:mo><m:mn>4</m:mn></m:math>. The more difficult the integrand, the larger <a class="arg" href="#LW">LW</a> should be.</div>
<div class="paramtext"><i>Suggested value</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>=</m:mo><m:mn>800</m:mn></m:math>&#160;to <m:math><m:mn>2000</m:mn></m:math>&#160;is adequate for most problems.

</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>4</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="IW" id="IW"/>10: &#8194; IW(<a class="arg" href="#LIW">LIW</a>) &#8211; INTEGER array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IW"><m:mi mathcolor="#EE0000" mathvariant="bold">IW</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;contains the actual number of sub-intervals used. The rest of the array is used as workspace.</div></dd><dt class="paramhead"><a name="LIW" id="LIW"/>11: &#8194; LIW &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the dimension of the array <a class="arg" href="#IW">IW</a> as declared in the (sub)program from which D01ATF is called. The number of sub-intervals into which the interval of integration may be divided cannot exceed <a class="arg" href="#LIW">LIW</a>.</div>
<div class="paramtext"><i>Suggested value</i>:
  

<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LIW"><m:mi mathcolor="#EE0000" mathvariant="bold">LIW</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>/</m:mo><m:mn>4</m:mn></m:math>.
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LIW"><m:mi mathcolor="#EE0000" mathvariant="bold">LIW</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>12: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <a class="arg" href="#IFAIL">IFAIL</a> must be set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>. If you are unfamiliar with this parameter you should refer to <a class="sec" href="../GENINT/essint.xml#library3">Section 3.3</a> in  the Essential Introduction for details.</div>
<div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>).
<div class="paramtext">For environments where it might be inappropriate to halt program execution when an error is detected, the value <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is recommended.  If the output of error messages is undesirable, then the value <m:math><m:mn>1</m:mn></m:math>&#160;is recommended.  Otherwise, because for this routine the values of the output parameters may be useful even if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>&#8800;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;on exit, the recommended value is <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>.  <b>When the value <m:math><m:mrow><m:mo>-</m:mo><m:mn mathvariant="bold">1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is used it is essential to test the value of <a class="arg" href="#IFAIL">IFAIL</a> on exit.</b></div>
</div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">If on entry <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">-1</m:mn></m:maction></m:math>, explanatory error messages are output on the current error message unit (as defined by <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>).</div><div class="paramtext"><b>Note:</b> D01ATF may return useful information for one or more of the following detected errors or warnings.</div><div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="IFeq1" id="IFeq1"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd><div class="paramtext">The maximum number of subdivisions allowed with the given workspace has been reached without the accuracy requirements being achieved.  Look at the integrand in order to determine the integration difficulties.  If the position of a local difficulty within the interval can be determined (e.g., a singularity of the integrand or its derivative, a peak, a discontinuity, etc.) you will probably gain from splitting up the interval at this point and calling the integrator on the subranges.  If necessary, another integrator, which is designed for handling the type of difficulty involved, must be used.  Alternatively, consider relaxing the accuracy requirements specified by <a class="arg" href="#EPSABS">EPSABS</a> and <a class="arg" href="#EPSREL">EPSREL</a>, or increasing the amount of workspace.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2" id="IFeq2"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd><div class="paramtext">Round-off error prevents the requested tolerance from being achieved.  Consider requesting less accuracy.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq3" id="IFeq3"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math></dt>
<dd><div class="paramtext">Extremely bad local integrand behaviour causes a very strong subdivision around one (or more) points of the interval.  The same advice applies as in the case of <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq1"><m:mn mathcolor="#003399" mathvariant="bold">1</m:mn></m:maction></m:math>.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq4" id="IFeq4"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>4</m:mn></m:math></dt>
<dd><div class="paramtext">The requested tolerance cannot be achieved because the extrapolation does not increase the accuracy satisfactorily; the returned result is the best which can be obtained.  The same advice applies as in the case of <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq1"><m:mn mathcolor="#003399" mathvariant="bold">1</m:mn></m:maction></m:math>.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq5" id="IFeq5"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>5</m:mn></m:math></dt>
<dd><div class="paramtext">The integral is probably divergent, or slowly convergent.  Please note that divergence can occur with any nonzero value of <a class="arg" href="#IFAIL">IFAIL</a>.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq6" id="IFeq6"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>6</m:mn></m:math></dt>
<dd><table class="ifail"><tr><td class="ifail1">On&#160;entry,</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LW"><m:mi mathcolor="#EE0000" mathvariant="bold">LW</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>4</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LIW"><m:mi mathcolor="#EE0000" mathvariant="bold">LIW</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>1</m:mn></m:math>.</td></tr></table></dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">D01ATF cannot guarantee, but in practice usually achieves, the following accuracy:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mfenced open="|" close="|" separators=""><m:mi>I</m:mi><m:mo>-</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#RESULT"><m:mi mathcolor="#EE0000" mathvariant="bold">RESULT</m:mi></m:maction></m:mfenced>
 <m:mo>&#8804;</m:mo>
 <m:mi mathvariant="italic">tol</m:mi>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi mathvariant="italic">tol</m:mi>
 <m:mo>=</m:mo>
 <m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced open="{" close="}" separators="">
   <m:mfenced open="|" close="|" separators=""><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPSABS"><m:mi mathcolor="#EE0000" mathvariant="bold">EPSABS</m:mi></m:maction></m:mfenced>
   <m:mo>,</m:mo>
   <m:mfenced open="|" close="|" separators=""><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPSREL"><m:mi mathcolor="#EE0000" mathvariant="bold">EPSREL</m:mi></m:maction></m:mfenced>
   <m:mo>&#215;</m:mo>
   <m:mfenced open="|" close="|" separators=""><m:mi>I</m:mi></m:mfenced>
  </m:mfenced></m:mrow>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

and <a class="arg" href="#EPSABS">EPSABS</a> and <a class="arg" href="#EPSREL">EPSREL</a> are user-specified absolute and relative error tolerances.  Moreover, it returns the quantity <a class="arg" href="#ABSERR">ABSERR</a> which, in normal circumstances, satisfies

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mfenced open="|" close="|" separators=""><m:mi>I</m:mi><m:mo>-</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#RESULT"><m:mi mathcolor="#EE0000" mathvariant="bold">RESULT</m:mi></m:maction></m:mfenced>
 <m:mo>&#8804;</m:mo>
 <m:maction actiontype="link" dsi:type="simple" dsi:href="#ABSERR"><m:mi mathcolor="#EE0000" mathvariant="bold">ABSERR</m:mi></m:maction>
 <m:mo>&#8804;</m:mo>
 <m:mi mathvariant="italic">tol</m:mi>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>&#8800;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;on exit, then you may wish to examine the contents of the array <a class="arg" href="#W">W</a>, which contains the end points of the sub-intervals used by D01ATF along with the integral contributions and error estimates over the sub-intervals.</div><div class="paramtext">Specifically, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>, let <m:math><m:msub><m:mi>r</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;denote the approximation to the value of the integral over the sub-interval <m:math>
 <m:mfenced separators="" open="[" close="]"><m:msub><m:mi>a</m:mi><m:mi>i</m:mi></m:msub><m:mo>,</m:mo><m:msub><m:mi>b</m:mi><m:mi>i</m:mi></m:msub></m:mfenced>
</m:math>&#160;in the partition of <m:math>
 <m:mfenced separators="" open="[" close="]"><m:mi>a</m:mi><m:mo>,</m:mo><m:mi>b</m:mi></m:mfenced>
</m:math>&#160;and <m:math>
 <m:msub><m:mi>e</m:mi><m:mi>i</m:mi></m:msub>
</m:math>&#160;be the corresponding absolute error estimate.  Then, <m:math>
 <m:mstyle displaystyle="true"><m:munderover>
  <m:mo>&#8747;</m:mo>
  <m:msub><m:mi>a</m:mi><m:mi>i</m:mi></m:msub>
  <m:msub><m:mi>b</m:mi><m:mi>i</m:mi></m:msub>
 </m:munderover></m:mstyle>
 <m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mrow><m:mi>d</m:mi><m:mi>x</m:mi></m:mrow>
 <m:mo>&#8771;</m:mo>
 <m:msub><m:mi>r</m:mi><m:mi>i</m:mi></m:msub>
</m:math>&#160;and <m:math>
 <m:maction actiontype="link" dsi:type="simple" dsi:href="#RESULT"><m:mi mathcolor="#EE0000" mathvariant="bold">RESULT</m:mi></m:maction>
 <m:mo>=</m:mo>
 <m:mstyle displaystyle="true"><m:munderover>
  <m:mo>&#8721;</m:mo>
  <m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:mrow>
  <m:mi>n</m:mi>
 </m:munderover></m:mstyle>
 <m:msub><m:mi>r</m:mi><m:mi>i</m:mi></m:msub>
</m:math>, unless D01ATF terminates while testing for divergence of the integral (see Section 3.4.3 of <a class="ref" href="#ref010">Piessens <span class="italic">et al.</span> (1983)</a>).  In this case, <a class="arg" href="#RESULT">RESULT</a> (and <a class="arg" href="#ABSERR">ABSERR</a>) are taken to be the values returned from the extrapolation process.  The value of <m:math><m:mi>n</m:mi></m:math>&#160;is returned in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IW"><m:mi mathcolor="#EE0000" mathvariant="bold">IW</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>, and the values <m:math><m:msub><m:mi>a</m:mi><m:mi>i</m:mi></m:msub></m:math>, <m:math><m:msub><m:mi>b</m:mi><m:mi>i</m:mi></m:msub></m:math>, <m:math><m:msub><m:mi>e</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>r</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;are stored consecutively in the array <a class="arg" href="#W">W</a>, that is:
<ul class="listind"><li class="listind"><m:math><m:msub><m:mi>a</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#W"><m:mi mathcolor="#EE0000" mathvariant="bold">W</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>,</li><li class="listind"><m:math><m:msub><m:mi>b</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#W"><m:mi mathcolor="#EE0000" mathvariant="bold">W</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mi>n</m:mi><m:mo>+</m:mo><m:mi>i</m:mi></m:mrow></m:mfenced></m:mrow></m:math>,</li><li class="listind"><m:math><m:msub><m:mi>e</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#W"><m:mi mathcolor="#EE0000" mathvariant="bold">W</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mn>2</m:mn><m:mi>n</m:mi><m:mo>+</m:mo><m:mi>i</m:mi></m:mrow></m:mfenced></m:mrow></m:math>&#160;and </li><li class="listind"><m:math><m:msub><m:mi>r</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#W"><m:mi mathcolor="#EE0000" mathvariant="bold">W</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mn>3</m:mn><m:mi>n</m:mi><m:mo>+</m:mo><m:mi>i</m:mi></m:mrow></m:mfenced></m:mrow></m:math>.</li></ul>
</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example computes

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:munderover>
  <m:mo>&#8747;</m:mo>
  <m:mn>0</m:mn>
  <m:mrow><m:mn>2</m:mn><m:mi>&#960;</m:mi></m:mrow>
 </m:munderover>
 <m:mfrac>
  <m:mrow>
   <m:mi>x</m:mi>
   <m:mrow><m:mi>sin</m:mi><m:mfenced separators=""><m:mn>30</m:mn><m:mi>x</m:mi></m:mfenced></m:mrow>
  </m:mrow>
  <m:msqrt>
    <m:mn>1</m:mn>
    <m:mo>-</m:mo>
    <m:msup>
     <m:mfenced separators=""><m:mi>x</m:mi><m:mo>/</m:mo><m:mrow><m:mn>2</m:mn><m:mi>&#960;</m:mi></m:mrow></m:mfenced>
     <m:mn>2</m:mn>
    </m:msup>
   </m:msqrt>
 </m:mfrac>
 <m:mrow><m:mi>d</m:mi><m:mi>x</m:mi></m:mrow>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><h3 class="standard"><a class="sec" name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
<p><a class="verbatimref" href="../../examples/source/d01atfe.f">Program Text (d01atfe.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<div class="paramtext">None.</div><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/d01atfe.r">Program Results (d01atfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/D01/d01atf.pdf">D01ATF (PDF version)</a></div><div><a class="chap" href="d01conts.xml">D01 Chapter Contents</a></div><div><a class="chapint" href="d01intro.xml">D01 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2009</a></div></body></html>
