Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMath.h File Reference
#include "TMathBase.h"
#include "TError.h"
#include <algorithm>
#include <limits>
#include <cmath>
#include <cfloat>
Include dependency graph for TMath.h:

Classes

struct  TMath::Limits< T >
 

Namespaces

namespace  TMath
 TMath.
 

Functions

Double_t TMath::ACos (Double_t)
 Returns the principal value of the arc cosine of x, expressed in radians.
 
Double_t TMath::ACosH (Double_t)
 Returns the nonnegative area hyperbolic cosine of x.
 
Bool_t TMath::AreEqualAbs (Double_t af, Double_t bf, Double_t epsilon)
 Comparing floating points.
 
Bool_t TMath::AreEqualRel (Double_t af, Double_t bf, Double_t relPrec)
 Comparing floating points.
 
Double_t TMath::ASin (Double_t)
 Returns the principal value of the arc sine of x, expressed in radians.
 
Double_t TMath::ASinH (Double_t)
 Returns the area hyperbolic sine of x.
 
Double_t TMath::ATan (Double_t)
 Returns the principal value of the arc tangent of x, expressed in radians.
 
Double_t TMath::ATan2 (Double_t y, Double_t x)
 Returns the principal value of the arc tangent of y/x, expressed in radians.
 
Double_t TMath::ATanH (Double_t)
 Returns the area hyperbolic tangent of x.
 
Double_t TMath::BesselI (Int_t n, Double_t x)
 Computes the Integer Order Modified Bessel function I_n(x) for n=0,1,2,... and any real x.
 
Double_t TMath::BesselI0 (Double_t x)
 Integer order modified Bessel function K_n(x)
 
Double_t TMath::BesselI1 (Double_t x)
 Modified Bessel function K_0(x)
 
Double_t TMath::BesselJ0 (Double_t x)
 Modified Bessel function K_1(x)
 
Double_t TMath::BesselJ1 (Double_t x)
 Bessel function J0(x) for any real x.
 
Double_t TMath::BesselK (Int_t n, Double_t x)
 Integer order modified Bessel function I_n(x)
 
Double_t TMath::BesselK0 (Double_t x)
 Modified Bessel function I_0(x)
 
Double_t TMath::BesselK1 (Double_t x)
 Modified Bessel function I_1(x)
 
Double_t TMath::BesselY0 (Double_t x)
 Bessel function J1(x) for any real x.
 
Double_t TMath::BesselY1 (Double_t x)
 Bessel function Y0(x) for positive x.
 
Double_t TMath::Beta (Double_t p, Double_t q)
 Calculates Beta-function Gamma(p)*Gamma(q)/Gamma(p+q).
 
Double_t TMath::BetaCf (Double_t x, Double_t a, Double_t b)
 Continued fraction evaluation by modified Lentz's method used in calculation of incomplete Beta function.
 
Double_t TMath::BetaDist (Double_t x, Double_t p, Double_t q)
 Computes the probability density function of the Beta distribution (the distribution function is computed in BetaDistI).
 
Double_t TMath::BetaDistI (Double_t x, Double_t p, Double_t q)
 Computes the distribution function of the Beta distribution.
 
Double_t TMath::BetaIncomplete (Double_t x, Double_t a, Double_t b)
 Calculates the incomplete Beta-function.
 
Double_t TMath::Binomial (Int_t n, Int_t k)
 Calculates the binomial coefficient n over k.
 
Double_t TMath::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 more times in n trials is termed a cumulative binomial probability the formula is:
 
Double_t TMath::BreitWigner (Double_t x, Double_t mean=0, Double_t gamma=1)
 Calculates a Breit Wigner function with mean and gamma.
 
Double_t TMath::BreitWignerRelativistic (Double_t x, Double_t median=0, Double_t gamma=1)
 Calculates a Relativistic Breit Wigner function with median and gamma.
 
void TMath::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 useful things than the standard built in functions.
 
void TMath::BubbleLow (Int_t Narr, Double_t *arr1, Int_t *arr2)
 Opposite ordering of the array arr2[] to that of BubbleHigh.
 
constexpr Double_t TMath::C ()
 Velocity of light in \( m s^{-1} \).
 
