Apr 5, 2012 at 11:31am
I need upper incomplete gamma function for C++.. I have here lower incomplete gamma function.. But i need upper incomplete gamma function.
1 2 3 4 5 6 7 8 9 10 11
|
double incgamma (double x, double a){
double sum=0;
double term=1.0/a;
int n=1;
while (term != 0){
sum = sum + term;
term = term*(x/(a+n));
n++;
}
return pow(x,a)*exp(-1*x)*sum;
}
|
Difference between upper and lower functions:
http://en.wikipedia.org/wiki/Incomplete_gamma_function
Last edited on Apr 5, 2012 at 8:10pm
Apr 6, 2012 at 11:50am
Last edited on Apr 6, 2012 at 11:51am
Apr 6, 2012 at 12:46pm
Is there somewhere a function itself, without the whole package .. as this function incgama