ROOT 6.18/05 Reference Guide |
User class for performing function integration.
It will use the Gauss Method for function integration in a given interval. This class is implemented from TF1::Integral().
Definition at line 39 of file GaussIntegrator.h.
Public Member Functions | |
GaussIntegrator (double absTol=-1, double relTol=-1) | |
Default Constructor. More... | |
virtual | ~GaussIntegrator () |
Destructor. More... | |
void | AbsValue (bool flag) |
Static function: set the fgAbsValue flag. More... | |
double | Error () const |
Return the estimate of the absolute Error of the last Integral calculation. More... | |
double | Integral () |
Returns Integral of function on an infinite interval. More... | |
double | Integral (const std::vector< double > &pts) |
This method is not implemented. More... | |
double | Integral (double a, double b) |
Returns Integral of function between a and b. More... | |
double | IntegralCauchy (double a, double b, double c) |
This method is not implemented. More... | |
double | IntegralLow (double b) |
Returns Integral of function on a lower semi-infinite interval. More... | |
double | IntegralUp (double a) |
Returns Integral of function on an upper semi-infinite interval. More... | |
virtual ROOT::Math::IntegratorOneDimOptions | Options () const |
get the option used for the integration More... | |
double | Result () const |
Returns the result of the last Integral calculation. More... | |
virtual void | SetAbsTolerance (double eps) |
This method is not implemented. More... | |
void | SetFunction (const IGenFunction &) |
Set integration function (flag control if function must be copied inside). More... | |
virtual void | SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt) |
set the options (should be re-implemented by derived classes -if more options than tolerance exist More... | |
virtual void | SetRelTolerance (double eps) |
Set the desired relative Error. More... | |
int | Status () const |
return the status of the last integration - 0 in case of success More... | |
Public Member Functions inherited from ROOT::Math::VirtualIntegratorOneDim | |
virtual | ~VirtualIntegratorOneDim () |
destructor: no operation More... | |
virtual double | Integral ()=0 |
evaluate un-defined integral (between -inf, + inf) More... | |
virtual double | Integral (const std::vector< double > &pts)=0 |
evaluate integral with singular points More... | |
virtual double | Integral (double a, double b)=0 |
evaluate integral More... | |
virtual double | IntegralCauchy (double a, double b, double c)=0 |
evaluate Cauchy integral More... | |
virtual double | IntegralLow (double b)=0 |
evaluate integral over the (-inf, b) More... | |
virtual double | IntegralUp (double a)=0 |
evaluate integral over the (a, +inf) More... | |
virtual ROOT::Math::IntegratorOneDimOptions | Options () const =0 |
get the option used for the integration must be implemented by derived class More... | |
virtual void | SetFunction (const IGenFunction &)=0 |
set integration function More... | |
virtual void | SetOptions (const ROOT::Math::IntegratorOneDimOptions &opt) |
set the options (should be re-implemented by derived classes -if more options than tolerance exist More... | |
virtual ROOT::Math::IntegrationOneDim::Type | Type () const |
Public Member Functions inherited from ROOT::Math::VirtualIntegrator | |
virtual | ~VirtualIntegrator () |
virtual double | Error () const =0 |
return the estimate of the absolute Error of the last Integral calculation More... | |
virtual int | NEval () const |
return number of function evaluations in calculating the integral (if integrator do not implement this function returns -1) More... | |
virtual double | Result () const =0 |
return the Result of the last Integral calculation More... | |
virtual void | SetAbsTolerance (double)=0 |
set the desired absolute Error More... | |
virtual void | SetRelTolerance (double)=0 |
set the desired relative Error More... | |
virtual int | Status () const =0 |
return the Error Status of the last Integral calculation More... | |
Protected Attributes | |
double | fEpsAbs |
double | fEpsRel |
const IGenFunction * | fFunction |
double | fLastError |
double | fLastResult |
bool | fUsedOnce |
Static Protected Attributes | |
static bool | fgAbsValue = false |
Private Member Functions | |
virtual double | DoIntegral (double a, double b, const IGenFunction *func) |
Integration surrogate method. More... | |
#include <Math/GaussIntegrator.h>
|
virtual |
Destructor.
Definition at line 44 of file GaussIntegrator.cxx.
ROOT::Math::GaussIntegrator::GaussIntegrator | ( | double | absTol = -1 , |
double | relTol = -1 |
||
) |
Default Constructor.
If the tolerance are not given, use default values specified in ROOT::Math::IntegratorOneDimOptions
Definition at line 25 of file GaussIntegrator.cxx.
void ROOT::Math::GaussIntegrator::AbsValue | ( | bool | flag | ) |
Static function: set the fgAbsValue flag.
By default TF1::Integral uses the original function value to compute the integral However, TF1::Moment, CentralMoment require to compute the integral using the absolute value of the function.
Definition at line 49 of file GaussIntegrator.cxx.
|
privatevirtual |
Integration surrogate method.
Return integral of passed function in interval [a,b] Derived class (like GaussLegendreIntegrator) can re-implement this method to modify to use an improved algorithm
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 71 of file GaussIntegrator.cxx.
|
virtual |
Return the estimate of the absolute Error of the last Integral calculation.
Implements ROOT::Math::VirtualIntegrator.
Definition at line 176 of file GaussIntegrator.cxx.
|
virtual |
Returns Integral of function on an infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral:
\[ I = \int^{\infty}_{-\infty} f(x)dx \]
Usage: In any arithmetic expression, this function has the approximate value of the integral I.
The integral is mapped onto [0,1] using a transformation then integral computation is surrogated to DoIntegral.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 56 of file GaussIntegrator.cxx.
|
virtual |
This method is not implemented.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 190 of file GaussIntegrator.cxx.
|
virtual |
Returns Integral of function between a and b.
Based on original CERNLIB routine DGAUSS by Sigfried Kolbig converted to C++ by Rene Brun
This function computes, to an attempted specified accuracy, the value of the integral.
Method: For any interval [a,b] we define g8(a,b) and g16(a,b) to be the 8-point and 16-point Gaussian quadrature approximations to
\[ I = \int^{b}_{a} f(x)dx \]
and define
\[ r(a,b) = \frac{\left|g_{16}(a,b)-g_{8}(a,b)\right|}{1+\left|g_{16}(a,b)\right|} \]
Then,
\[ G = \sum_{i=1}^{k}g_{16}(x_{i-1},x_{i}) \]
where, starting with \(x_{0} = A\) and finishing with \(x_{k} = B\), the subdivision points \(x_{i}(i=1,2,...)\) are given by
\[ x_{i} = x_{i-1} + \lambda(B-x_{i-1}) \]
\(\lambda\) is equal to the first member of the sequence 1,1/2,1/4,... for which \(r(x_{i-1}, x_{i}) < EPS\). If, at any stage in the process of subdivision, the ratio
\[ q = \left|\frac{x_{i}-x_{i-1}}{B-A}\right| \]
is so small that 1+0.005q is indistinguishable from 1 to machine accuracy, an error exit occurs with the function value set equal to zero.
Accuracy: The user provides absolute and relative error bounds (epsrel and epsabs) and the algorithm will stop when the estimated error is less than the epsabs OR is less than |I| * epsrel. Unless there is severe cancellation of positive and negative values of f(x) over the interval [A,B], the relative error may be considered as specifying a bound on the relative error of I in the case |I|>1, and a bound on the absolute error in the case |I|<1. More precisely, if k is the number of sub-intervals contributing to the approximation (see Method), and if
\[ I_{abs} = \int^{B}_{A} \left|f(x)\right|dx \]
then the relation
\[ \frac{\left|G-I\right|}{I_{abs}+k} < EPS \]
will nearly always be true, provided the routine terminates without printing an error message. For functions f having no singularities in the closed interval [A,B] the accuracy will usually be much higher than this.
Error handling: The requested accuracy cannot be obtained (see Method). The function value is set equal to zero.
Note 1: Values of the function f(x) at the interval end-points A and B are not required. The subprogram may therefore be used when these values are undefined
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 52 of file GaussIntegrator.cxx.
|
virtual |
This method is not implemented.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 197 of file GaussIntegrator.cxx.
|
virtual |
Returns Integral of function on a lower semi-infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral:
\[ I = \int^{B}_{-\infty} f(x)dx \]
Usage: In any arithmetic expression, this function has the approximate value of the integral I.
The integral is mapped onto [0,1] using a transformation then integral computation is surrogated to DoIntegral.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 66 of file GaussIntegrator.cxx.
|
virtual |
Returns Integral of function on an upper semi-infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral:
\[ I = \int^{\infty}_{A} f(x)dx \]
Usage: In any arithmetic expression, this function has the approximate value of the integral I.
The integral is mapped onto [0,1] using a transformation then integral computation is surrogated to DoIntegral.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 61 of file GaussIntegrator.cxx.
|
virtual |
get the option used for the integration
Implements ROOT::Math::VirtualIntegratorOneDim.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 210 of file GaussIntegrator.cxx.
|
virtual |
Returns the result of the last Integral calculation.
Implements ROOT::Math::VirtualIntegrator.
Definition at line 166 of file GaussIntegrator.cxx.
|
inlinevirtual |
This method is not implemented.
Implements ROOT::Math::VirtualIntegrator.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 67 of file GaussIntegrator.h.
|
virtual |
Set integration function (flag control if function must be copied inside).
@param f Function to be used in the calculations.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 182 of file GaussIntegrator.cxx.
|
virtual |
set the options (should be re-implemented by derived classes -if more options than tolerance exist
Reimplemented from ROOT::Math::VirtualIntegratorOneDim.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 204 of file GaussIntegrator.cxx.
|
inlinevirtual |
Set the desired relative Error.
Implements ROOT::Math::VirtualIntegrator.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 64 of file GaussIntegrator.h.
|
virtual |
return the status of the last integration - 0 in case of success
Implements ROOT::Math::VirtualIntegrator.
Definition at line 179 of file GaussIntegrator.cxx.
|
protected |
Definition at line 222 of file GaussIntegrator.h.
|
protected |
Definition at line 221 of file GaussIntegrator.h.
|
protected |
Definition at line 226 of file GaussIntegrator.h.
|
staticprotected |
Definition at line 220 of file GaussIntegrator.h.
|
protected |
Definition at line 225 of file GaussIntegrator.h.
|
protected |
Definition at line 224 of file GaussIntegrator.h.
|
protected |
Definition at line 223 of file GaussIntegrator.h.