Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am confused about Gamma Incomplete function calculation in Mathematica and MatLab:

For example, in Mathematica: Gamma[5,3] = 19.56

But in MatLab: gammainc(5,3) = 0.8753

I don't know which one is correct, Matlab result or Mathematica result?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

In Mathematica, Gamma[a, z] refers to the upper incomplete Gamma function, given by

$$\Gamma(a,z)=\int_z^\infty t^{a-1}e^{-t}\,dt$$

whereas in MATLAB, gammainc(z, a) refers to the regularized lower incomplete Gamma function

$$P(a,z)=\frac{1}{\Gamma(a)}\int_0^z t^{a-1}e^{-t}\, dt$$

Obviously, they give different results. To get MATLAB's result in Mathematica, use the following:

gammainc[a_, z_] := Gamma[a, 0, z]/Gamma[a]
N@gammainc[3, 5]

(* 0.875348 *)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.