SpecialFunctions.jl icon indicating copy to clipboard operation
SpecialFunctions.jl copied to clipboard

besselk with a BigFloat argument fails

Open omalled opened this issue 7 years ago • 1 comments

I'm trying to update some code that currently uses my own implementation of the inverse Laplace transform to use InverseLaplace.jl instead. My code makes a call like SpecialFunctions.besselk(0, x). My implementation of the inverse Laplace transform results in x having type Float64, but InverseLaplace.jl wants x to be a BigFloat. This creates a problem

julia> SpecialFunctions.besselk(0, 1.0)
0.42102443824070834

julia> SpecialFunctions.besselk(0, BigFloat(1.0))
ERROR: MethodError: no method matching besselk(::BigFloat, ::Complex{BigFloat})
Closest candidates are:
  besselk(::T<:AbstractFloat, ::Complex{T<:AbstractFloat}) where T<:AbstractFloat at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:502
  besselk(::Real, ::Complex) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:499
  besselk(::Any...; kwargs...) at deprecated.jl:1303
  ...
Stacktrace:
 [1] besselk(::Float64, ::Complex{BigFloat}) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:500
 [2] besselk(::Int64, ::BigFloat) at /homedir/.julia/v0.6/SpecialFunctions/src/bessel.jl:450

It seems like that first candidate fits the bill, but julia disagrees.

omalled avatar Sep 07 '18 18:09 omalled

There is currently no Bessel k function for BigFloats (the MPFR library we use only provides Bessel j and y functions, see https://www.mpfr.org/mpfr-current/mpfr.html#Special-Functions).

simonbyrne avatar Sep 07 '18 22:09 simonbyrne