0
$\begingroup$

I need to compute the upper incomplete gamma function $\Gamma(0,i\pi K)$ where $i=\sqrt{-1}$ and K is real.

I have some basic idea about what this "special function" is, but am not used to using it. I am confused because MATLAB refuses to compute this for me - I get an error message says that inputs must be real.

The CAS wxMaxima computes it no problem with or without complex or inputs. How can I implement this in MATLAB?

In MATLAB the command I am using is 1 - gammainc(a,z)

In wxMaxima the command is gamma_incomplete(a,z) or gamma_incomplete_regularized(a,z).

EDIT: What I mean to say here is that, in MATLAB, I want to get the same result that gamma_incomplete(a,z) gives in wxMaxima. For example, in wxMaxima the command gamma_incomplete(0,%i*%pi); gives the output 0.28114072518757*%i-0.073667912046426 Now what do I have to do in MATLAB to get the same result?

2 Answers 2

2

Your inputs are the wrong way round. Additionally, you should specify that you want the upper tail of the gamma function, rather than subtracting from 1. This gives more accurate values in the case where the real part of $\Gamma(x,a)$ is near to 1.

On Wolfram Alpha you have

$\Gamma(1,i) = 0.5403 - 0.8415i$

and in Matlab

>> gammainc(1i,1,'upper') ans =      0.5403 - 0.8415i 

which matches up.

  • 0
    Excellent. I was running out of ideas on that one!2012-10-11
0

Chris mentioned the symbolic toolbox. The upper incomplete gamma function is now implemented as igamma in the symbolic toolbox.

>> igamma(0,i*pi) ans =   -0.0737 + 0.2811i