31#ifndef ROOT_Math_PdfFuncMathCore
32#define ROOT_Math_PdfFuncMathCore
81 if (
a < 1)
return std::numeric_limits<double>::infinity();
82 else if (
a > 1)
return 0;
83 else if (
a == 1)
return b;
87 if (
b < 1)
return std::numeric_limits<double>::infinity();
88 else if (
b > 1)
return 0;
89 else if (
b == 1)
return a;
144 if (
n < 0)
return 0.0;
145 if (p < 0 || p > 1.0)
return 0.0;
170 double gammahalf = gamma/2.0;
171 return gammahalf/(
M_PI * ((
x-x0)*(
x-x0) + gammahalf*gammahalf));
226 if (
x == x0 &&
a == 0)
return 0.5;
251 if (
sigma < 0.)
return 0.;
252 double z = (
x - mean)/
sigma;
253 if (alpha < 0) z = -z;
254 double abs_alpha = std::abs(alpha);
259 return std::exp(- 0.5 * z * z);
261 double nDivAlpha =
n/abs_alpha;
262 double AA = std::exp(-0.5*abs_alpha*abs_alpha);
263 double B = nDivAlpha -abs_alpha;
264 double arg = nDivAlpha/(B-z);
265 return AA * std::pow(arg,
n);
275 if (
sigma < 0.)
return 0.;
276 if (
n <= 1)
return std::numeric_limits<double>::quiet_NaN();
277 double abs_alpha = std::abs(alpha);
278 double C =
n/abs_alpha * 1./(
n-1.) * std::exp(-alpha*alpha/2.);
280 double N = 1./(
sigma*(C+D));
304 return lambda * std::exp (-lambda * (
x-x0));
330 return std::numeric_limits<double>::quiet_NaN();
335 + (
n/2 -1) * std::log(
x-x0) - ((
n+
m)/2) * std::log(
m +
n*(
x-x0)) );
356 inline double gamma_pdf(
double x,
double alpha,
double theta,
double x0 = 0) {
361 }
else if ((
x-x0) == 0) {
369 }
else if (alpha == 1) {
370 return std::exp(-(
x-x0)/theta)/theta;
372 return std::exp((alpha - 1) * std::log((
x-x0)/theta) - (
x-x0)/theta -
ROOT::Math::lgamma(alpha))/theta;
397 double tmp = (
x-x0)/
sigma;
398 return (1.0/(std::sqrt(2 *
M_PI) * std::abs(
sigma))) * std::exp(-tmp*tmp/2);
424 inline double bigaussian_pdf(
double x,
double y,
double sigmax = 1,
double sigmay = 1,
double rho = 0,
double x0 = 0,
double y0 = 0) {
425 double u = (
x-x0)/sigmax;
426 double v = (
y-y0)/sigmay;
427 double c = 1. - rho*rho;
428 double z = u*u - 2.*rho*u*
v +
v*
v;
429 return 1./(2 *
M_PI * sigmax * sigmay * std::sqrt(
c) ) * std::exp(- z / (2. *
c) );
454 double landau_pdf(
double x,
double xi = 1,
double x0 = 0);
480 double tmp = (std::log((
x-x0)) -
m)/s;
481 return 1.0 / ((
x-x0) * std::abs(s) * std::sqrt(2 *
M_PI)) * std::exp(-(tmp * tmp) /2);
505 double tmp = (
x-x0)/
sigma;
506 return (1.0/(std::sqrt(2 *
M_PI) * std::abs(
sigma))) * std::exp(-tmp*tmp/2);
528 if (
n > 0 && mu >= 0)
533 return std::exp(-mu);
536 return std::numeric_limits<double>::quiet_NaN();
560 * std::pow ((1.0 + (
x-x0)*(
x-x0)/
r), -(
r + 1.0)/2.0);
586 if ((
x-x0) <
b && (
x-x0) >=
a)
double uniform_pdf(double x, double a, double b, double x0=0)
Probability density function of the uniform (flat) distribution.
double bigaussian_pdf(double x, double y, double sigmax=1, double sigmay=1, double rho=0, double x0=0, double y0=0)
Probability density function of the bi-dimensional (Gaussian) distribution.
double normal_pdf(double x, double sigma=1, double x0=0)
Probability density function of the normal (Gaussian) distribution with mean x0 and standard deviatio...
double lognormal_pdf(double x, double m, double s, double x0=0)
Probability density function of the lognormal distribution.
double binomial_pdf(unsigned int k, double p, unsigned int n)
Probability density function of the binomial distribution.
double fdistribution_pdf(double x, double n, double m, double x0=0)
Probability density function of the F-distribution.
double negative_binomial_pdf(unsigned int k, double p, double n)
Probability density function of the negative binomial distribution.
double gamma_pdf(double x, double alpha, double theta, double x0=0)
Probability density function of the gamma distribution.
double landau_pdf(double x, double xi=1, double x0=0)
Probability density function of the Landau distribution:
double exponential_pdf(double x, double lambda, double x0=0)
Probability density function of the exponential distribution.
double gaussian_pdf(double x, double sigma=1, double x0=0)
Probability density function of the normal (Gaussian) distribution with mean x0 and standard deviatio...
double chisquared_pdf(double x, double r, double x0=0)
Probability density function of the distribution with degrees of freedom.
double breitwigner_pdf(double x, double gamma, double x0=0)
Probability density function of Breit-Wigner distribution, which is similar, just a different definit...
double crystalball_function(double x, double alpha, double n, double sigma, double mean=0)
Crystal ball function.
double crystalball_pdf(double x, double alpha, double n, double sigma, double mean=0)
pdf definition of the crystal_ball which is defined only for n > 1 otherwise integral is diverging
double beta_pdf(double x, double a, double b)
Probability density function of the beta distribution.
double poisson_pdf(unsigned int n, double mu)
Probability density function of the Poisson distribution.
double cauchy_pdf(double x, double b=1, double x0=0)
Probability density function of the Cauchy distribution which is also called Lorentzian distribution.
double tdistribution_pdf(double x, double r, double x0=0)
Probability density function of Student's t-distribution.
double lgamma(double x)
Calculates the logarithm of the gamma function.
double erf(double x)
Error function encountered in integrating the normal distribution.
double log1p(double x)
declarations for functions which are not implemented by some compilers