<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>One DimensionalRomberg Integration</title>
<meta name="description" id="description" content="One DimensionalRomberg Integration"/>
<meta name="keywords" id="keywords" content=" integrate Romberg Integrate "/>
<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='_rombergone_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="lu_invert.hpp.xml" target="_top">Prev</a>
</td><td><a href="romberg_one.cpp.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>CppAD</option>
<option>library</option>
<option>RombergOne</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>CppAD-&gt;</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-&gt;</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>RombergOne-&gt;</option>
<option>romberg_one.cpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Description</option>
<option>Include</option>
<option>r</option>
<option>F</option>
<option>a</option>
<option>b</option>
<option>n</option>
<option>p</option>
<option>e</option>
<option>Float</option>
<option>Example</option>
<option>Source Code</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>One DimensionalRomberg Integration</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<code><font color="blue"><br/>
# include &lt;cppad/romberg_one.hpp&gt;</font></code>
<code><span style='white-space: nowrap'><br/>
</span></code>
<code><i><font color="black"><span style='white-space: nowrap'>r</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;RombergOne(</span></font><i><font color="black"><span style='white-space: nowrap'>F</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>e</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/>
Returns the Romberg integration estimate

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>r</mi>
</mrow></math>

 for a one dimensional integral

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mi mathvariant='italic'>r</mi>
<mo stretchy="false">=</mo>
<msubsup><mo stretchy="false">&#x0222B;</mo>
<mi mathvariant='italic'>a</mi>
<mi mathvariant='italic'>b</mi>
</msubsup>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
<mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>d</mi>
</mstyle></mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>O</mi>
<msup><mrow><mo stretchy="true">[</mo><mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>b</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>a</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<msup><mn>2</mn>
<mrow><mi mathvariant='italic'>n</mi>
<mn>-1</mn>
</mrow>
</msup>
</mrow><mo stretchy="true">]</mo></mrow>
<mrow><mn>2</mn>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>p</mi>
<mo stretchy="false">+</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

<br/>
<b><big><a name="Include" id="Include">Include</a></big></b>
<br/>
The file <code><font color="blue">cppad/romberg_one.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="r" id="r">r</a></big></b>
<br/>
The return value 
<code><i><font color="black"><span style='white-space: nowrap'>r</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>r</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It is the estimate computed by <code><font color="blue">RombergOne</font></code> for the integral above.

<br/>
<br/>
<b><big><a name="F" id="F">F</a></big></b>
<br/>
The object 
<code><i><font color="black"><span style='white-space: nowrap'>F</span></font></i></code>
 can be of any type, but it must support 
the operation

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>F</span></font></i><font color="blue"><span style='white-space: nowrap'>(</span></font><i><font color="black"><span style='white-space: nowrap'>x</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'>x</span></font></i></code>
 to 
<code><i><font color="black"><span style='white-space: nowrap'>F</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The return value of 
<code><i><font color="black"><span style='white-space: nowrap'>F</span></font></i></code>
 is a 
<code><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i></code>
 object
(see description of <a href="rombergone.xml#Float" target="_top"><span style='white-space: nowrap'>Float</span></a>
 below). 

<br/>
<br/>
<b><big><a name="a" id="a">a</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>a</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>a</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the lower limit for the integration.

<br/>
<br/>
<b><big><a name="b" id="b">b</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It specifies the upper limit for the integration.

<br/>
<br/>
<b><big><a name="n" id="n">n</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>n</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
A total number of 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<msup><mn>2</mn>
<mrow><mi mathvariant='italic'>n</mi>
<mn>-1</mn>
</mrow>
</msup>
<mo stretchy="false">+</mo>
<mn>1</mn>
</mrow></math>

 evaluations of 
<code><i><font color="black"><span style='white-space: nowrap'>F</span></font></i><font color="blue"><span style='white-space: nowrap'>(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>

are used to estimate the integral.

<br/>
<br/>
<b><big><a name="p" id="p">p</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>p</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;size_t&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>p</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It must be less than or equal 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>n</mi>
</mrow></math>


and determines the accuracy order in the approximation for the integral
that is returned by <code><font color="blue">RombergOne</font></code>. 
To be specific

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mi mathvariant='italic'>r</mi>
<mo stretchy="false">=</mo>
<msubsup><mo stretchy="false">&#x0222B;</mo>
<mi mathvariant='italic'>a</mi>
<mi mathvariant='italic'>b</mi>
</msubsup>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
<mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>d</mi>
</mstyle></mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>O</mi>
<msup><mrow><mo stretchy="true">[</mo><mrow><mo stretchy="false">(</mo>
<mi mathvariant='italic'>b</mi>
<mo stretchy="false">-</mo>
<mi mathvariant='italic'>a</mi>
<mo stretchy="false">)</mo>
<mo stretchy="false">/</mo>
<msup><mn>2</mn>
<mrow><mi mathvariant='italic'>n</mi>
<mn>-1</mn>
</mrow>
</msup>
</mrow><mo stretchy="true">]</mo></mrow>
<mrow><mn>2</mn>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>p</mi>
<mo stretchy="false">+</mo>
<mn>1</mn>
<mo stretchy="false">)</mo>
</mrow>
</msup>
</mrow></math>

<br/>
<b><big><a name="e" id="e">e</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>e</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>e</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
The input value of 
<code><i><font color="black"><span style='white-space: nowrap'>e</span></font></i></code>
 does not matter
and its output value is an approximation for the error in 
the integral estimates; i.e.,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mi mathvariant='italic'>e</mi>
<mo stretchy="false">&#x02248;</mo>
<mrow><mo stretchy="true">|</mo><mrow><mi mathvariant='italic'>r</mi>
<mo stretchy="false">-</mo>
<msubsup><mo stretchy="false">&#x0222B;</mo>
<mi mathvariant='italic'>a</mi>
<mi mathvariant='italic'>b</mi>
</msubsup>
<mi mathvariant='italic'>F</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
<mrow><mstyle mathvariant='bold'><mi mathvariant='bold'>d</mi>
</mstyle></mrow>
<mi mathvariant='italic'>x</mi>
</mrow><mo stretchy="true">|</mo></mrow>
</mrow></math>

<br/>
<b><big><a name="Float" id="Float">Float</a></big></b>
<br/>
The type 
<code><i><font color="black"><span style='white-space: nowrap'>Float</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, if 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
 and 
<code><i><font color="black"><span style='white-space: nowrap'>y</span></font></i></code>
 are 
<code><i><font color="black"><span style='white-space: nowrap'>Float</span></font></i></code>
 objects,

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&lt;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>y</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
returns the <code><font color="blue">bool</font></code> value true if 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
 is less than 

<code><i><font color="black"><span style='white-space: nowrap'>y</span></font></i></code>
 and false otherwise.


<br/>
<br/>
<b><big><a name="Example" id="Example">Example</a></big></b>

<br/>
The file
<a href="romberg_one.cpp.xml" target="_top"><span style='white-space: nowrap'>romberg_one.cpp</span></a>

contains an example and test a test of using this routine.
It returns true if it succeeds and false otherwise.

<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/romberg_one.hpp</font></code>.


<hr/>Input File: cppad/romberg_one.hpp

</body>
</html>
