Class describing a Vavilov distribution.
The probability density function of the Vavilov distribution as function of Landau's parameter is given by:
\[ p(\lambda_L; \kappa, \beta^2) = \frac{1}{2 \pi i}\int_{c-i\infty}^{c+i\infty} \phi(s) e^{\lambda_L s} ds\]
where \(\phi(s) = e^{C} e^{\psi(s)}\) with \( C = \kappa (1+\beta^2 \gamma )\) and \(\psi(s)= s \ln \kappa + (s+\beta^2 \kappa) \cdot \left ( \int \limits_{0}^{1} \frac{1 - e^{\frac{-st}{\kappa}}}{t} \,d t- \gamma \right ) - \kappa \, e^{\frac{-s}{\kappa}}\). \( \gamma = 0.5772156649\dots\) is Euler's constant.
For the class VavilovAccurate, Pdf returns the Vavilov distribution as function of Landau's parameter \(\lambda_L = \lambda_V/\kappa - \ln \kappa\), which is the convention used in the CERNLIB routines, and in the tables by S.M. Seltzer and M.J. Berger: Energy loss stragglin of protons and mesons: Tabulation of the Vavilov distribution, pp 187-203 in: National Research Council (U.S.), Committee on Nuclear Science: Studies in penetration of charged particles in matter, Nat. Akad. Sci. Publication 1133, Nucl. Sci. Series Report No. 39, Washington (Nat. Akad. Sci.) 1964, 388 pp. Available from Google books
Therefore, for small values of \(\kappa < 0.01\), pdf approaches the Landau distribution.
For values \(\kappa > 10\), the Gauss approximation should be used with \(\mu\) and \(\sigma\) given by Vavilov::mean(kappa, beta2) and sqrt(Vavilov::variance(kappa, beta2).
The original Vavilov pdf is obtained by v.Pdf(lambdaV/kappa-log(kappa))/kappa.
For detailed description see B. Schorr, Programs for the Landau and the Vavilov distributions and the corresponding random numbers, Computer Phys. Comm. 7 (1974) 215-224, which has been implemented in CERNLIB (G116).
The class stores coefficients needed to calculate \(p(\lambda; \kappa, \beta^2)\) for fixed values of \(\kappa\) and \(\beta^2\). Changing these values is computationally expensive.
The parameter \(\kappa\) should be in the range \(0.01 \le \kappa \le 10\). In contrast to the CERNLIB implementation, all values of \(\kappa \ge 0.001\) may be used, but may result in slower running and/or inaccurate results.
The parameter \(\beta^2\) must be in the range \(0 \le \beta^2 \le 1\).
Two parameters which are fixed in the CERNLIB implementation may be set by the user:
For the quantile calculation, the algorithm given by Schorr is not used, because it turns out to be very slow and still inaccurate. Instead, an initial estimate is calculated based on a pre-calculated table, which is subsequently improved by Newton iterations.
While the CERNLIB implementation calculates at most 156 terms in the series expansion for the pdf and cdf calculation, this class calculates up to 500 terms, depending on the values of epsilonPM and epsilon.
Average times on a Pentium Core2 Duo P8400 2.26GHz:
Benno List, June 2010
Definition at line 131 of file VavilovAccurate.h.
Public Member Functions | |
VavilovAccurate (double kappa=1, double beta2=1, double epsilonPM=5E-4, double epsilon=1E-5) | |
Initialize an object to calculate the Vavilov distribution. More... | |
virtual | ~VavilovAccurate () |
Destructor. More... | |
double | Cdf (double x) const |
Evaluate the Vavilov cumulative probability density function. More... | |
double | Cdf (double x, double kappa, double beta2) |
Evaluate the Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
double | Cdf_c (double x) const |
Evaluate the Vavilov complementary cumulative probability density function. More... | |
double | Cdf_c (double x, double kappa, double beta2) |
Evaluate the Vavilov complementary cumulative probability density function, and set kappa and beta2, if necessary. More... | |
virtual double | GetBeta2 () const |
Return the current value of \(\beta^2\). More... | |
double | GetEpsilon () const |
Return the current value of \(\epsilon\). More... | |
double | GetEpsilonPM () const |
Return the current value of \(\epsilon^+ = \epsilon^-\). More... | |
virtual double | GetKappa () const |
Return the current value of \(\kappa\). More... | |
virtual double | GetLambdaMax () const |
Return the maximum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation. More... | |
virtual double | GetLambdaMin () const |
Return the minimum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation. More... | |
double | GetNTerms () const |
Return the number of terms used in the series expansion. More... | |
virtual double | Mode () const |
Return the value of \(\lambda\) where the pdf is maximal. More... | |
virtual double | Mode (double kappa, double beta2) |
Return the value of \(\lambda\) where the pdf is maximal function, and set kappa and beta2, if necessary. More... | |
double | Pdf (double x) const |
Evaluate the Vavilov probability density function. More... | |
double | Pdf (double x, double kappa, double beta2) |
Evaluate the Vavilov probability density function, and set kappa and beta2, if necessary. More... | |
double | Quantile (double z) const |
Evaluate the inverse of the Vavilov cumulative probability density function. More... | |
double | Quantile (double z, double kappa, double beta2) |
Evaluate the inverse of the Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
double | Quantile_c (double z) const |
Evaluate the inverse of the complementary Vavilov cumulative probability density function. More... | |
double | Quantile_c (double z, double kappa, double beta2) |
Evaluate the inverse of the complementary Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
void | Set (double kappa, double beta2, double epsilonPM=5E-4, double epsilon=1E-5) |
(Re)Initialize the object More... | |
virtual void | SetKappaBeta2 (double kappa, double beta2) |
Change \(\kappa\) and \(\beta^2\) and recalculate coefficients if necessary. More... | |
Public Member Functions inherited from ROOT::Math::Vavilov | |
Vavilov () | |
Default constructor. More... | |
virtual | ~Vavilov () |
Destructor. More... | |
virtual double | Cdf (double x) const =0 |
Evaluate the Vavilov cumulative probability density function. More... | |
virtual double | Cdf (double x, double kappa, double beta2)=0 |
Evaluate the Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
virtual double | Cdf_c (double x) const =0 |
Evaluate the Vavilov complementary cumulative probability density function. More... | |
virtual double | Cdf_c (double x, double kappa, double beta2)=0 |
Evaluate the Vavilov complementary cumulative probability density function, and set kappa and beta2, if necessary. More... | |
virtual double | GetBeta2 () const =0 |
Return the current value of \(\beta^2\). More... | |
virtual double | GetKappa () const =0 |
Return the current value of \(\kappa\). More... | |
virtual double | GetLambdaMax () const =0 |
Return the maximum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation. More... | |
virtual double | GetLambdaMin () const =0 |
Return the minimum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation. More... | |
virtual double | Kurtosis () const |
Return the theoretical kurtosis \(\gamma_2 = \frac{1/3 - \beta^2/4}{\kappa^3 \sigma^4}\). More... | |
virtual double | Mean () const |
Return the theoretical mean \(\mu = \gamma-1- \ln \kappa - \beta^2\), where \(\gamma = 0.5772\dots\) is Euler's constant. More... | |
virtual double | Mode () const |
Return the value of \(\lambda\) where the pdf is maximal. More... | |
virtual double | Mode (double kappa, double beta2) |
Return the value of \(\lambda\) where the pdf is maximal function, and set kappa and beta2, if necessary. More... | |
virtual double | Pdf (double x) const =0 |
Evaluate the Vavilov probability density function. More... | |
virtual double | Pdf (double x, double kappa, double beta2)=0 |
Evaluate the Vavilov probability density function, and set kappa and beta2, if necessary. More... | |
virtual double | Quantile (double z) const =0 |
Evaluate the inverse of the Vavilov cumulative probability density function. More... | |
virtual double | Quantile (double z, double kappa, double beta2)=0 |
Evaluate the inverse of the Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
virtual double | Quantile_c (double z) const =0 |
Evaluate the inverse of the complementary Vavilov cumulative probability density function. More... | |
virtual double | Quantile_c (double z, double kappa, double beta2)=0 |
Evaluate the inverse of the complementary Vavilov cumulative probability density function, and set kappa and beta2, if necessary. More... | |
virtual void | SetKappaBeta2 (double kappa, double beta2)=0 |
Change \(\kappa\) and \(\beta^2\) and recalculate coefficients if necessary. More... | |
virtual double | Skewness () const |
Return the theoretical skewness \(\gamma_1 = \frac{1/2 - \beta^2/3}{\kappa^2 \sigma^3} \). More... | |
virtual double | Variance () const |
Return the theoretical variance \(\sigma^2 = \frac{1 - \beta^2/2}{\kappa}\). More... | |
Static Public Member Functions | |
static VavilovAccurate * | GetInstance () |
Returns a static instance of class VavilovFast. More... | |
static VavilovAccurate * | GetInstance (double kappa, double beta2) |
Returns a static instance of class VavilovFast, and sets the values of kappa and beta2. More... | |
Static Public Member Functions inherited from ROOT::Math::Vavilov | |
static double | Kurtosis (double kappa, double beta2) |
Return the theoretical kurtosis \(\gamma_2 = \frac{1/3 - \beta^2/4}{\kappa^3 \sigma^4}\). More... | |
static double | Mean (double kappa, double beta2) |
Return the theoretical Mean \(\mu = \gamma-1- \ln \kappa - \beta^2\). More... | |
static double | Skewness (double kappa, double beta2) |
Return the theoretical skewness \(\gamma_1 = \frac{1/2 - \beta^2/3}{\kappa^2 \sigma^3} \). More... | |
static double | Variance (double kappa, double beta2) |
Return the theoretical Variance \(\sigma^2 = \frac{1 - \beta^2/2}{\kappa}\). More... | |
Private Types | |
enum | { MAXTERMS =500 } |
enum | { kNquantMax =32 } |
Private Member Functions | |
double | G116f1 (double x) const |
double | G116f2 (double x) const |
void | InitQuantile () const |
int | Rzero (double a, double b, double &x0, double eps, int mxf, double(VavilovAccurate::*f)(double) const) const |
Static Private Member Functions | |
static double | E1plLog (double x) |
Private Attributes | |
double | fA_cdf [MAXTERMS+1] |
double | fA_pdf [MAXTERMS+1] |
double | fB_cdf [MAXTERMS+1] |
double | fB_pdf [MAXTERMS+1] |
double | fBeta2 |
double | fEpsilon |
double | fEpsilonPM |
double | fH [8] |
double | fKappa |
double | fLambda [kNquantMax] |
int | fNQuant |
double | fOmega |
double | fQuant [kNquantMax] |
bool | fQuantileInit |
double | fT |
double | fT0 |
double | fT1 |
double | fX0 |
Static Private Attributes | |
static VavilovAccurate * | fgInstance = 0 |
#include <Math/VavilovAccurate.h>
|
private |
Enumerator | |
---|---|
MAXTERMS |
Definition at line 332 of file VavilovAccurate.h.
|
private |
Enumerator | |
---|---|
kNquantMax |
Definition at line 339 of file VavilovAccurate.h.
ROOT::Math::VavilovAccurate::VavilovAccurate | ( | double | kappa = 1 , |
double | beta2 = 1 , |
||
double | epsilonPM = 5E-4 , |
||
double | epsilon = 1E-5 |
||
) |
Initialize an object to calculate the Vavilov distribution.
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
epsilonPM | \(\epsilon^+ = \epsilon^-\) in Eqs. (2.1) and (2.2) of Schorr's paper; gives an estimate on the integral of the cumulative distribution function outside the range \(\lambda_{min} \le \lambda \le \lambda_{max}\) where the approximation is valid. |
epsilon | \(\epsilon\) in Eq. (4.10) of Schorr's paper; determines the accuracy of the series expansion. |
Definition at line 52 of file VavilovAccurate.cxx.
|
virtual |
Destructor.
Definition at line 58 of file VavilovAccurate.cxx.
Evaluate the Vavilov cumulative probability density function.
x | The Landau parameter \(x = \lambda_L\) |
Implements ROOT::Math::Vavilov.
Definition at line 257 of file VavilovAccurate.cxx.
Evaluate the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
x | The Landau parameter \(x = \lambda_L\) |
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 292 of file VavilovAccurate.cxx.
Evaluate the Vavilov complementary cumulative probability density function.
x | The Landau parameter \(x = \lambda_L\) |
Implements ROOT::Math::Vavilov.
Definition at line 297 of file VavilovAccurate.cxx.
Evaluate the Vavilov complementary cumulative probability density function, and set kappa and beta2, if necessary.
x | The Landau parameter \(x = \lambda_L\) |
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 332 of file VavilovAccurate.cxx.
Definition at line 645 of file VavilovAccurate.cxx.
Definition at line 487 of file VavilovAccurate.cxx.
Definition at line 496 of file VavilovAccurate.cxx.
|
virtual |
Return the current value of \(\beta^2\).
Implements ROOT::Math::Vavilov.
Definition at line 672 of file VavilovAccurate.cxx.
double ROOT::Math::VavilovAccurate::GetEpsilon | ( | ) | const |
Return the current value of \(\epsilon\).
Definition at line 704 of file VavilovAccurate.cxx.
double ROOT::Math::VavilovAccurate::GetEpsilonPM | ( | ) | const |
Return the current value of \(\epsilon^+ = \epsilon^-\).
Definition at line 700 of file VavilovAccurate.cxx.
|
static |
Returns a static instance of class VavilovFast.
Definition at line 451 of file VavilovAccurate.cxx.
|
static |
Returns a static instance of class VavilovFast, and sets the values of kappa and beta2.
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Definition at line 456 of file VavilovAccurate.cxx.
|
virtual |
Return the current value of \(\kappa\).
Implements ROOT::Math::Vavilov.
Definition at line 668 of file VavilovAccurate.cxx.
|
virtual |
Return the maximum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation.
Implements ROOT::Math::Vavilov.
Definition at line 664 of file VavilovAccurate.cxx.
|
virtual |
Return the minimum value of \(\lambda\) for which \(p(\lambda; \kappa, \beta^2)\) is nonzero in the current approximation.
Implements ROOT::Math::Vavilov.
Definition at line 660 of file VavilovAccurate.cxx.
double ROOT::Math::VavilovAccurate::GetNTerms | ( | ) | const |
Return the number of terms used in the series expansion.
Definition at line 708 of file VavilovAccurate.cxx.
|
private |
Definition at line 186 of file VavilovAccurate.cxx.
|
virtual |
Return the value of \(\lambda\) where the pdf is maximal.
Reimplemented from ROOT::Math::Vavilov.
Definition at line 676 of file VavilovAccurate.cxx.
Return the value of \(\lambda\) where the pdf is maximal function, and set kappa and beta2, if necessary.
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Reimplemented from ROOT::Math::Vavilov.
Definition at line 695 of file VavilovAccurate.cxx.
Evaluate the Vavilov probability density function.
x | The Landau parameter \(x = \lambda_L\) |
Implements ROOT::Math::Vavilov.
Definition at line 218 of file VavilovAccurate.cxx.
Evaluate the Vavilov probability density function, and set kappa and beta2, if necessary.
x | The Landau parameter \(x = \lambda_L\) |
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 252 of file VavilovAccurate.cxx.
Evaluate the inverse of the Vavilov cumulative probability density function.
z | The argument \(z\), which must be in the range \(0 \le z \le 1\) |
Implements ROOT::Math::Vavilov.
Definition at line 337 of file VavilovAccurate.cxx.
Evaluate the inverse of the Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
z | The argument \(z\), which must be in the range \(0 \le z \le 1\) |
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 384 of file VavilovAccurate.cxx.
Evaluate the inverse of the complementary Vavilov cumulative probability density function.
z | The argument \(z\), which must be in the range \(0 \le z \le 1\) |
Implements ROOT::Math::Vavilov.
Definition at line 389 of file VavilovAccurate.cxx.
Evaluate the inverse of the complementary Vavilov cumulative probability density function, and set kappa and beta2, if necessary.
z | The argument \(z\), which must be in the range \(0 \le z \le 1\) |
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 446 of file VavilovAccurate.cxx.
|
private |
Definition at line 505 of file VavilovAccurate.cxx.
void ROOT::Math::VavilovAccurate::Set | ( | double | kappa, |
double | beta2, | ||
double | epsilonPM = 5E-4 , |
||
double | epsilon = 1E-5 |
||
) |
(Re)Initialize the object
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
epsilonPM | \(\epsilon^+ = \epsilon^-\) in Eqs. (2.1) and (2.2) of Schorr's paper; gives an estimate on the integral of the cumulative distribution function outside the range \(\lambda_{min} \le \lambda \le \lambda_{max}\) where the approximation is valid. |
epsilon | \(\epsilon\) in Eq. (4.10) of Schorr's paper; determines the accuracy of the series expansion. |
Definition at line 67 of file VavilovAccurate.cxx.
Change \(\kappa\) and \(\beta^2\) and recalculate coefficients if necessary.
kappa | The parameter \(\kappa\), which must be in the range \(\kappa \ge 0.001 \) |
beta2 | The parameter \(\beta^2\), which must be in the range \(0 \le \beta^2 \le 1 \) |
Implements ROOT::Math::Vavilov.
Definition at line 63 of file VavilovAccurate.cxx.
Definition at line 333 of file VavilovAccurate.h.
Definition at line 333 of file VavilovAccurate.h.
Definition at line 333 of file VavilovAccurate.h.
Definition at line 333 of file VavilovAccurate.h.
|
private |
Definition at line 334 of file VavilovAccurate.h.
|
private |
Definition at line 335 of file VavilovAccurate.h.
|
private |
Definition at line 335 of file VavilovAccurate.h.
|
staticprivate |
Definition at line 345 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.
|
private |
Definition at line 334 of file VavilovAccurate.h.
|
mutableprivate |
Definition at line 341 of file VavilovAccurate.h.
|
mutableprivate |
Definition at line 338 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.
|
mutableprivate |
Definition at line 340 of file VavilovAccurate.h.
|
mutableprivate |
Definition at line 337 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.
|
private |
Definition at line 333 of file VavilovAccurate.h.