problem with gammainc function
显示 更早的评论
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 个评论
Jonathan Sullivan
2012-12-18
Did you?
Both MATLAB and WolframAlpha agree.
采纳的回答
更多回答(1 个)
Peter Perkins
2012-12-19
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 个评论
Peter Perkins
2012-12-26
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Eigenvalue Problems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!