PdfFuncMathCore.h

Go to the documentation of this file.
00001 // @(#)root/mathcore:$Id: PdfFuncMathCore.h 37441 2010-12-09 16:27:54Z moneta $
00002 // Authors: Andras Zsenei & Lorenzo Moneta   06/2005 
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 , LCG ROOT MathLib Team                         *
00007  *                                                                    *
00008  *                                                                    *
00009  **********************************************************************/
00010 
00011 
00012 
00013 /**
00014 
00015 Probability density functions, cumulative distribution functions 
00016 and their inverses (quantiles) for various statistical distributions (continuous and discrete).
00017 Whenever possible the conventions followed are those of the
00018 CRC Concise Encyclopedia of Mathematics, Second Edition
00019 (or <A HREF="http://mathworld.wolfram.com/">Mathworld</A>).
00020 By convention the distributions are centered around 0, so for
00021 example in the case of a Gaussian there is no parameter mu. The
00022 user must calculate the shift himself if he wishes. 
00023 
00024 MathCore provides the majority of the probability density functions, of the 
00025 cumulative distributions and of the quantiles (inverses of the cumulatives). 
00026 Additional distributions are also provided by the
00027 <A HREF="../../MathMore/html/group__StatFunc.html">MathMore</A> library. 
00028 
00029 
00030 @defgroup StatFunc Statistical functions
00031 
00032 */
00033 
00034 
00035 
00036 #if defined(__CINT__) && !defined(__MAKECINT__)
00037 // avoid to include header file when using CINT 
00038 #ifndef _WIN32
00039 #include "../lib/libMathCore.so"
00040 #else
00041 #include "../bin/libMathCore.dll"
00042 #endif
00043 
00044 #else
00045 
00046 
00047 #ifndef ROOT_Math_PdfFuncMathCore
00048 #define ROOT_Math_PdfFuncMathCore
00049 
00050 
00051 
00052 
00053 namespace ROOT {
00054 namespace Math {
00055 
00056 
00057 
00058   /** @defgroup PdfFunc Probability Density Functions (PDF) from MathCore      
00059    *   @ingroup StatFunc
00060    *  Probability density functions of various statistical distributions 
00061    *  (continuous and discrete).
00062    *  The probability density function returns the probability that 
00063    *  the variate has the value x. 
00064    *  In statistics the PDF is also called the frequency function.
00065    *  
00066    * 
00067    */
00068 
00069    /** @name Probability Density Functions from MathCore 
00070    *   Additional PDF's are provided in the MathMore library
00071    *   (see PDF functions from MathMore)   
00072    */ 
00073 
00074   //@{
00075 
00076   /**
00077      
00078   Probability density function of the beta distribution.
00079   
00080   \f[ p(x) = \frac{\Gamma (a + b) } {\Gamma(a)\Gamma(b) } x ^{a-1} (1 - x)^{b-1} \f]
00081 
00082   for \f$0 \leq x \leq 1 \f$. For detailed description see 
00083   <A HREF="http://mathworld.wolfram.com/BetaDistribution.html">
00084   Mathworld</A>. 
00085   
00086   @ingroup PdfFunc
00087 
00088   */
00089 
00090   double beta_pdf(double x, double a, double b);
00091 
00092 
00093   /**
00094     
00095   Probability density function of the binomial distribution.
00096 
00097   \f[ p(k) = \frac{n!}{k! (n-k)!} p^k (1-p)^{n-k} \f]
00098 
00099   for \f$ 0 \leq k \leq n \f$. For detailed description see 
00100   <A HREF="http://mathworld.wolfram.com/BinomialDistribution.html">
00101   Mathworld</A>. 
00102   
00103   @ingroup PdfFunc
00104 
00105   */
00106 
00107   double binomial_pdf(unsigned int k, double p, unsigned int n);
00108 
00109 
00110   /**
00111     
00112   Probability density function of the negative binomial distribution.
00113 
00114   \f[ p(k) = \frac{(k+n-1)!}{k! (n-1)!} p^{n} (1-p)^{k} \f]
00115 
00116   For detailed description see 
00117   <A HREF="http://mathworld.wolfram.com/NegativeBinomialDistribution.html">
00118   Mathworld</A> (where $k \to x$ and $n \to r$).
00119   The distribution in <A HREF="http://en.wikipedia.org/wiki/Negative_binomial_distribution">
00120   Wikipedia</A> is defined with a $p$ corresponding to $1-p$ in this case.
00121 
00122   
00123   @ingroup PdfFunc
00124 
00125   */
00126 
00127   double negative_binomial_pdf(unsigned int k, double p, double n);
00128 
00129 
00130 
00131   /**
00132 
00133   Probability density function of Breit-Wigner distribution, which is similar, just 
00134   a different definition of the parameters, to the Cauchy distribution 
00135   (see  #cauchy_pdf )
00136 
00137   \f[ p(x) = \frac{1}{\pi} \frac{\frac{1}{2} \Gamma}{x^2 + (\frac{1}{2} \Gamma)^2} \f]
00138 
00139   
00140   @ingroup PdfFunc
00141 
00142   */
00143 
00144   double breitwigner_pdf(double x, double gamma, double x0 = 0);
00145 
00146 
00147 
00148 
00149   /**
00150 
00151   Probability density function of the Cauchy distribution which is also
00152   called Lorentzian distribution.
00153 
00154   
00155   \f[ p(x) = \frac{1}{\pi} \frac{ b }{ (x-m)^2 + b^2} \f]
00156 
00157   For detailed description see 
00158   <A HREF="http://mathworld.wolfram.com/CauchyDistribution.html">
00159   Mathworld</A>. It is also related to the #breitwigner_pdf which 
00160   will call the same implementation.
00161   
00162   @ingroup PdfFunc
00163 
00164   */
00165 
00166   double cauchy_pdf(double x, double b = 1, double x0 = 0);
00167 
00168 
00169 
00170 
00171   /**
00172 
00173   Probability density function of the \f$\chi^2\f$ distribution with \f$r\f$ 
00174   degrees of freedom.
00175 
00176   \f[ p_r(x) = \frac{1}{\Gamma(r/2) 2^{r/2}} x^{r/2-1} e^{-x/2} \f]
00177 
00178   for \f$x \geq 0\f$. For detailed description see 
00179   <A HREF="http://mathworld.wolfram.com/Chi-SquaredDistribution.html">
00180   Mathworld</A>. 
00181   
00182   @ingroup PdfFunc
00183 
00184   */
00185 
00186   double chisquared_pdf(double x, double r, double x0 = 0);
00187 
00188 
00189 
00190 
00191   /**
00192 
00193   Probability density function of the exponential distribution.
00194 
00195   \f[ p(x) = \lambda e^{-\lambda x} \f]
00196 
00197   for x>0. For detailed description see 
00198   <A HREF="http://mathworld.wolfram.com/ExponentialDistribution.html">
00199   Mathworld</A>. 
00200 
00201   
00202   @ingroup PdfFunc
00203 
00204   */
00205 
00206   double exponential_pdf(double x, double lambda, double x0 = 0);
00207 
00208 
00209 
00210 
00211   /**
00212 
00213   Probability density function of the F-distribution.
00214 
00215   \f[ p_{n,m}(x) = \frac{\Gamma(\frac{n+m}{2})}{\Gamma(\frac{n}{2}) \Gamma(\frac{m}{2})} n^{n/2} m^{m/2} x^{n/2 -1} (m+nx)^{-(n+m)/2} \f]
00216 
00217   for x>=0. For detailed description see 
00218   <A HREF="http://mathworld.wolfram.com/F-Distribution.html">
00219   Mathworld</A>. 
00220   
00221   @ingroup PdfFunc
00222 
00223   */
00224 
00225 
00226   double fdistribution_pdf(double x, double n, double m, double x0 = 0);
00227 
00228 
00229 
00230 
00231   /**
00232 
00233   Probability density function of the gamma distribution.
00234 
00235   \f[ p(x) = {1 \over \Gamma(\alpha) \theta^{\alpha}} x^{\alpha-1} e^{-x/\theta} \f]
00236 
00237   for x>0. For detailed description see 
00238   <A HREF="http://mathworld.wolfram.com/GammaDistribution.html">
00239   Mathworld</A>. 
00240   
00241   @ingroup PdfFunc
00242 
00243   */
00244 
00245   double gamma_pdf(double x, double alpha, double theta, double x0 = 0);
00246 
00247 
00248 
00249 
00250   /**
00251 
00252   Probability density function of the normal (Gaussian) distribution.
00253 
00254   \f[ p(x) = {1 \over \sqrt{2 \pi \sigma^2}} e^{-x^2 / 2\sigma^2} \f]
00255 
00256   For detailed description see 
00257   <A HREF="http://mathworld.wolfram.com/NormalDistribution.html">
00258   Mathworld</A>. It can also be evaluated using #normal_pdf which will 
00259   call the same implementation. 
00260 
00261   @ingroup PdfFunc
00262  
00263   */
00264 
00265   double gaussian_pdf(double x, double sigma = 1, double x0 = 0);
00266 
00267 
00268 
00269    /**
00270 
00271    Probability density function of the Landau distribution:
00272   \f[ p(x) = \frac{1}{\xi} \phi (\lambda) \f]
00273    with
00274    \f[  \phi(\lambda) = \frac{1}{2 \pi i}\int_{c-i\infty}^{c+i\infty} e^{\lambda s + s \log{s}} ds\f]
00275    where \f$\lambda = (x-x_0)/\xi\f$. For a detailed description see 
00276    K.S. K&ouml;lbig and B. Schorr, A program package for the Landau distribution, 
00277    <A HREF="http://dx.doi.org/10.1016/0010-4655(84)90085-7">Computer Phys. Comm. 31 (1984) 97-111</A>
00278    <A HREF="http://dx.doi.org/10.1016/j.cpc.2008.03.002">[Erratum-ibid. 178 (2008) 972]</A>. 
00279    The same algorithms as in 
00280    <A HREF="http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/g110/top.html">
00281    CERNLIB</A> (DENLAN)  is used 
00282    
00283    @param x The argument \f$x\f$ 
00284    @param xi The width parameter \f$\xi\f$ 
00285    @param x0 The location parameter \f$x_0\f$ 
00286    
00287    @ingroup PdfFunc
00288    
00289    */
00290 
00291    double landau_pdf(double x, double xi = 1, double x0 = 0); 
00292 
00293 
00294 
00295   /**
00296 
00297   Probability density function of the lognormal distribution.
00298 
00299   \f[ p(x) = {1 \over x \sqrt{2 \pi s^2} } e^{-(\ln{x} - m)^2/2 s^2} \f]
00300 
00301   for x>0. For detailed description see 
00302   <A HREF="http://mathworld.wolfram.com/LogNormalDistribution.html">
00303   Mathworld</A>. 
00304   @param s scale parameter (not the sigma of the distribution which is not even defined)
00305   @param x0  location parameter, corresponds approximatly to the most probable value. For x0 = 0, sigma = 1, the x_mpv = -0.22278
00306   
00307   @ingroup PdfFunc
00308 
00309   */
00310 
00311   double lognormal_pdf(double x, double m, double s, double x0 = 0);
00312 
00313 
00314 
00315 
00316   /**
00317 
00318   Probability density function of the normal (Gaussian) distribution.
00319 
00320   \f[ p(x) = {1 \over \sqrt{2 \pi \sigma^2}} e^{-x^2 / 2\sigma^2} \f]
00321 
00322   For detailed description see 
00323   <A HREF="http://mathworld.wolfram.com/NormalDistribution.html">
00324   Mathworld</A>. It can also be evaluated using #gaussian_pdf which will call the same 
00325   implementation. 
00326 
00327   @ingroup PdfFunc
00328  
00329   */
00330 
00331   double normal_pdf(double x, double sigma =1, double x0 = 0);
00332 
00333 
00334   /**
00335 
00336   Probability density function of the Poisson distribution.
00337 
00338   \f[ p(n) = \frac{\mu^n}{n!} e^{- \mu} \f]
00339 
00340   For detailed description see 
00341   <A HREF="http://mathworld.wolfram.com/PoissonDistribution.html">
00342   Mathworld</A>. 
00343   
00344   @ingroup PdfFunc
00345 
00346   */
00347 
00348   double poisson_pdf(unsigned int n, double mu);
00349 
00350 
00351 
00352 
00353   /**
00354 
00355   Probability density function of Student's t-distribution.
00356 
00357   \f[ p_{r}(x) = \frac{\Gamma(\frac{r+1}{2})}{\sqrt{r \pi}\Gamma(\frac{r}{2})} \left( 1+\frac{x^2}{r}\right)^{-(r+1)/2}  \f]
00358 
00359   for \f$k \geq 0\f$. For detailed description see 
00360   <A HREF="http://mathworld.wolfram.com/Studentst-Distribution.html">
00361   Mathworld</A>. 
00362   
00363   @ingroup PdfFunc
00364 
00365   */
00366 
00367   double tdistribution_pdf(double x, double r, double x0 = 0);
00368 
00369 
00370 
00371 
00372   /**
00373 
00374   Probability density function of the uniform (flat) distribution.
00375 
00376   \f[ p(x) = {1 \over (b-a)} \f]
00377 
00378   if \f$a \leq x<b\f$ and 0 otherwise. For detailed description see 
00379   <A HREF="http://mathworld.wolfram.com/UniformDistribution.html">
00380   Mathworld</A>. 
00381   
00382   @ingroup PdfFunc
00383 
00384   */
00385 
00386   double uniform_pdf(double x, double a, double b, double x0 = 0);
00387 
00388 
00389 
00390 } // namespace Math
00391 } // namespace ROOT
00392 
00393 
00394 
00395 #endif // ROOT_Math_PdfFunc
00396 
00397 #endif // if defined (__CINT__) && !defined(__MAKECINT__)

Generated on Tue Jul 5 14:25:36 2011 for ROOT_528-00b_version by  doxygen 1.5.1