Revision 1109 trunk/src/df1b2separable/df3gammp.cpp
df3gammp.cpp (revision 1109)  

12  12 
double get_values(double x,double y,int print_switch); 
13  13  
14  14  
15 
df1b2variable log_negbinomial_density(double x,const df1b2variable& _xmu,


15 
df1b2variable log_negbinomial_density(double x,const df1b2variable& _xmu, 

16  16 
const df1b2variable& _xtau) 
17  17 
{ 
18  18 
ADUNCONST(df1b2variable,xmu) 
...  ...  
53  53 
tmp=x+5.5; 
54  54 
tmp = (x+0.5)*log(tmp); 
55  55 
ser=1.0; 
56 
for (j=0;j<=5;j++)


56 
for (j=0;j<=5;j++) 

57  57 
{ 
58  58 
x += 1.0; 
59  59 
ser += cof[j]/x; 
...  ...  
95  95 
h *= del; 
96  96 
if (fabs(value(del)1.0) < EPS) break; 
97  97 
} 
98 
if (i > ITMAX)


98 
if (i > ITMAX) 

99  99 
cerr << "a too large, ITMAX too small in gcf" << endl; 
100  100 
gammcf=exp(x+a*log(x)(gln))*h; 
101  101 
} 
...  ...  
119  119 
gln=gammln(a); 
120  120  
121  121 
if (value(x) <= 0.0) { 
122 
if (value(x) < 0.0)


122 
if (value(x) < 0.0) 

123  123 
cerr << "x less than 0 in routine gser" << endl; 
124  124 
gamser=0.0; 
125  125 
return; 
126 
}


127 
else


126 
} 

127 
else 

128  128 
{ 
129  129 
ap=a; 
130  130 
del=sum=1.0/a; 
...  ...  
148  148 
{ 
149  149 
df3_two_variable gamser,gammcf,gln; 
150  150  
151 
if (value(x) < 0.0  value(a) <= 0.0)


151 
if (value(x) < 0.0  value(a) <= 0.0) 

152  152 
cerr << "Invalid arguments in routine gammp" << endl; 
153  153 
if (value(x) < (value(a)+1.0)) { 
154  154 
gser(gamser,a,x,gln); 
Also available in: Unified diff