Skip to content

default besselh to k=1 like the docs say it does #118

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

Merged
merged 2 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/BesselFunctions/hankel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ function besselh(nu::Real, k::Integer, x)
end
end

besselh(nu, x) = besselh(nu, 1, x)

function besselh(nu::AbstractRange, k::Integer, x::T) where T
(nu[1] >= 0 && step(nu) == 1) || throw(ArgumentError("nu must be >= 0 with step(nu)=1"))
if nu[end] < x
Expand Down
4 changes: 4 additions & 0 deletions test/hankel_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ v, x = 14.3, 29.4
@test isapprox(hankelh1(0.5:1:25.5, 15.0), SpecialFunctions.hankelh1.(0.5:1:25.5, 15.0), rtol=2e-13)
@test isapprox(hankelh1(1:50, 100.0), SpecialFunctions.hankelh1.(1:50, 100.0), rtol=2e-13)
@test isapprox(hankelh2(1:50, 10.0), SpecialFunctions.hankelh2.(1:50, 10.0), rtol=2e-13)

#test 2 arg version
@test besselh(v, 1, x) == besselh(v, x)
@test besselh(1:50, 1, 10.0) == besselh(1:50, 10.0)
Loading