<?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>E02BBF : 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/E02/e02bbf.pdf">E02BBF (PDF version)</a></div><div><a class="chap" href="e02conts.xml">E02 Chapter Contents</a></div><div><a class="chapint" href="e02intro.xml">E02 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/>E02BBF</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">E02BBF evaluates a cubic spline from its B-spline representation.</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;E02BBF&#160;(</td><td class="tdfspec2"><a class="arg" href="#NCAP7">NCAP7</a>, <a class="arg" href="#LAMDA">LAMDA</a>, <a class="arg" href="#C">C</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#S">S</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">NCAP7, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">LAMDA(NCAP7), C(NCAP7), X, S</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">E02BBF evaluates the cubic spline <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;at a prescribed argument <m:math><m:mi>x</m:mi></m:math>&#160;from its augmented knot set <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>i</m:mi></m:msub></m:math>, 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:mo>+</m:mo><m:mn>7</m:mn></m:math>, (see <a class="rout" href="../E02/e02baf.xml">E02BAF</a>) and from the coefficients <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></m:math>, 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>q</m:mi></m:math>&#160;in its B-spline representation

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced><m:mo>=</m:mo><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>q</m:mi></m:munderover><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub><m:msub><m:mi>N</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

Here <m:math><m:mi>q</m:mi><m:mo>=</m:mo><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>3</m:mn></m:math>, where <m:math><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover></m:math>&#160;is the number of intervals of the spline, and <m:math><m:msub><m:mi>N</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;denotes the normalized B-spline of degree <m:math><m:mn>3</m:mn></m:math>&#160;defined upon the knots <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>i</m:mi></m:msub><m:mo>,</m:mo><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mi>i</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mi>i</m:mi><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:msub></m:math>.  The prescribed argument <m:math><m:mi>x</m:mi></m:math>&#160;must satisfy <m:math><m:msub><m:mi>&#955;</m:mi><m:mn>4</m:mn></m:msub><m:mo>&#8804;</m:mo><m:mi>x</m:mi><m:mo>&#8804;</m:mo><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:msub></m:math>.</div><div class="paramtext">It is assumed that <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>j</m:mi></m:msub><m:mo>&#8805;</m:mo><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mi>j</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mn>3</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:math>, and <m:math><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:msub><m:mo>&gt;</m:mo><m:msub><m:mi>&#955;</m:mi><m:mn>4</m:mn></m:msub></m:math>.</div><div class="paramtext">If <m:math><m:mi>x</m:mi></m:math>&#160;is a point at which <m:math><m:mn>4</m:mn></m:math>&#160;knots coincide, <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;is discontinuous at <m:math><m:mi>x</m:mi></m:math>; in this case, <a class="arg" href="#S">S</a> contains the value defined as <m:math><m:mi>x</m:mi></m:math>&#160;is approached from the right.</div><div class="paramtext">The method employed is that of evaluation by taking convex combinations due to <a class="ref" href="#ref044">de Boor (1972)</a>.  For further details of the algorithm and its use see <a class="ref" href="#ref062">Cox (1972)</a> and <a class="ref" href="#ref054">Cox and Hayes (1973)</a>.</div><div class="paramtext">It is expected that a common use of E02BBF will be the evaluation of the cubic spline approximations produced by <a class="rout" href="../E02/e02baf.xml">E02BAF</a>.  A generalization of E02BBF which also forms the derivative of <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;is <a class="rout" href="../E02/e02bcf.xml">E02BCF</a>.  <a class="rout" href="../E02/e02bcf.xml">E02BCF</a> takes about <m:math><m:mn>50</m:mn><m:mo>%</m:mo></m:math>&#160;longer than E02BBF.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref062" id="ref062"/>Cox M G (1972)  The numerical evaluation of B-splines <i>J. Inst. Math. Appl.</i> <b>10</b> 134&#8211;149 </div>
<div class="paramtext"><a name="ref068" id="ref068"/>Cox M G (1978)  The numerical evaluation of a spline from its B-spline representation <i>J. Inst. Math. Appl.</i> <b>21</b> 135&#8211;143 </div>
<div class="paramtext"><a name="ref054" id="ref054"/>Cox M G and Hayes J G (1973)  Curve fitting: a guide and suite of algorithms for the non-specialist user <i>NPL Report NAC26</i> National Physical Laboratory </div>
<div class="paramtext"><a name="ref044" id="ref044"/>de Boor C (1972)  On calculating with B-splines <i>J. Approx. Theory</i> <b>6</b> 50&#8211;62 </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="NCAP7" id="NCAP7"/>1: &#160;&#160;&#8194; NCAP7 &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: 

<m:math><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:math>, where <m:math><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover></m:math>&#160;is the number of intervals (one greater than the number of interior knots, i.e., the knots strictly within the range <m:math><m:msub><m:mi>&#955;</m:mi><m:mn>4</m:mn></m:msub></m:math>&#160;to <m:math><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:msub></m:math>) over which the spline is defined.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCAP7"><m:mi mathcolor="#EE0000" mathvariant="bold">NCAP7</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>8</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="LAMDA" id="LAMDA"/>2: &#160;&#160;&#8194; LAMDA(<a class="arg" href="#NCAP7">NCAP7</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be set to the value of the <m:math><m:mi>j</m:mi></m:math>th member of the complete set of knots, <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>j</m:mi></m:msub></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:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:math>.</div><div class="paramtext"><i>Constraint</i>:
  

the <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;must be in nondecreasing order with <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCAP7"><m:mi mathcolor="#EE0000" mathvariant="bold">NCAP7</m:mi></m:maction><m:mo>-</m:mo><m:mn>3</m:mn></m:mrow></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mspace linebreak="newline"/> <m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>4</m:mn></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="C" id="C"/>3: &#160;&#160;&#8194; C(<a class="arg" href="#NCAP7">NCAP7</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the coefficient <m:math><m:msub><m:mi>c</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;of the B-spline <m:math><m:msub><m:mi>N</m:mi><m:mi>i</m:mi></m:msub><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, 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:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>3</m:mn></m:math>. The remaining elements of the array are not used.</div></dd><dt class="paramhead"><a name="X" id="X"/>4: &#160;&#160;&#8194; X &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the argument <m:math><m:mi>x</m:mi></m:math>&#160;at which the cubic spline is to be evaluated.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>4</m:mn></m:mfenced></m:mrow><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCAP7"><m:mi mathcolor="#EE0000" mathvariant="bold">NCAP7</m:mi></m:maction><m:mo>-</m:mo><m:mn>3</m:mn></m:mrow></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="S" id="S"/>5: &#160;&#160;&#8194; S &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the value of the spline, <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>6: &#160;&#160;&#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, if you are not familiar with this parameter, the recommended value is <m:math><m:mn>0</m:mn></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 mathvariant="bold">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">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 parameter <a class="arg" href="#X">X</a> does not satisfy <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>4</m:mn></m:mfenced></m:mrow><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCAP7"><m:mi mathcolor="#EE0000" mathvariant="bold">NCAP7</m:mi></m:maction><m:mo>-</m:mo><m:mn>3</m:mn></m:mrow></m:mfenced></m:mrow></m:math>.</div>
<div class="paramtext">In this case the value of <a class="arg" href="#S">S</a> is set arbitrarily to zero.</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"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCAP7"><m:mi mathcolor="#EE0000" mathvariant="bold">NCAP7</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>8</m:mn></m:math>, i.e., the number of interior knots is negative.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">The computed value of <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;has negligible error in most practical situations.  Specifically, this value has an <b>absolute</b> error bounded in modulus by <m:math><m:mn>18</m:mn><m:mo>&#215;</m:mo><m:msub><m:mi>c</m:mi><m:mi mathvariant="normal">max</m:mi></m:msub><m:mo>&#215;</m:mo><m:mi mathvariant="bold-italic">machine&#160;precision</m:mi></m:math>, where <m:math><m:msub><m:mi>c</m:mi><m:mi mathvariant="normal">max</m:mi></m:msub></m:math>&#160;is the largest in modulus of <m:math><m:msub><m:mi>c</m:mi><m:mi>j</m:mi></m:msub><m:mo>,</m:mo><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>,</m:mo><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>2</m:mn></m:mrow></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>3</m:mn></m:mrow></m:msub></m:math>, and <m:math><m:mi>j</m:mi></m:math>&#160;is an integer such that <m:math><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>3</m:mn></m:mrow></m:msub><m:mo>&#8804;</m:mo><m:mi>x</m:mi><m:mo>&#8804;</m:mo><m:msub><m:mi>&#955;</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:msub></m:math>.  If <m:math><m:msub><m:mi>c</m:mi><m:mi>j</m:mi></m:msub><m:mo>,</m:mo><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>,</m:mo><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>2</m:mn></m:mrow></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>c</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>3</m:mn></m:mrow></m:msub></m:math>&#160;are all of the same sign, then the computed value of <m:math><m:mi>s</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;has a <b>relative</b> error not exceeding <m:math><m:mn>20</m:mn><m:mo>&#215;</m:mo><m:mi mathvariant="bold-italic">machine&#160;precision</m:mi></m:math>&#160;in modulus.  For further details see <a class="ref" href="#ref068">Cox (1978)</a>.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The time taken is approximately <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#C"><m:mi mathcolor="#EE0000" mathvariant="bold">C</m:mi></m:maction><m:mo>&#215;</m:mo><m:mfenced separators=""><m:mn>1</m:mn><m:mo>+</m:mo><m:mn>0.1</m:mn><m:mo>&#215;</m:mo><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:mfenced></m:mrow></m:mfenced></m:math>&#160;seconds, where <a class="arg" href="#C">C</a> is a machine-dependent constant.</div><div class="paramtext"><b>Note:</b>&#160; the routine does not test all the conditions on the knots given in the description of <a class="arg" href="#LAMDA">LAMDA</a> in <a class="sec" href="#parameters">Section 5</a>, since to do this would result in a computation time approximately linear in <m:math><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:math>&#160;instead of <m:math><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>7</m:mn></m:mfenced></m:mrow></m:math>.  All the conditions are tested in <a class="rout" href="../E02/e02baf.xml">E02BAF</a>, however.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">Evaluate at nine equally-spaced points in the interval <m:math><m:mn>1.0</m:mn><m:mo>&#8804;</m:mo><m:mi>x</m:mi><m:mo>&#8804;</m:mo><m:mn>9.0</m:mn></m:math>&#160;the cubic spline with (augmented) knots <m:math><m:mn>1.0</m:mn></m:math>, <m:math><m:mn>1.0</m:mn></m:math>, <m:math><m:mn>1.0</m:mn></m:math>, <m:math><m:mn>1.0</m:mn></m:math>, <m:math><m:mn>3.0</m:mn></m:math>, <m:math><m:mn>6.0</m:mn></m:math>, <m:math><m:mn>8.0</m:mn></m:math>, <m:math><m:mn>9.0</m:mn></m:math>, <m:math><m:mn>9.0</m:mn></m:math>, <m:math><m:mn>9.0</m:mn></m:math>, <m:math><m:mn>9.0</m:mn></m:math>&#160;and normalized cubic B-spline coefficients <m:math><m:mn>1.0</m:mn></m:math>, <m:math><m:mn>2.0</m:mn></m:math>, <m:math><m:mn>4.0</m:mn></m:math>, <m:math><m:mn>7.0</m:mn></m:math>, <m:math><m:mn>6.0</m:mn></m:math>, <m:math><m:mn>4.0</m:mn></m:math>, <m:math><m:mn>3.0</m:mn></m:math>.</div><div class="paramtext">The example program is written in a general form that will enable a cubic spline with <m:math><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover></m:math>&#160;intervals, in its normalized cubic B-spline form, to be evaluated at <m:math><m:mi>m</m:mi></m:math>&#160;equally-spaced points in the interval <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>4</m:mn></m:mfenced></m:mrow><m:mo>&#8804;</m:mo><m:mi>x</m:mi><m:mo>&#8804;</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#LAMDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LAMDA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mover><m:mi>n</m:mi><m:mo>-</m:mo></m:mover><m:mo>+</m:mo><m:mn>4</m:mn></m:mrow></m:mfenced></m:mrow></m:math>.  The program is self-starting in that any number of datasets may be supplied.</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/e02bbfe.f">Program Text (e02bbfe.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<p><a class="verbatimref" href="../../examples/data/e02bbfe.d">Program&#160;Data (e02bbfe.d)</a></p><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/e02bbfe.r">Program Results (e02bbfe.r)</a></p><div class="figure"><a name="e02bbf-plot" id="e02bbf-plot"/><img src="../figures/e02bbf-plot.png" alt="Example Program Plot for e02bbf-plot"/></div>
<hr/><div><a class="rout" href="../../pdf/E02/e02bbf.pdf">E02BBF (PDF version)</a></div><div><a class="chap" href="e02conts.xml">E02 Chapter Contents</a></div><div><a class="chapint" href="e02intro.xml">E02 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>