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!