incomplete gamma function calculation

Hi,
I have this equation:
gamma(5,x) = 2
how I can find the value of x?
Thanks

댓글 수: 2

José-Luis
José-Luis 2013년 5월 24일
Matlab's gamma function only accepts one input argument.
Jamal Ahmad
Jamal Ahmad 2013년 5월 24일
this is incomplete gamma function, in matlab we can write as the following:
gammainc(a,x)
a = 5 and the result of the above function is 2 I need the value of x.

댓글을 달려면 로그인하십시오.

 채택된 답변

Sean de Wolski
Sean de Wolski 2013년 5월 24일
편집: Sean de Wolski 2013년 5월 24일

0 개 추천

I don't believe that's possible:
gammainc(5,0)
gammainc(5,1000);
it never goes near two.
More
options = optimoptions(@fminunc,'tolfun',10^-10,'tolx',10^-12);
xv = fminunc(@(x)(gammainc(5,x)-(10^-4)).^2,4,options)
%xv =15.6926
gammainc(5,xv)
% ans =
% 1.0004e-04

댓글 수: 7

Jamal Ahmad
Jamal Ahmad 2013년 5월 24일
you are right, I tried to write the equation simply. the actual value is 10^-4
thanks again.
Sean de Wolski
Sean de Wolski 2013년 5월 24일
see More
Jamal Ahmad
Jamal Ahmad 2013년 5월 24일
I receive this error:
Undefined function 'optimoptions' for input arguments of type 'function_handle'.
Error in Untitled2 (line 2) options = optimoptions(@fminunc,'tolfun',10^-10,'tolx',10^-12);
Walter Roberson
Walter Roberson 2013년 5월 24일
There are different meanings for "incomplete gamma function". The more obvious one has to do with upper or lower tail, but MATLAB also defines the upper-tail version differently than some other systems such as Maple do. Where MATLAB defines the upper tail as 1 - gammainc(a,x), MAPLE uses gamma(a) in place of 1, creating the "complementary upper gamma function". And in that usage of "incomplete gamma" there is a solution, at approximately 8.307413412
Sean de Wolski
Sean de Wolski 2013년 5월 24일
optimoptions is new in R2013a. If you're using an older release, use optimset which has a slightly different syntax.
Jamal Ahmad
Jamal Ahmad 2013년 5월 24일
Thank you very much. I use R2012a. Now it works.
options = optimset('tolfun',10^-10,'tolx',10^-12); xv = fminunc(@(x)(gammainc(5,x)-(10^-4)).^2,4,options) gammainc(5,xv)
Jamal Ahmad
Jamal Ahmad 2013년 5월 24일
now I have this warning:
Warning: Gradient must be provided for trust-region algorithm; using line-search algorithm instead. > In fminunc at 367 In test_2 at 12

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2013년 5월 24일

0 개 추천

It appears to me that you will need to proceed numerically.
Matt J
Matt J 2013년 5월 24일

0 개 추천

xv = fzero(@(z) gammainc(5,z.^2)- 2 , sqrt(xguess)).^2;

카테고리

도움말 센터File Exchange에서 Gamma Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by