Question

I need to calculate

∫ [x₁ to x₂] 1/√(1-k² sinh²(x)) dx

in my program. This can be expressed using the incomplete elliptic integral of the first kind evaluated in a complex argument:

-i (F(ix₂ | -k²) - F(ix₁ | -k²)).

I found that GSL provides the elliptic integral F but it does not seem to be overloaded for complexes. Is there some extension available for this or a different library I could use instead?

Was it helpful?

Solution

OK, this was a rushed question. But in case someone might be interested in the same in the future, perhaps a self-answer will be helpful.

Looking at GSL's source code, I found that F(φ,k) is reduced (as long as φ ∈ [-π,π]) to

sin(φ) RF(1-sin²(φ), 1-k²sin²(φ), 1),

where RF is another GSL function. There's no F(iφ,k) but we can safely plug a pure imaginary φ in the above as all the three arguments stay real:

sin(iφ) = i sinh(φ)
=>
F(iφ,k) = sin(iφ) RF(1+sinh²(φ), 1+k²sinh²(φ), 1)
=>
-i F(iφ | -k^2) = sinh(φ) RF(1+sinh²(φ), 1-k²sinh²(φ), 1)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top