Community
cancel
Showing results for
Did you mean:
Beginner
245 Views

## incomplete gamma function

i have found the gamma function but NOT the incomplete gamma function. Is this function lacking in the intel fortran?it seems so strange!thanks gabriella
3 Replies
Black Belt
245 Views
It is not strange to find that an infrequently used special function is not part of the standard library.

There are scores of special functions that are not provided as standard intrinsic functions in Fortran or other programming languages. It is up to you to find a library such as IMSL, or source code from places such as the Netlib collection (the function you want is probably DGAMI).
Black Belt
245 Views
Here is code written in java for IncGamma.This code uses my gamma stirling method if are you interested i can post the code.

[bash]public double IncGammaLow(double x,double a){ double sum = 0; double result = 0; if(x < 0.0f){ throw new IllegalArgumentException("arg x must be greater than 0 t" + x); }else if( a < 0.0f || a == 0.0f || a < 1.0f){ throw new IllegalArgumentException("arg a must be not less than 1.0 t" + a); }else{ double exp,gamma_arg,gamma,nom,denom,power,gamma2; long k; int i,j; double[]array = new double[32]; double run_value; k = -1; run_value = 0; for(i = 0;i = run_value; } for(j = 0;j; } exp = Math.exp(-x); power = Math.pow(x, a); gamma2 = this.GammaStirlingApprox(a); result = power*gamma2*exp*sum; } return result; }[/bash]

New Contributor I
245 Views
Gabriella, here you'll find a code for the incomplete gamma function for complex arguments:
http://www.cmis.csiro.au/Alan_Miller/index.html
Just look up for the cincgam.f90 code.