CMS 3D CMS Logo

Static Public Member Functions

IncompleteGammaComplement Class Reference

#include <IncompleteGammaComplement.h>

List of all members.

Static Public Member Functions

static float ln (float a, float x)
static float value (float a, float x)

Detailed Description

Computes the complement Q(a,x)=1-P(a,x) of the incomplete gamma function. Computes its natural logarithm, useful for comparing very small values. source: Numerical Recipes

Definition at line 9 of file IncompleteGammaComplement.h.


Member Function Documentation

float IncompleteGammaComplement::ln ( float  a,
float  x 
) [static]

Definition at line 25 of file IncompleteGammaComplement.cc.

References funct::exp(), GammaContinuedFraction(), GammaLn(), GammaSeries(), and funct::log().

Referenced by LnChiSquaredProbability().

{
  if( x < 0.0 || a <= 0.0 ) 
edm::LogInfo("IncompleteGammaComplement")<< "IncompleteGammaComplement::invalid arguments";
  if( x < (a+1.0) )
    // take the complement of the series representation    
    return log(1.-GammaSeries(a,x)*(exp(-x + a*log(x) - GammaLn(a))));
  else
    // use the continued fraction representation
    return log(GammaContinuedFraction(a,x)) -x + a*log(x) - GammaLn(a);
}
float IncompleteGammaComplement::value ( float  a,
float  x 
) [static]

Definition at line 12 of file IncompleteGammaComplement.cc.

References funct::exp(), GammaContinuedFraction(), GammaLn(), GammaSeries(), and funct::log().

Referenced by ChiSquaredProbability().

{
  if( x < 0.0 || a <= 0.0 ) 
    edm::LogInfo("IncompleteGammaComplement")<< "IncompleteGammaComplement::invalid arguments";
  if( x < (a+1.0) )
    // take the complement of the series representation
    return 1.-GammaSeries(a,x)*(exp(-x + a*log(x) - GammaLn(a)));
  else
    // use the continued fraction representation
    return GammaContinuedFraction(a,x)*(exp(-x + a*log(x) - GammaLn(a)));
}