I want to use elliptic integrals with complex arguments, and for that, I am using ArbNumerics.jl
(as suggested in this post).
The issue is that I get nan
for a reason I do not understand.
This code works great:
ArbNumerics.elliptic_e(ArbNumerics.ArbComplex(1.57079632679489661923132169164 - 3.783672704329450982374478608948im), ArbNumerics.ArbComplex(1/2))
# 15.57243365199836315804428747305 - 0.5034307962536973664952181708151im
I chose this weird number since it is the value of arcsin(22)
.
To get this, I defined the following function
function asin_mathematica(z)
- 1im * log(1im * z + sqrt(1-z^2))
end
Which is the definition of arcsine by Mathematica (see Eq. (1) here)
So arcsin(22)
is this value:
asin_mathematica(ArbNumerics.ArbComplex(22.0))
# 1.57079632679489661923132169164 - 3.783672704329450982374478608948im
Now comes the problem. When I run
ArbNumerics.elliptic_e(asin_mathematica(ArbNumerics.ArbComplex(22.0)), ArbNumerics.ArbComplex(1/2))
# nan + nanim
I get this nan
.
I want to add some more peculiar information on this issue. If you take a value of the argument of the arcsine to be smaller than 1 then everything works fine. For example:
ArbNumerics.elliptic_e(
asin_mathematica(ArbNumerics.ArbComplex(0.8)),
ArbNumerics.ArbComplex(1/2))
# 0.8681394584167536706972243469339 + 0e-38im
ArbNumerics.elliptic_e(
asin_mathematica(ArbNumerics.ArbComplex(1.1)),
ArbNumerics.ArbComplex(1/2))
# nan + nanim
How can I fix this?