lines 8-141 of file: include/cppad/utility/romberg_one.hpp

{xrst_begin RombergOne}
{xrst_spell
   test test
}

One DimensionalRomberg Integration
##################################

Syntax
******

   # ``include <cppad/utility/romberg_one.hpp>``

*r* = ``RombergOne`` ( *F* , *a* , *b* , *n* , *e* )

Description
***********
Returns the Romberg integration estimate
:math:`r` for a one dimensional integral

.. math::

   r = \int_a^b F(x) {\bf d} x + O \left[ (b - a) / 2^{n-1} \right]^{2(p+1)}

Include
*******
The file ``cppad/utility/romberg_one.hpp``
is included by ``cppad/cppad.hpp``
but it can also be included separately with out the rest of
the ``CppAD`` routines.

r
*
The return value *r* has prototype

   *Float* *r*

It is the estimate computed by ``RombergOne`` for the integral above.

F
*
The object *F* can be of any type, but it must support
the operation

   *F* ( *x* )

The argument *x* to *F* has prototype

   ``const`` *Float* & *x*

The return value of *F* is a *Float* object
(see description of :ref:`RombergOne@Float` below).

a
*
The argument *a* has prototype

   ``const`` *Float* & *a*

It specifies the lower limit for the integration.

b
*
The argument *b* has prototype

   ``const`` *Float* & *b*

It specifies the upper limit for the integration.

n
*
The argument *n* has prototype

   ``size_t`` *n*

A total number of :math:`2^{n-1} + 1` evaluations of *F* ( *x* )
are used to estimate the integral.

p
*
The argument *p* has prototype

   ``size_t`` *p*

It must be less than or equal :math:`n`
and determines the accuracy order in the approximation for the integral
that is returned by ``RombergOne`` .
To be specific

.. math::

   r = \int_a^b F(x) {\bf d} x + O \left[ (b - a) / 2^{n-1} \right]^{2(p+1)}

e
*
The argument *e* has prototype

   *Float* & *e*

The input value of *e* does not matter
and its output value is an approximation for the error in
the integral estimates; i.e.,

.. math::

   e \approx \left| r - \int_a^b F(x) {\bf d} x \right|

Float
*****
The type *Float* must satisfy the conditions
for a :ref:`NumericType-name` type.
The routine :ref:`CheckNumericType-name` will generate an error message
if this is not the case.
In addition, if *x* and *y* are *Float* objects,

   *x* < *y*

returns the ``bool`` value true if *x* is less than
*y* and false otherwise.
{xrst_toc_hidden
   example/utility/romberg_one.cpp
}
Example
*******
The file
:ref:`romberg_one.cpp-name`
contains an example and test a test of using this routine.

Source Code
***********
The source code for this routine is in the file
``cppad/romberg_one.hpp`` .

{xrst_end RombergOne}
