nolta / Elliptic.jl

Elliptic integral and Jacobi elliptic special functions
MIT License
31 stars 16 forks source link

Use Hypergeometric functions for BigFloat support #30

Open dlfivefifty opened 1 year ago

dlfivefifty commented 1 year ago

From @TSGut (CC @MikaelSlevinsky):

julia> α = 4.453667231591123
4.453667231591123

julia> K = Elliptic.K(1-1/α^2)
2.9043516240612575

julia> K2f1 = convert(eltype(α),π)/2*HypergeometricFunctions._₂F₁(one(eltype(α))/2,one(eltype(α))/2,1,1-1/α^2)
2.904351624061259

julia> @test K ≈ K2f1
Test Passed
TSGut commented 1 year ago

There is also a variant that could be used for E.

julia> α = 4.453667231591123
4.453667231591123

julia> E = Elliptic.E(1-1/α^2)
1.0608774783105355

julia> E2f1 = convert(eltype(α),π)/2*HypergeometricFunctions._₂F₁(-one(α)/2,one(α)/2,1,1-1/α^2)
1.0608774783105355

julia> @test E ≈ E2f1
Test Passed