I'm trying to compute the upper incomplete gamma function defined like in this post. If I use
from scipy.special import gamma,gammainc
from numpy import linspace
a = 0
z = (2+3j)*np.linspace(0,10)
gamma(a)*(1-gammainc(a,z))
where z
is a complex vector I get an error
TypeError: ufunc 'gammainc' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Is there an alternative function to do the calculation? There doesn't seem to be a problem when I try to do this with WolframAlpha's Gamma
function.
x
(orz
) being an integration boundary. How do you expect this integral to be performed in the complex plane? Integration in the complex plane usually depends on the integration path and not only on the boundaries. I am not aware how WolframAlpha deals with that situation but that would be the first thing to find out. Also note that for the specific case in your example (a = 0
) there is an analytic solution for the integral and you can use thescipy.special.expi
function to compute the result (for real value boundaries). – Bohannonexp(-t)
provides nice decay at infinity. On the left halfplane, analytic continuation works with a branch cut along the negative real axis. – Fortepiano