Add logabsgamma(::Complex)
dlfivefifty opened this issue · comments
This was a bit surprising:
julia> logabsgamma(1+im)
ERROR: MethodError: no method matching logabsgamma(::Complex{Int64})
Closest candidates are:
logabsgamma(::Real) at ~/.julia/packages/SpecialFunctions/gXPNz/src/gamma.jl:599
Stacktrace:
[1] top-level scope
@ REPL[1]:1
Could be added temporarily as a fallback through the real part of loggamma
julia> log(gamma(1+im))
-0.650923199301859 - 0.3016403204675329im
julia> log(abs(gamma(1+im)))
-0.650923199301859
julia> loggamma(1+im)
-0.6509231993018592 - 0.30164032046753286im
julia> real(loggamma(1+im))
-0.6509231993018592
Oh and it would need sign(gamma(z))
Basically the fallback is
function logabsgamma(z::Complex)
g = loggamma(z)
real(g), cis(imag(g))
end