Prev Next

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
One DimensionalRomberg Integration

# include <cppad/utility/romberg_one.hpp>
r = RombergOne(Fabne)

Returns the Romberg integration estimate @(@ r @)@ for a one dimensional integral @[@ r = \int_a^b F(x) {\bf d} x + O \left[ (b - a) / 2^{n-1} \right]^{2(p+1)} @]@

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

The return value r has prototype
Float r
It is the estimate computed by RombergOne for the integral above.

The object F can be of any type, but it must support the operation
The argument x to F has prototype
Float &x
The return value of F is a Float object (see description of Float below).

The argument a has prototype
Float &a
It specifies the lower limit for the integration.

The argument b has prototype
Float &b
It specifies the upper limit for the integration.

The argument n has prototype
A total number of @(@ 2^{n-1} + 1 @)@ evaluations of F(x) are used to estimate the integral.

The argument p has prototype
It must be less than or equal @(@ n @)@ and determines the accuracy order in the approximation for the integral that is returned by RombergOne. To be specific @[@ r = \int_a^b F(x) {\bf d} x + O \left[ (b - a) / 2^{n-1} \right]^{2(p+1)} @]@

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., @[@ e \approx \left| r - \int_a^b F(x) {\bf d} x \right| @]@

The type Float must satisfy the conditions for a NumericType type. The routine CheckNumericType 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.

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

Source Code
The source code for this routine is in the file cppad/romberg_one.hpp.
Input File: cppad/utility/romberg_one.hpp