36 MATH_WARN_MSG(
"ROOT::Math::GausIntegrator",
"Invalid tolerance given, use values of 1.E-9");
79 MATH_INFO_MSG(
"ROOT::Math::GausIntegratorOneDim",
"Invalid tolerance given - use default values");
85 const double kHF = 0.5;
86 const double kCST = 5./1000;
88 double x[12] = { 0.96028985649753623, 0.79666647741362674,
89 0.52553240991632899, 0.18343464249564980,
90 0.98940093499164993, 0.94457502307323258,
91 0.86563120238783174, 0.75540440835500303,
92 0.61787624440264375, 0.45801677765722739,
93 0.28160355077925891, 0.09501250983763744};
95 double w[12] = { 0.10122853629037626, 0.22238103445337447,
96 0.31370664587788729, 0.36268378337836198,
97 0.02715245941175409, 0.06225352393864789,
98 0.09515851168249278, 0.12462897125553387,
99 0.14959598881657673, 0.16915651939500254,
100 0.18260341504492359, 0.18945061045506850};
102 double h, aconst, bb, aa,
c1,
c2, u, s8, s16,
f1, f2;
108 MATH_ERROR_MSG(
"ROOT::Math::GausIntegratorOneDim",
"A function must be set first!");
114 if (
b ==
a)
return h;
115 aconst = kCST/std::abs(
b-
a);
127 f1 = (*function)(xx);
130 f2 = (*function) (xx);
132 s8 +=
w[i]*(
f1 + f2);
138 f1 = (*function) (xx);
141 f2 = (*function) (xx);
143 s16 +=
w[i]*(
f1 + f2);
147 double error = std::abs(s16-
c2*s8);
150 if(bb !=
b)
goto CASE1;
153 if(1. + aconst*std::abs(
c2) != 1)
goto CASE2;
155 MATH_WARN_MSGVAL(
"ROOT::Math::GausIntegrator",
"Failed to reach the desired tolerance ",maxtol);
171 MATH_ERROR_MSG(
"ROOT::Math::GaussIntegrator",
"You must calculate the result at least once!");
193 MATH_WARN_MSG(
"ROOT::Math::GaussIntegrator",
"This method is not implemented in this class !");
200 MATH_WARN_MSG(
"ROOT::Math::GaussIntegrator",
"This method is not implemented in this class !");
226 : fSign(
kPlus), fIntegrand(integrand), fBoundary(0.), fInfiniteInterval(true) {
230 : fSign(sign), fIntegrand(integrand), fBoundary(boundary), fInfiniteInterval(false) {
239 double mappedX = 1. /
x - 1.;
240 return (*
fIntegrand)(boundary + sign * mappedX) * std::pow(mappedX + 1., 2);;
#define MATH_INFO_MSG(loc, str)
Pre-processor macro to report messages which can be configured to use ROOT error or simply an std::io...
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_MSG(loc, str)
#define MATH_WARN_MSGVAL(loc, txt, x)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
void SetAbsTolerance(double tol)
non-static methods for setting options
double RelTolerance() const
absolute tolerance
void SetRelTolerance(double tol)
set the relative tolerance
double AbsTolerance() const
non-static methods for retrieving options
void SetWKSize(unsigned int size)
set workspace size
bool fUsedOnce
Bool value to check if the function was at least called once.
double Error() const override
Return the estimate of the absolute Error of the last Integral calculation.
double Integral() override
Returns Integral of function on an infinite interval.
double IntegralCauchy(double a, double b, double c) override
This method is not implemented.
~GaussIntegrator() override
Destructor.
double fLastResult
Result from the last estimation.
void SetRelTolerance(double eps) override
Set the desired relative Error.
void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt) override
set the options (should be re-implemented by derived classes -if more options than tolerance exist
double fLastError
Error from the last estimation.
virtual double DoIntegral(double a, double b, const IGenFunction *func)
Integration surrogate method.
double fEpsAbs
Absolute error.
void SetAbsTolerance(double eps) override
This method is not implemented.
ROOT::Math::IntegratorOneDimOptions Options() const override
get the option used for the integration
double IntegralUp(double a) override
Returns Integral of function on an upper semi-infinite interval.
static bool fgAbsValue
AbsValue used for the calculation of the integral.
double Result() const override
Returns the result of the last Integral calculation.
GaussIntegrator(double absTol=-1, double relTol=-1)
Default Constructor.
void SetFunction(const IGenFunction &) override
Set integration function (flag control if function must be copied inside).
double IntegralLow(double b) override
Returns Integral of function on a lower semi-infinite interval.
int Status() const override
return the status of the last integration - 0 in case of success
const IGenFunction * fFunction
Pointer to function used.
void AbsValue(bool flag)
Static function: set the fgAbsValue flag.
double fEpsRel
Relative error.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Numerical one dimensional integration options.
static double DefaultAbsTolerance()
static double DefaultRelTolerance()
void SetIntegrator(const char *name)
set 1D integrator name
void SetNPoints(unsigned int n)
Set number of points for active integration rule.
Namespace for new Math classes and functions.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.