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

LogGamma.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: LogGamma.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
00003 // ---------------------------------------------------------------------------
00004 
00005 #include "CLHEP/GenericFunctions/LogGamma.hh"
00006 #include <cmath>      // for log()
00007 
00008 namespace Genfun {
00009 FUNCTION_OBJECT_IMP(LogGamma)
00010 
00011 const double LogGamma::_coefficient[6]={
00012   +76.18009172947146,
00013   -86.50532032941677,
00014   +24.01409824083091,
00015   -1.231739572450155,
00016   0.1208650973866179E-2,
00017   -0.5395239384953E-5};
00018 
00019 LogGamma::LogGamma()
00020 {}
00021 
00022 LogGamma::LogGamma(const LogGamma & right) : AbsFunction(right)
00023 {}
00024 
00025 LogGamma::~LogGamma() {
00026 }
00027 
00028 double LogGamma::operator() (double x) const {
00029   double y=x,tmp=x+5.5,ser=1.000000000190015,c=2.5066282746310005;
00030   tmp -= (x+0.5)*log(tmp);
00031   for (int j=0;j<6;j++) ser += _coefficient[j]/++y;
00032   return -tmp+log(c*ser/x);
00033 }
00034 
00035 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7