Statistical function - upper incomplete gamma function

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
Please somobody.. :(
Last edited on
Is there somewhere a function itself, without the whole package .. as this function incgama
Topic archived. No new replies allowed.