ROOT
6.07/01
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 43 of file GaussIntegrator.h.
Public Member Functions | |
virtual | ~GaussIntegrator () |
Destructor. More... | |
GaussIntegrator (double absTol=-1, double relTol=-1) | |
Default Constructor. More... | |
void | AbsValue (bool flag) |
Static function: set the fgAbsValue flag. More... | |
virtual void | SetRelTolerance (double eps) |
Set the desired relative Error. More... | |
virtual void | SetAbsTolerance (double eps) |
This method is not implemented. More... | |
double | Result () const |
Returns the result of the last Integral calculation. More... | |
double | Error () const |
Return the estimate of the absolute Error of the last Integral calculation. More... | |
int | Status () const |
return the status of the last integration - 0 in case of success More... | |
double | Integral (double a, double b) |
Returns Integral of function between a and b. More... | |
double | Integral () |
Returns Integral of function on an infinite interval. More... | |
double | IntegralUp (double a) |
Returns Integral of function on an upper semi-infinite interval. More... | |
double | IntegralLow (double b) |
Returns Integral of function on a lower semi-infinite interval. More... | |
void | SetFunction (const IGenFunction &) |
Set integration function (flag control if function must be copied inside). More... | |
double | Integral (const std::vector< double > &pts) |
This method is not implemented. More... | |
double | IntegralCauchy (double a, double b, double c) |
This method is not implemented. More... | |
virtual ROOT::Math::IntegratorOneDimOptions | Options () const |
get the option used for the integration 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... | |
Public Member Functions inherited from ROOT::Math::VirtualIntegratorOneDim | |
virtual | ~VirtualIntegratorOneDim () |
destructor: no operation More... | |
virtual ROOT::Math::IntegrationOneDim::Type | Type () const |
Public Member Functions inherited from ROOT::Math::VirtualIntegrator | |
virtual | ~VirtualIntegrator () |
virtual int | NEval () const |
return number of function evaluations in calculating the integral (if integrator do not implement this function returns -1) More... | |
Protected Attributes | |
double | fEpsRel |
double | fEpsAbs |
bool | fUsedOnce |
double | fLastResult |
double | fLastError |
const IGenFunction * | fFunction |
Static Protected Attributes | |
static bool | fgAbsValue = false |
Private Member Functions | |
virtual double | DoIntegral (double a, double b, const IGenFunction *func) |
Integration surrugate method. More... | |
#include <Math/GaussIntegrator.h>
|
virtual |
Destructor.
Definition at line 43 of file GaussIntegrator.cxx.
Default Constructor.
If the tolerance are not given, use default values specified in ROOT::Math::IntegratorOneDimOptions
Definition at line 24 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 48 of file GaussIntegrator.cxx.
|
privatevirtual |
Integration surrugate 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 70 of file GaussIntegrator.cxx.
Referenced by Integral(), IntegralLow(), and IntegralUp().
|
virtual |
Return the estimate of the absolute Error of the last Integral calculation.
Implements ROOT::Math::VirtualIntegrator.
Definition at line 175 of file GaussIntegrator.cxx.
Referenced by TF1::IntegralOneDim().
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 Begin_Latex I = #int^{b}_{a} f(x)dx End_Latex and define Begin_Latex r(a,b) = #frac{#||{g_{16}(a,b)-g_{8}(a,b)}}{1+#||{g_{16}(a,b)}} End_Latex Then, Begin_Latex G = #sum_{i=1}^{k}g_{16}(x_{i-1},x_{i}) End_Latex where, starting with x0 = A and finishing with xk = B, the subdivision points xi(i=1,2,...) are given by Begin_Latex x_{i} = x_{i-1} + #lambda(B-x_{i-1}) End_Latex Begin_Latex #lambda End_Latex is equal to the first member of the sequence 1,1/2,1/4,... for which r(xi-1, xi) < EPS. If, at any stage in the process of subdivision, the ratio Begin_Latex q = #||{#frac{x_{i}-x_{i-1}}{B-A}} End_Latex 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 Begin_Latex I_{abs} = #int^{B}_{A} #||{f(x)}dx End_Latex then the relation Begin_Latex #frac{#||{G-I}}{I_{abs}+k} < EPS End_Latex 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 51 of file GaussIntegrator.cxx.
Referenced by TF1::CentralMoment(), TF1::IntegralFast(), TF1::IntegralOneDim(), and TF1::Moment().
|
virtual |
Returns Integral of function on an infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral: Begin_Latex I = #int^{#infinity}_{-#infinity} f(x)dx End_Latex 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 55 of file GaussIntegrator.cxx.
This method is not implemented.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 189 of file GaussIntegrator.cxx.
This method is not implemented.
Implements ROOT::Math::VirtualIntegratorOneDim.
Definition at line 196 of file GaussIntegrator.cxx.
Returns Integral of function on a lower semi-infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral: Begin_Latex I = #int^{B}_{#infinity} f(x)dx End_Latex 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 65 of file GaussIntegrator.cxx.
Referenced by TF1::IntegralOneDim().
Returns Integral of function on an upper semi-infinite interval.
This function computes, to an attempted specified accuracy, the value of the integral: Begin_Latex I = #int^{#infinity}_{A} f(x)dx End_Latex 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 60 of file GaussIntegrator.cxx.
Referenced by TF1::IntegralOneDim().
|
virtual |
get the option used for the integration
Implements ROOT::Math::VirtualIntegratorOneDim.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 209 of file GaussIntegrator.cxx.
|
virtual |
Returns the result of the last Integral calculation.
Implements ROOT::Math::VirtualIntegrator.
Definition at line 165 of file GaussIntegrator.cxx.
This method is not implemented.
Implements ROOT::Math::VirtualIntegrator.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 71 of file GaussIntegrator.h.
Referenced by SetOptions().
|
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 181 of file GaussIntegrator.cxx.
Referenced by TF1::CentralMoment(), TF1::IntegralFast(), TF1::IntegralOneDim(), and TF1::Moment().
|
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 203 of file GaussIntegrator.cxx.
Set the desired relative Error.
Implements ROOT::Math::VirtualIntegrator.
Reimplemented in ROOT::Math::GaussLegendreIntegrator.
Definition at line 68 of file GaussIntegrator.h.
Referenced by TF1::CentralMoment(), TF1::Moment(), and SetOptions().
|
virtual |
return the status of the last integration - 0 in case of success
Implements ROOT::Math::VirtualIntegrator.
Definition at line 178 of file GaussIntegrator.cxx.
Referenced by TF1::IntegralOneDim().
|
protected |
Definition at line 229 of file GaussIntegrator.h.
Referenced by DoIntegral(), GaussIntegrator(), Options(), and SetAbsTolerance().
|
protected |
Definition at line 228 of file GaussIntegrator.h.
Referenced by ROOT::Math::GaussLegendreIntegrator::CalcGaussLegendreSamplingPoints(), DoIntegral(), GaussIntegrator(), ROOT::Math::GaussLegendreIntegrator::Options(), Options(), ROOT::Math::GaussLegendreIntegrator::SetOptions(), ROOT::Math::GaussLegendreIntegrator::SetRelTolerance(), and SetRelTolerance().
|
protected |
Definition at line 233 of file GaussIntegrator.h.
Referenced by DoIntegral(), GaussIntegrator(), Integral(), IntegralLow(), IntegralUp(), and SetFunction().
|
staticprotected |
Definition at line 227 of file GaussIntegrator.h.
Referenced by AbsValue(), and DoIntegral().
|
protected |
Definition at line 232 of file GaussIntegrator.h.
Referenced by DoIntegral(), Error(), and GaussIntegrator().
|
protected |
Definition at line 231 of file GaussIntegrator.h.
Referenced by ROOT::Math::GaussLegendreIntegrator::DoIntegral(), DoIntegral(), GaussIntegrator(), and Result().
|
protected |
Definition at line 230 of file GaussIntegrator.h.
Referenced by ROOT::Math::GaussLegendreIntegrator::DoIntegral(), DoIntegral(), GaussIntegrator(), Result(), SetFunction(), and Status().