[Math] How to compute the incomplete Gamma function with an negetive parameter in MATLAB

gamma functionintegrationMATLAB

I need to compute the upper incomplete gamma function $$\Gamma(-0.5,0.5r)$$
But in MATLAB, the upper incomplete Gamma function "gammainc" is defined as
$$\Gamma\left(\alpha ; x\right) = \dfrac{1}{\Gamma(\alpha)}\int\limits_{x}^{\infty}t^{\alpha – 1}e^{-t}\text{ d}t\text{.}$$ with parameter $\alpha > 0$.

When I type "gammainc(0.5,-0.5*1,'upper')", the MATLAB says "Error using gammainc, A must be real and non-negative!"

But actually what I want to get is defined as this From Wolfram MathWorld:
$$\Gamma(\alpha;x) = \int\limits_{x}^{\infty}t^{a-1}e^{-t}\text{ d}t\text{.}$$
So what do I have to do to get the results in MATLAB ?

Best Answer

Here's a MATLAB function that claims to compute the upper incomplete Gamma function for negative $\alpha$: http://www.mathworks.com/matlabcentral/fileexchange/29321-evaluation-of-the-upper-incomplete-gamma-function/content/gamma_incomplete.m

Related Question