Gaussian quadrature (CERNLIB) More...
#include <inte_gauss_cern.h>
For any interval
, we define
and
to be the 8- and 16-point Gaussian quadrature approximations to
and define
The function integ() returns
given by
where
and
and the subdivision points
are given by
where
is the first number in the sequence
for which
If, at any stage, the ratio
is so small so that
is indistinguishable from unity, then the accuracy is required is not reachable and the error handler is called.
Unless there is severe cancellation, inte::tol_rel may be considered as specifying a bound on the relative error of the integral in the case that
and an absolute error if
. More precisely, if
is the number of subintervals from above, and if
then
will nearly always be true when no error is returned. For functions with no singualarities in the interval, the accuracy will usually be higher than this.
If the desired accuracy is not achieved, the integration functions will call the error handler and return the best guess, unless inte::err_nonconv is false, in which case the error handler is not called.
This function is based on the CERNLIB routines GAUSS and DGAUSS which are documented at http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/d103/top.html
double and long double for the floating point type fp_t .cst? Definition at line 293 of file inte_gauss_cern.h.
Public Member Functions | |
| virtual int | integ_err (func_t &func, fp_t a, fp_t b, fp_t &res, fp_t &err) |
Integrate function func from a to b. | |
Public Member Functions inherited from o2scl::inte< funct, double > | |
| virtual double | integ (funct &func, double a, double b) |
Integrate function func from a to b. | |
| virtual int | integ_err (funct &func, double a, double b, double &res, double &err)=0 |
Integrate function func from a to b and place the result in res and the error in err. | |
| double | get_error () |
| Return the numerically estimated error in the result from the last call to integ() More... | |
| virtual const char * | type () |
| Return string denoting type ("inte") | |
Public Attributes | |
| const fp_t * | w |
| const fp_t * | x |
| weights_t | wgts |
Public Attributes inherited from o2scl::inte< funct, double > | |
| int | verbose |
| Verbosity. | |
| size_t | last_iter |
| The most recent number of iterations taken. | |
| double | tol_rel |
The maximum relative uncertainty in the value of the integral (default ) | |
| double | tol_abs |
The maximum absolute uncertainty in the value of the integral (default ) | |
| bool | err_nonconv |
| If true, call the error handler if the routine does not converge or reach the desired tolerance (default true) More... | |
Additional Inherited Members | |
Protected Attributes inherited from o2scl::inte< funct, double > | |
| double | interror |
| The uncertainty for the last integration computation. | |
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).