incomplete gamma function calculation

2 views (last 30 days)
I have this equation:
gamma(5,x) = 2
how I can find the value of x?
José-Luis on 24 May 2013
Matlab's gamma function only accepts one input argument.
Jamal Ahmad
Jamal Ahmad on 24 May 2013
this is incomplete gamma function, in matlab we can write as the following:
a = 5 and the result of the above function is 2 I need the value of x.

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 24 May 2013
Edited: Sean de Wolski on 24 May 2013
I don't believe that's possible:
it never goes near two.
options = optimoptions(@fminunc,'tolfun',10^-10,'tolx',10^-12);
xv = fminunc(@(x)(gammainc(5,x)-(10^-4)).^2,4,options)
%xv =15.6926
% ans =
% 1.0004e-04
Jamal Ahmad
Jamal Ahmad on 24 May 2013
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 on 24 May 2013
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

Sign in to comment.

More Answers (2)

Walter Roberson
Walter Roberson on 24 May 2013
It appears to me that you will need to proceed numerically.

Matt J
Matt J on 24 May 2013
xv = fzero(@(z) gammainc(5,z.^2)- 2 , sqrt(xguess)).^2;

Community Treasure Hunt

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

Start Hunting!