Double_t TMath::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 used (t=0, s=1)
 
constexpr Double_t TMath::Ccgs ()
 \( cm s^{-1} \)
 
Double_t TMath::Ceil (Double_t x)
 Rounds x upward, returning the smallest integral value that is not less than x.
 
Int_t TMath::CeilNint (Double_t x)
 Returns the nearest integer of TMath::Ceil(x).
 
Double_t TMath::ChisquareQuantile (Double_t p, Double_t ndf)
 Evaluate the quantiles of the chi-squared probability distribution function.
 
Double_t TMath::Cos (Double_t)
 Returns the cosine of an angle of x radians.
 
Double_t TMath::CosH (Double_t)
 Returns the hyperbolic cosine of x.
 
template<typename T >
T * TMath::Cross (const T v1[3], const T v2[3], T out[3])
 Calculates the Cross Product of two vectors: out = [v1 x v2].
 
constexpr Double_t TMath::CUncertainty ()
 Speed of light uncertainty.
 
constexpr Double_t TMath::DegToRad ()
 Conversion from degree to radian: \( \frac{\pi}{180} \).
 
Double_t TMath::DiLog (Double_t x)
 Modified Struve functions of order 1.
 
constexpr Double_t TMath::E ()
 Base of natural log: \( e \).
 
Double_t TMath::Erf (Double_t x)
 Computation of the error function erf(x).
 
Double_t TMath::Erfc (Double_t x)
 Computes the complementary error function erfc(x).
 
Double_t TMath::ErfcInverse (Double_t x)
 Returns the inverse of the complementary error function.
 
Double_t TMath::ErfInverse (Double_t x)
 Returns the inverse error function.
 
constexpr Double_t TMath::EulerGamma ()
 Euler-Mascheroni Constant.
 
Double_t TMath::Exp (Double_t x)
 Returns the base-e exponential function of x, which is e raised to the power x.
 
Double_t TMath::Factorial (Int_t i)
 Computes factorial(n).
 
Double_t TMath::FDist (Double_t F, Double_t N, Double_t M)
 Computes the density function of F-distribution (probability function, integral of density, is computed in FDistI).
 
Double_t TMath::FDistI (Double_t F, Double_t N, Double_t M)
 Calculates the cumulative distribution function of F-distribution, this function occurs in the statistical test of whether two observed samples have the same variance.
 
Int_t TMath::Finite (Double_t x)
 Check if it is finite with a mask in order to be consistent in presence of fast math.
 
Int_t TMath::Finite (Float_t x)
 Check if it is finite with a mask in order to be consistent in presence of fast math.
 
Double_t TMath::Floor (Double_t x)
 Rounds x downward, returning the largest integral value that is not greater than x.
 
Int_t TMath::FloorNint (Double_t x)
 Returns the nearest integer of TMath::Floor(x).
 
Double_t TMath::Freq (Double_t x)
 Computation of the normal frequency function freq(x).
 
constexpr Double_t TMath::G ()
 Gravitational constant in: \( m^{3} kg^{-1} s^{-2} \).
 
Double_t TMath::Gamma (Double_t a, Double_t x)
 Computation of the normalized lower incomplete gamma function P(a,x) as defined in the Handbook of Mathematical Functions by Abramowitz and Stegun, formula 6.5.1 on page 260 .
 
Double_t TMath::Gamma (Double_t z)
 Computation of gamma(z) for all z.
 
