42 return 3.14159265358979323846;
70 return 1.4142135623730950488016887242097;
76 return 2.71828182845904523536;
82 return 2.30258509299404568402;
88 return 0.43429448190325182765;
142 return 6.62606876e-34;
150 return 0.00000052e-34;
156 return 1.054571596e-34;
160 return 1.0e7 *
Hbar();
164 return 0.000000082e-34;
180 return 1.3806503e-23;
188 return 0.0000024e-23;
204 return 6.02214199e+23;
208 return 0.00000047e+23;
234 return (1000.0 *
R()) /
MWair();
240 return 0.577215664901532860606512090082402431042;
246 return 1.602176462e-19;
250 return 0.000000063e-19;
282 template <
typename T>
307 template <
typename T>
309 inline static T Min();
310 inline static T Max();
338 template <
typename Iterator> Iterator
LocMin(Iterator
first, Iterator last);
340 template <
typename Iterator> Iterator
LocMax(Iterator first, Iterator last);
345 template <
typename Iterator,
typename Element> Iterator
BinarySearch(Iterator first, Iterator last, Element value);
352 template <
typename Element,
typename Index>
354 template <
typename Iterator,
typename IndexIterator>
374 template <
typename T>
T *
Cross(
const T v1[3],
const T v2[3],
T out[3]);
380 template <
typename T>
inline T NormCross(
const T v1[3],
const T v2[3],
T out[3]);
428 template <
typename Iterator>
Double_t Mean(Iterator first, Iterator last);
429 template <
typename Iterator,
typename WeightIterator>
Double_t Mean(Iterator first, Iterator last, WeightIterator wfirst);
432 template <
typename Iterator>
Double_t GeomMean(Iterator first, Iterator last);
435 template <
typename Iterator>
Double_t RMS(Iterator first, Iterator last);
436 template <
typename Iterator,
typename WeightIterator>
Double_t RMS(Iterator first, Iterator last, WeightIterator wfirst);
439 template <
typename Iterator>
Double_t StdDev(Iterator first, Iterator last) {
return RMS<Iterator>(first,last); }
440 template <
typename Iterator,
typename WeightIterator>
Double_t StdDev(Iterator first, Iterator last, WeightIterator wfirst) {
return RMS<Iterator,WeightIterator>(first,last,wfirst); }
445 template <
class Element,
typename Size> Element
KOrdStat(
Size n,
const Element *a,
Size k,
Size *work = 0);
490 #if defined(R__WIN32) && !defined(__CINT__) 492 # define finite _finite 493 # define isnan _isnan 496 #if defined(R__AIX) || defined(R__SOLARIS_CC50) || \ 497 defined(R__HPUX11) || defined(R__GLIBC) || \ 498 (defined(R__MACOSX) ) 501 # ifdef R__SOLARIS_CC50 502 extern "C" {
int finite(
double); }
515 extern double sin(
double);
516 extern double cos(
double);
517 extern double tan(
double);
518 extern double sinh(
double);
519 extern double cosh(
double);
520 extern double tanh(
double);
521 extern double asin(
double);
522 extern double acos(
double);
523 extern double atan(
double);
524 extern double atan2(
double,
double);
525 extern double sqrt(
double);
526 extern double exp(
double);
527 extern double pow(
double,
double);
528 extern double log(
double);
529 extern double log10(
double);
531 # if !defined(finite) 532 extern int finite(
double);
535 extern int isnan(
double);
537 extern double ldexp(
double,
int);
538 extern double ceil(
double);
539 extern double floor(
double);
541 _CRTIMP
double ldexp(
double,
int);
542 _CRTIMP
double ceil(
double);
543 _CRTIMP
double floor(
double);
574 if (x > 1.)
return 0;
582 {
if (x != 0)
return atan2(y, x);
583 if (y == 0)
return 0;
584 if (y > 0)
return Pi()/2;
614 if ( i & 1 && x + 0.5 ==
T(i) ) i--;
617 if ( i & 1 && x - 0.5 ==
T(i) ) i++;
626 {
return ldexp(x, exp); }
638 {
return pow(x, y); }
656 #if defined(R__FAST_MATH) 662 const unsigned long long mask = 0x7FF0000000000000LL;
663 union {
unsigned long long l;
double d;}
v;
665 return (
v.l&mask)!=mask;
668 # if defined(R__HPUX11) 669 {
return isfinite(x); }
670 # elif defined(R__MACOSX) 673 {
return isfinite(x); }
676 {
return std::isfinite(x); }
684 #if defined(R__FAST_MATH) 690 const unsigned int mask = 0x7f800000;
691 union {
unsigned int l;
float d;}
v;
693 return (
v.l&mask)!=mask;
696 {
return std::isfinite(x); }
704 #if defined (R__FAST_MATH) 731 } ieee_double_shape_type;
733 #define EXTRACT_WORDS(ix0,ix1,d) \ 735 ieee_double_shape_type ew_u; \ 737 (ix0) = ew_u.parts.msw; \ 738 (ix1) = ew_u.parts.lsw; \ 745 EXTRACT_WORDS(hx, lx, x);
749 return (hx == 0x7ff00000) && (lx != 0);
755 } ieee_float_shape_type;
757 #define GET_FLOAT_WORD(i,d) \ 759 ieee_float_shape_type gf_u; \ 767 GET_FLOAT_WORD (wx, x);
769 return (
Bool_t)(wx > 0x7f800000);
772 #endif // End R__FAST_MATH 774 #if defined(R__FAST_MATH) 787 return std::numeric_limits<Double_t>::quiet_NaN();
794 return std::numeric_limits<Double_t>::signaling_NaN();
799 return std::numeric_limits<Double_t>::infinity();
805 return (std::numeric_limits<T>::min)();
811 return (std::numeric_limits<T>::max)();
829 template <
typename T>
833 return *std::min_element(a,a+n);
836 template <
typename T>
840 return *std::max_element(a,a+n);
843 template <
typename T>
853 if (n <= 0 || !a)
return -1;
865 template <
typename Iterator>
869 return std::min_element(first, last);
872 template <
typename T>
879 if (n <= 0 || !a)
return -1;
891 template <
typename Iterator>
897 return std::max_element(first, last);
905 template<
typename Index>
907 return *(fData + i1) > *(fData + i2);
918 template<
typename Index>
920 return *(fData + i1) < *(fData + i2);
926 template <
typename Iterator>
933 while ( first != last )
943 template <
typename Iterator,
typename WeightIterator>
953 while ( first != last ) {
955 ::Error(
"TMath::Mean",
"w[%d] = %.4e < 0 ?!",i,*w);
958 sum += (*w) * (*first);
965 ::Error(
"TMath::Mean",
"sum of weights == 0 ?!");
972 template <
typename T>
984 template <
typename Iterator>
992 while ( first != last ) {
993 if (*first == 0)
return 0.;
1003 template <
typename T>
1012 template <
typename Iterator>
1027 while ( first != last ) {
1029 tot += (x - mean)*(x - mean);
1037 template <
typename Iterator,
typename WeightIterator>
1050 while ( first != last ) {
1053 sumw2 += (*w) * (*w);
1054 tot += (*w) * (x - mean)*(x - mean);
1064 template <
typename T>
1074 template <
typename Iterator,
typename Element>
1085 pind = std::lower_bound(first, last, value);
1086 if ( (pind != last) && (*pind == value) )
1102 pind = std::lower_bound(array, array + n, value);
1103 if ( (pind != array + n) && (*pind == value) )
1104 return (pind - array);
1106 return ( pind - array - 1);
1118 pind = std::lower_bound(*array, *array + n, value);
1119 if ( (pind != *array + n) && (*pind == value) )
1120 return (pind - *array);
1122 return ( pind - *array - 1);
1125 template <
typename Iterator,
typename IndexIterator>
1138 IndexIterator cindex = index;
1139 for ( Iterator cfirst = first; cfirst != last; ++cfirst )
1162 for(
Index i = 0; i <
n; i++) { index[i] = i; }
1174 out[0] = v1[1] * v2[2] - v1[2] * v2[1];
1175 out[1] = v1[2] * v2[0] - v1[0] * v2[2];
1176 out[2] = v1[0] * v2[1] - v1[1] * v2[0];
1193 v1[0] = p2[0] - p1[0];
1194 v1[1] = p2[1] - p1[1];
1195 v1[2] = p2[2] - p1[2];
1197 v2[0] = p3[0] - p1[0];
1198 v2[1] = p3[1] - p1[1];
1199 v2[2] = p3[2] - p1[2];
1214 for (i=0; i<np; i++) {
1215 if ((y[i]<yp && y[j]>=yp) || (y[j]<yp && y[i]>=yp)) {
1216 if (x[i]+(yp-y[i])/(y[j]-y[i])*(x[j]-x[i])<xp) {
1217 oddNodes = !oddNodes;
1249 const Int_t kWorkMax = 100;
1251 if (n <= 0 || !a)
return 0;
1262 isAllocated =
kTRUE;
1269 for (
Int_t j = 0; j <
n; j++) {
1271 ::Error(
"TMath::Median",
"w[%d] = %.4e < 0 ?!",j,w[j]);
1272 if (isAllocated)
delete [] ind;
1284 for (jl = 0; jl <
n; jl++) {
1286 if (sum >= sumTot2)
break;
1291 for (jh = n-1; jh >= 0; jh--) {
1293 if (sum <= sumTot2)
break;
1296 median = 0.5*(a[ind[jl]]+a[ind[jh]]);
1315 template <
class Element,
typename Size>
1337 const Int_t kWorkMax = 100;
1345 Index workLocal[kWorkMax];
1353 isAllocated =
kTRUE;
1358 for (
Size ii=0; ii<
n; ii++) {
1366 if (ir == l+1 && a[ind[ir]]<a[ind[l]])
1367 {temp = ind[
l]; ind[
l]=ind[ir]; ind[ir]=temp;}
1368 Element tmp = a[ind[rk]];
1374 {temp = ind[
mid]; ind[
mid]=ind[l+1]; ind[l+1]=temp;}
1375 if (a[ind[l]]>a[ind[ir]])
1376 {temp = ind[
l]; ind[
l]=ind[ir]; ind[ir]=temp;}
1378 if (a[ind[l+1]]>a[ind[ir]])
1379 {temp=ind[l+1]; ind[l+1]=ind[ir]; ind[ir]=temp;}
1381 if (a[ind[l]]>a[ind[l+1]])
1382 {temp = ind[
l]; ind[
l]=ind[l+1]; ind[l+1]=temp;}
1388 do i++;
while (a[ind[i]]<a[arr]);
1389 do j--;
while (a[ind[j]]>a[arr]);
1391 {temp=ind[i]; ind[i]=ind[j]; ind[j]=temp;}
1395 if (j>=rk) ir = j-1;
Double_t BesselI(Int_t n, Double_t x)
Compute the Integer Order Modified Bessel function I_n(x) for n=0,1,2,...
constexpr Double_t QeUncertainty()
Double_t FDist(Double_t F, Double_t N, Double_t M)
Computes the density function of F-distribution (probability function, integral of density...
Double_t Landau(Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
The LANDAU function.
Double_t ErfInverse(Double_t x)
returns the inverse error function x must be <-1<x<1
static long int sum(long int i)
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
Calculate a Breit Wigner function with mean and gamma.
Double_t FDistI(Double_t F, Double_t N, Double_t M)
Calculates the cumulative distribution function of F-distribution, this function occurs in the statis...
Double_t PoissonI(Double_t x, Double_t par)
compute the Poisson distribution function for (x,par) This is a non-smooth function.
Double_t Floor(Double_t x)
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t mid
Long64_t LocMax(Long64_t n, const T *a)
bool operator()(Index i1, Index i2)
static double p3(double t, double a, double b, double c, double d)
Namespace for new ROOT classes and functions.
constexpr Double_t Sqrt2()
Double_t KolmogorovProb(Double_t z)
Calculates the Kolmogorov distribution function,.
constexpr Double_t Hcgs()
constexpr Double_t TwoPi()
Double_t LaplaceDistI(Double_t x, Double_t alpha=0, Double_t beta=1)
Computes the distribution function of Laplace distribution at point x, with location parameter alpha ...
Double_t StudentQuantile(Double_t p, Double_t ndf, Bool_t lower_tail=kTRUE)
Computes quantiles of the Student's t-distribution 1st argument is the probability, at which the quantile is computed 2nd argument - the number of degrees of freedom of the Student distribution When the 3rd argument lower_tail is kTRUE (default)- the algorithm returns such x0, that P(x < x0)=p upper tail (lower_tail is kFALSE)- the algorithm returns such x0, that P(x > x0)=p the algorithm was taken from G.W.Hill, "Algorithm 396, Student's t-quantiles" "Communications of the ACM", 13(10), October 1970.
Double_t NormQuantile(Double_t p)
Computes quantiles for standard normal distribution N(0, 1) at probability p ALGORITHM AS241 APPL...
Double_t BetaDist(Double_t x, Double_t p, Double_t q)
Computes the probability density function of the Beta distribution (the distribution function is comp...
Double_t LaplaceDist(Double_t x, Double_t alpha=0, Double_t beta=1)
Computes the probability density function of Laplace distribution at point x, with location parameter...
constexpr Double_t Rgair()
Double_t Log2(Double_t x)
Double_t StruveH1(Double_t x)
Struve Functions of Order 1.
constexpr Double_t SigmaUncertainty()
void BubbleHigh(Int_t Narr, Double_t *arr1, Int_t *arr2)
Bubble sort variant to obtain the order of an array's elements into an index in order to do more usef...
Int_t FloorNint(Double_t x)
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
constexpr Double_t InvPi()
Double_t GeomMean(Long64_t n, const T *a)
Double_t BesselJ1(Double_t x)
Returns the Bessel function J1(x) for any real x.
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Double_t StudentI(Double_t T, Double_t ndf)
Calculates the cumulative distribution function of Student's t-distribution second parameter stands f...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
double beta(double x, double y)
Calculates the beta function.
Double_t Ldexp(Double_t x, Int_t exp)
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
constexpr Double_t Ln10()
constexpr Double_t Hbarcgs()
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
T NormCross(const T v1[3], const T v2[3], T out[3])
Double_t BesselY1(Double_t x)
Returns the Bessel function Y1(x) for positive x.
Double_t ChisquareQuantile(Double_t p, Double_t ndf)
Evaluate the quantiles of the chi-squared probability distribution function.
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities Parameters: x -the data sample n ...
Double_t Log10(Double_t x)
Double_t BesselI1(Double_t x)
Compute the modified Bessel function I_1(x) for any real x.
static double p2(double t, double a, double b, double c)
Double_t Freq(Double_t x)
Computation of the normal frequency function freq(x).
constexpr Double_t GhbarCUncertainty()
constexpr Double_t HCcgs()
double pow(double, double)
bool operator()(Index i1, Index i2)
constexpr Double_t DegToRad()
constexpr Double_t MWair()
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
constexpr Double_t Ccgs()
constexpr Double_t PiOver4()
Double_t ATan2(Double_t, Double_t)
Bool_t IsInside(T xp, T yp, Int_t np, T *x, T *y)
void BubbleLow(Int_t Narr, Double_t *arr1, Int_t *arr2)
Opposite ordering of the array arr2[] to that of BubbleHigh.
void Error(const char *location, const char *msgfmt,...)
Double_t Erfc(Double_t x)
Compute the complementary error function erfc(x).
constexpr Double_t GnUncertainty()
Double_t DiLog(Double_t x)
The DiLogarithm function Code translated by R.Brun from CERNLIB DILOG function C332.
Bool_t AreEqualAbs(Double_t af, Double_t bf, Double_t epsilon)
Bool_t AreEqualRel(Double_t af, Double_t bf, Double_t relPrec)
Double_t VavilovI(Double_t x, Double_t kappa, Double_t beta2)
Returns the value of the Vavilov distribution function Parameters: 1st - the point were the density f...
Double_t BesselY0(Double_t x)
Returns the Bessel function Y0(x) for positive x.
Double_t Erf(Double_t x)
Computation of the error function erf(x).
Double_t BetaDistI(Double_t x, Double_t p, Double_t q)
Computes the distribution function of the Beta distribution.
constexpr Double_t NaUncertainty()
constexpr Double_t RUncertainty()
Double_t StruveL1(Double_t x)
Modified Struve Function of Order 1.
Double_t Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
Computation of Voigt function (normalised).
Bool_t Permute(Int_t n, Int_t *a)
Simple recursive algorithm to find the permutations of n natural numbers, not necessarily all distinc...
Double_t StruveL0(Double_t x)
Modified Struve Function of Order 0.
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Double_t KolmogorovTest(Int_t na, const Double_t *a, Int_t nb, const Double_t *b, Option_t *option)
Statistical test whether two one-dimensional sets of points are compatible with coming from the same ...
Double_t Binomial(Int_t n, Int_t k)
Calculate the binomial coefficient n over k.
Double_t LandauI(Double_t x)
Returns the value of the Landau distribution function at point x.
Double_t BesselJ0(Double_t x)
Returns the Bessel function J0(x) for any real x.
static double p1(double t, double a, double b)
Double_t ErfcInverse(Double_t x)
T * Cross(const T v1[3], const T v2[3], T out[3])
ULong_t Hash(const void *txt, Int_t ntxt)
Calculates hash index from any char string.
constexpr Double_t HUncertainty()
constexpr Double_t GUncertainty()
Double_t Poisson(Double_t x, Double_t par)
Compute the Poisson distribution function for (x,par) The Poisson PDF is implemented by means of Eule...
Double_t Student(Double_t T, Double_t ndf)
Computes density function for Student's t- distribution (the probability function (integral of densit...
Double_t Beta(Double_t p, Double_t q)
Calculates Beta-function Gamma(p)*Gamma(q)/Gamma(p+q).
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
Double_t BesselI0(Double_t x)
Compute the modified Bessel function I_0(x) for any real x.
Double_t BesselK(Int_t n, Double_t x)
Compute the Integer Order Modified Bessel function K_n(x) for n=0,1,2,...
constexpr Double_t HbarUncertainty()
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=0)
RooCmdArg Index(RooCategory &icat)
Double_t StruveH0(Double_t x)
Struve Functions of Order 0.
double atan2(double, double)
Double_t Median(Long64_t n, const T *a, const Double_t *w=0, Long64_t *work=0)
T MaxElement(Long64_t n, const T *a)
Double_t Hypot(Double_t x, Double_t y)
constexpr Double_t Hbar()
Namespace for new Math classes and functions.
Double_t BesselK0(Double_t x)
Compute the modified Bessel function K_0(x) for positive real x.
Double_t BinomialI(Double_t p, Int_t n, Int_t k)
Suppose an event occurs with probability p per trial Then the probability P of its occurring k or mor...
constexpr Double_t EulerGamma()
you should not use this method at all Int_t Int_t z
constexpr Double_t Kcgs()
constexpr Double_t RadToDeg()
constexpr Double_t CUncertainty()
Double_t BetaCf(Double_t x, Double_t a, Double_t b)
Continued fraction evaluation by modified Lentz's method used in calculation of incomplete Beta funct...
Element KOrdStat(Size n, const Element *a, Size k, Size *work=0)
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
Computes the density function of Gamma distribution at point x.
Double_t Factorial(Int_t i)
Compute factorial(n).
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Double_t Ceil(Double_t x)
constexpr Double_t LogE()
Double_t BesselK1(Double_t x)
Compute the modified Bessel function K_1(x) for positive real x.
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
constexpr Double_t Gcgs()
Double_t LogNormal(Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
Computes the density of LogNormal distribution at point x.
constexpr Double_t Sigma()
constexpr Double_t GhbarC()
Bool_t RootsCubic(const Double_t coef[4], Double_t &a, Double_t &b, Double_t &c)
Calculates roots of polynomial of 3rd order a*x^3 + b*x^2 + c*x + d, where a == coef[3], b == coef[2], c == coef[1], d == coef[0] coef[3] must be different from 0 If the boolean returned by the method is false: ==> there are 3 real roots a,b,c If the boolean returned by the method is true: ==> there is one real root a and 2 complex conjugates roots (b+i*c,b-i*c) Author: Francois-Xavier Gentit.
def normal(shape, name=None)
Double_t Sqrt(Double_t x)
Double_t BetaIncomplete(Double_t x, Double_t a, Double_t b)
Calculates the incomplete Beta-function.
Long64_t LocMin(Long64_t n, const T *a)
Double_t CauchyDist(Double_t x, Double_t t=0, Double_t s=1)
Computes the density of Cauchy distribution at point x by default, standard Cauchy distribution is us...
double norm(double *x, double *p)
Int_t CeilNint(Double_t x)
constexpr Double_t PiOver2()
Long64_t BinarySearch(Long64_t n, const T *array, T value)
double ldexp(double, int)
void SortItr(Iterator first, Iterator last, IndexIterator index, Bool_t down=kTRUE)
Double_t Vavilov(Double_t x, Double_t kappa, Double_t beta2)
Returns the value of the Vavilov density function Parameters: 1st - the point were the density functi...
constexpr Double_t KUncertainty()
T MinElement(Long64_t n, const T *a)