CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

LogGamma.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: LogGamma.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
3 // ---------------------------------------------------------------------------
4 
6 #include <cmath> // for log()
7 
8 namespace Genfun {
9 FUNCTION_OBJECT_IMP(LogGamma)
10 
11 const double LogGamma::_coefficient[6]={
12  +76.18009172947146,
13  -86.50532032941677,
14  +24.01409824083091,
15  -1.231739572450155,
16  0.1208650973866179E-2,
17  -0.5395239384953E-5};
18 
20 {}
21 
22 LogGamma::LogGamma(const LogGamma & right) : AbsFunction(right)
23 {}
24 
26 }
27 
28 double LogGamma::operator() (double x) const {
29  double y=x,tmp=x+5.5,ser=1.000000000190015,c=2.5066282746310005;
30  tmp -= (x+0.5)*log(tmp);
31  for (int j=0;j<6;j++) ser += _coefficient[j]/++y;
32  return -tmp+log(c*ser/x);
33 }
34 
35 } // namespace Genfun
virtual ~LogGamma()
Definition: LogGamma.cc:25
virtual double operator()(double argument) const
Definition: LogGamma.cc:28
#define FUNCTION_OBJECT_IMP(classname)