problem with gammainc function
Show older comments
I am calculating incomplete gamma function using gammainc gammainc(0.04344,0,'upper') and I get the result as zero
but when I calculate same integral numerically I get result 2.6. I have also verified this results with other software, which gives the same result.
for example (using MuPAD)
double(feval(symengine,'igamma', 0, 0.043444))
gives me the result 2.6
Why I am not able to get same result with gammainc...
2 Comments
Jonathan Sullivan
on 18 Dec 2012
Did you?
Both MATLAB and WolframAlpha agree.
Accepted Answer
More Answers (1)
Peter Perkins
on 19 Dec 2012
This is just a standardization issue. The doc for MATLAB's gammainc and MuPAD's igamma clearly show that the former is standardized by 1/gamma(a), while the latter is not. And so (e.g. for a == .1):
>> gammainc(0.043444,.1,'upper') * gamma(.1)
ans =
2.23413826678516
>> double(feval(symengine,'igamma', .1, 0.043444))
ans =
2.23413826678516
You can't do that comparison at a==0, but in the limit, gamma(0) is Inf and expint(0.043444) is finite, so gammainc(0.043444,0,'upper') ought to be 0.
2 Comments
Peter Perkins
on 26 Dec 2012
neo, you don't seem to have gotten my point. Read the descriptions of the functions you are calling, and you will find they are not calculating the same things. There is not "a problem" with MATLAB's gamminc when a is 0. It may be that what you want is in fact expint(0.043444), but gammainc(0.043444,0,'upper') is correct when it returns 0.
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!