43 static double cof[6]={76.18009172947146,-86.50532032941677,
44 24.01409824083091,-1.231739572450155,
45 0.1208650973866179e-2,-0.5395239384953e-5};
50 tmp -= (
x+0.5)*log(tmp);
51 ser=1.000000000190015;
52 for (j=0;j<=5;j++) ser += cof[j]/++y;
53 return -tmp+log(2.5066282746310005*ser/
x);
59 double gamser,gammcf,gln;
61 if (
x < 0.0 || a <= 0.0) std::cout<<
"ErrMsg(error)" <<
" Invalid arguments in routine gammp x=" <<
x <<
" a=" << a << endl;
63 gser(&gamser,a,
x,&gln);
66 gcf(&gammcf,a,
x,&gln);
74 double gamser,gammcf,gln;
76 if (
x < 0.0 || a <= 0.0) recipesErr(
" Invalid arguments in routine GAMMQ");
78 gser(&gamser,a,
x,&gln);
81 gcf(&gammcf,a,
x,&gln);
89 double gold=0.0,g,fac=1.0,b1=1.0;
90 double b0=0.0,anf,ana,an,a1,a0=1.0;
106 *gammcf=
exp(-
x+a*log(
x)-(*gln))*g;
112 recipesErr(
" a too large, NUMREC_ITMAX too small in routine GCF");
122 if (
x < 0.0) recipesErr(
" x less than 0 in routine GSER");
133 *gamser=sum*
exp(-
x+a*log(
x)-(*gln));
137 recipesErr(
" a too large, NUMREC_ITMAX too small in routine GSER");
142void NumRecipes::recipesErr(
const char* c)
144 std::cout<<
"ErrMsg(fatal)" <<
" Numerical Recipes run-time error...\n" << c
145 <<
"\n ...now exiting to system..." << std::endl;
EvtComplex exp(const EvtComplex &c)
static double gammq(double a, double x)
static void gser(double *gamser, double a, double x, double *gln)
static double gammln(double x)
static void gcf(double *gammcf, double a, double x, double *gln)
static double gammp(double a, double x)