Double_t TMath::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 TMath::Gaus (Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
 Calculates a gaussian function with mean and sigma.
 
constexpr Double_t TMath::Gcgs ()
 \( cm^{3} g^{-1} s^{-2} \)
 
template<typename Iterator >
Double_t TMath::GeomMean (Iterator first, Iterator last)
 Returns the geometric mean of an array defined by the iterators.
 
template<typename T >
Double_t TMath::GeomMean (Long64_t n, const T *a)
 Returns the geometric mean of an array a of size n.
 
constexpr Double_t TMath::GhbarC ()
 \( \frac{G}{\hbar C} \) in \( (GeV/c^{2})^{-2} \)
 
constexpr Double_t TMath::GhbarCUncertainty ()
 \( \frac{G}{\hbar C} \) uncertainty.
 
constexpr Double_t TMath::Gn ()
 Standard acceleration of gravity in \( m s^{-2} \).
 
constexpr Double_t TMath::GnUncertainty ()
 Standard acceleration of gravity uncertainty.
 
constexpr Double_t TMath::GUncertainty ()
 Gravitational constant uncertainty.
 
constexpr Double_t TMath::H ()
 Planck's constant in \( J s \): \( h \).
 
ULong_t TMath::Hash (const char *str)
 
ULong_t TMath::Hash (const void *txt, Int_t ntxt)
 Calculates hash index from any char string.
 
constexpr Double_t TMath::Hbar ()
 \( \hbar \) in \( J s \): \( \hbar = \frac{h}{2\pi} \)
 
constexpr Double_t TMath::Hbarcgs ()
 \( erg s \)
 
constexpr Double_t TMath::HbarUncertainty ()
 \( \hbar \) uncertainty.
 
constexpr Double_t TMath::HC ()
 \( hc \) in \( J m \)
 
constexpr Double_t TMath::HCcgs ()
 \( erg cm \)
 
constexpr Double_t TMath::Hcgs ()
 \( erg s \)
 
constexpr Double_t TMath::HUncertainty ()
 Planck's constant uncertainty.
 
Double_t TMath::Hypot (Double_t x, Double_t y)
 Returns sqrt(x*x + y*y)
 
Long_t TMath::Hypot (Long_t x, Long_t y)
 Returns sqrt(x*x + y*y)
 
Double_t TMath::Infinity ()
 Returns an infinity as defined by the IEEE standard.
 
constexpr Double_t TMath::InvPi ()
 \( \frac{1.}{\pi}\)
 
template<typename T >
Bool_t TMath::IsInside (T xp, T yp, Int_t np, T *x, T *y)
 Function which returns kTRUE if point xp,yp lies inside the polygon defined by the np points in arrays x and y, kFALSE otherwise.
 
Bool_t TMath::IsNaN (Double_t x)
 
Bool_t TMath::IsNaN (Float_t x)
 
constexpr Double_t TMath::K ()
 Boltzmann's constant in \( J K^{-1} \): \( k \).
 
constexpr Double_t TMath::Kcgs ()
 \( erg K^{-1} \)
 
Double_t TMath::KolmogorovProb (Double_t z)
 Calculates the Kolmogorov distribution function,.
 
Double_t TMath::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 parent distribution, using the Kolmogorov test.
 
template<class Element , typename Size >
Element TMath::KOrdStat (Size n, const Element *a, Size k, Size *work=0)
 Returns k_th order statistic of the array a of size n (k_th smallest element out of n elements).
 
constexpr Double_t TMath::KUncertainty ()
 Boltzmann's constant uncertainty.
 
Double_t TMath::Landau (Double_t x, Double_t mpv=0, Double_t sigma=1, Bool_t norm=kFALSE)
 The LANDAU function.
 
Double_t TMath::LandauI (Double_t x)
 Returns the value of the Landau distribution function at point x.
 
Double_t TMath::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 alpha and shape parameter beta.
 
Double_t TMath::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 and shape parameter beta.
 
Double_t TMath::Ldexp (Double_t x, Int_t exp)
 Returns the result of multiplying x (the significant) by 2 raised to the power of exp (the exponent).
 
constexpr Double_t TMath::Ln10 ()
 Natural log of 10 (to convert log to ln)
 
Double_t TMath::LnGamma (Double_t z)
 Computation of ln[gamma(z)] for all z.
 
template<typename Iterator >
Iterator TMath::LocMax (Iterator first, Iterator last)
 Returns index of array with the maximum element.
 
template<typename T >
Long64_t TMath::LocMax (Long64_t n, const T *a)
 Returns index of array with the maximum element.
 
template<typename Iterator >
Iterator TMath::LocMin (Iterator first, Iterator last)
 Returns index of array with the minimum element.
 
template<typename T >
Long64_t TMath::LocMin (Long64_t n, const T *a)
 Returns index of array with the minimum element.
 
Double_t TMath::Log (Double_t x)
 Returns the natural logarithm of x.
 
Double_t TMath::Log10 (Double_t x)
 Returns the common (base-10) logarithm of x.
 
Double_t TMath::Log2 (Double_t x)
 Returns the binary (base-2) logarithm of x.
 
constexpr Double_t TMath::LogE ()
 Base-10 log of e (to convert ln to log)
 
Double_t TMath::LogNormal (Double_t x, Double_t sigma, Double_t theta=0, Double_t m=1)
 Computes the density of LogNormal distribution at point x.
 
template<typename T >
TMath::MaxElement (Long64_t n, const T *a)
 Returns maximum of array a of length n.
 
template<typename Iterator >
Double_t TMath::Mean (Iterator first, Iterator last)
 Returns the weighted mean of an array defined by the iterators.
 
template<typename Iterator , typename WeightIterator >
Double_t TMath::Mean (Iterator first, Iterator last, WeightIterator wfirst)
 Returns the weighted mean of an array defined by the first and last iterators.
 
template<typename T >
Double_t TMath::Mean (Long64_t n, const T *a, const Double_t *w=nullptr)
 Returns the weighted mean of an array a with length n.
 
template<typename T >
Double_t TMath::Median (Long64_t n, const T *a, const Double_t *w=nullptr, Long64_t *work=nullptr)
 Same as RMS.
 
template<typename T >
TMath::MinElement (Long64_t n, const T *a)
 Returns minimum of array a of length n.
 
constexpr Double_t TMath::MWair ()
 Molecular weight of dry air 1976 US Standard Atmosphere in \( kg kmol^{-1} \) or \( gm mol^{-1} \)
 
constexpr Double_t TMath::Na ()
 Avogadro constant (Avogadro's Number) in \( mol^{-1} \).
 
constexpr Double_t TMath::NaUncertainty ()
 Avogadro constant (Avogadro's Number) uncertainty.
 
template<typename T >
Int_t TMath::Nint (T x)
 Round to nearest integer. Rounds half integers to the nearest even integer.
 
template<typename T >
T * TMath::Normal2Plane (const T v1[3], const T v2[3], const T v3[3], T normal[3])
 Calculates a normal vector of a plane.
 
Double_t TMath::Normalize (Double_t v[3])
 Normalize a vector v in place.
 
Float_t TMath::Normalize (Float_t v[3])
 Normalize a vector v in place.
 
template<typename T >
TMath::NormCross (const T v1[3], const T v2[3], T out[3])
 Calculates the Normalized Cross Product of two vectors.
 
Double_t TMath::NormQuantile (Double_t p)
 Computes quantiles for standard normal distribution N(0, 1) at probability p.
 
Bool_t TMath::Permute (Int_t n, Int_t *a)
 Simple recursive algorithm to find the permutations of n natural numbers, not necessarily all distinct adapted from CERNLIB routine PERMU.
 
constexpr Double_t TMath::Pi ()
 \( \pi\)
 
constexpr Double_t TMath::PiOver2 ()
 \( \frac{\pi}{2} \)
 
constexpr Double_t TMath::PiOver4 ()
 \( \frac{\pi}{4} \)
 
Double_t TMath::Poisson (Double_t x, Double_t par)
 Computes the Poisson distribution function for (x,par).
 
Double_t TMath::PoissonI (Double_t x, Double_t par)
 Computes the Discrete Poisson distribution function for (x,par).
 
Double_t TMath::Power (Double_t x, Double_t y)
 Returns x raised to the power y.
 
Double_t TMath::Power (Double_t x, Int_t y)
 Returns x raised to the power y.
 
LongDouble_t TMath::Power (Long64_t x, Long64_t y)
 Returns x raised to the power y.
 
LongDouble_t TMath::Power (LongDouble_t x, Long64_t y)
 Returns x raised to the power y.
 
LongDouble_t TMath::Power (LongDouble_t x, LongDouble_t y)
 Returns x raised to the power y.
 
Double_t TMath::Prob (Double_t chi2, Int_t ndf)
 Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf).
 
constexpr Double_t TMath::Qe ()
 Elementary charge in \( C \) .
 
constexpr Double_t TMath::QeUncertainty ()
 Elementary charge uncertainty.
 
void TMath::Quantiles (Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=nullptr, Int_t type=7)
 Computes sample quantiles, corresponding to the given probabilities.
 
Double_t TMath::QuietNaN ()
 Returns a quiet NaN as defined by IEEE 754.
 
constexpr Double_t TMath::R ()
 Universal gas constant ( \( Na K \)) in \( J K^{-1} mol^{-1} \)
 
constexpr Double_t TMath::RadToDeg ()
 Conversion from radian to degree: \( \frac{180}{\pi} \).
 
constexpr Double_t TMath::Rgair ()
 Dry Air Gas Constant (R / MWair) in \( J kg^{-1} K^{-1} \)
 
template<typename Iterator >
Double_t TMath::RMS (Iterator first, Iterator last)
 Returns the Standard Deviation of an array defined by the iterators.
 
template<typename Iterator , typename WeightIterator >
Double_t TMath::RMS (Iterator first, Iterator last, WeightIterator wfirst)
 Returns the weighted Standard Deviation of an array defined by the iterators.
 
template<typename T >
Double_t TMath::RMS (Long64_t n, const T *a, const Double_t *w=nullptr)
 Returns the Standard Deviation of an array a with length n.
 
Bool_t TMath::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.
 
constexpr Double_t TMath::RUncertainty ()
 Universal gas constant uncertainty.
 
constexpr Double_t TMath::Sigma ()
 Stefan-Boltzmann constant in \( W m^{-2} K^{-4}\): \( \sigma \).
 
constexpr Double_t TMath::SigmaUncertainty ()
 Stefan-Boltzmann constant uncertainty.
 
Double_t TMath::SignalingNaN ()
 Returns a signaling NaN as defined by IEEE 754](http://en.wikipedia.org/wiki/NaN#Signaling_NaN).
 
Double_t TMath::Sin (Double_t)
 Returns the sine of an angle of x radians.
 
Double_t TMath::SinH (Double_t)
 Returns the hyperbolic sine of `x.
 
Double_t TMath::Sq (Double_t x)
 Returns x*x.
 
Double_t TMath::Sqrt (Double_t x)
 Returns the square root of x.
 
constexpr Double_t TMath::Sqrt2 ()
 \( \sqrt{2} \)
 
template<typename Iterator >
Double_t TMath::StdDev (Iterator first, Iterator last)
 Same as RMS.
 
template<typename Iterator , typename WeightIterator >
Double_t TMath::StdDev (Iterator first, Iterator last, WeightIterator wfirst)
 Same as RMS.
 
template<typename T >
Double_t TMath::StdDev (Long64_t n, const T *a, const Double_t *w=nullptr)
 
Double_t TMath::StruveH0 (Double_t x)
 Bessel function Y1(x) for positive x.
 
Double_t TMath::StruveH1 (Double_t x)
 Struve functions of order 0.
 
Double_t TMath::StruveL0 (Double_t x)
 Struve functions of order 1.
 
Double_t TMath::StruveL1 (Double_t x)
 Modified Struve functions of order 0.
 
Double_t TMath::Student (Double_t T, Double_t ndf)
 Computes density function for Student's t- distribution (the probability function (integral of density) is computed in StudentI).
 
Double_t TMath::StudentI (Double_t T, Double_t ndf)
 Calculates the cumulative distribution function of Student's t-distribution second parameter stands for number of degrees of freedom, not for the number of samples if x has Student's t-distribution, the function returns the probability of x being less than T.
 
Double_t TMath::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.
 
Double_t TMath::Tan (Double_t)
 Returns the tangent of an angle of x radians.
 
Double_t TMath::TanH (Double_t)
 Returns the hyperbolic tangent of x.
 
constexpr Double_t TMath::TwoPi ()
 \( 2\pi\)
 
Double_t TMath::Vavilov (Double_t x, Double_t kappa, Double_t beta2)
 Returns the value of the Vavilov density function.
 
Double_t TMath::VavilovI (Double_t x, Double_t kappa, Double_t beta2)
 Returns the value of the Vavilov distribution function.
 
Double_t TMath::Voigt (Double_t x, Double_t sigma, Double_t lg, Int_t r=4)
 Computation of Voigt function (normalised).