Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logabsgamma(::Complex) #437

Open
dlfivefifty opened this issue Mar 24, 2023 · 3 comments
Open

Add logabsgamma(::Complex) #437

dlfivefifty opened this issue Mar 24, 2023 · 3 comments

Comments

@dlfivefifty
Copy link
Member

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
@MikaelSlevinsky
Copy link
Contributor

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

@MikaelSlevinsky
Copy link
Contributor

Oh and it would need sign(gamma(z))

@MikaelSlevinsky
Copy link
Contributor

Basically the fallback is

function logabsgamma(z::Complex)
    g = loggamma(z)
    real(g), cis(imag(g))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants