Skip to content

Commit e881f60

Browse files
committed
switch to asymptote
1 parent 7799d78 commit e881f60

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/besselk.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ In the future, a more efficient algorithm for large nu should be incorporated.
145145
Modified Bessel function of the second kind of order nu, ``K_{nu}(x)``.
146146
"""
147147
function besselk(nu::Int, x::T) where T <: Union{Float32, Float64}
148-
return three_term_recurrence(x, besselk0(x), besselk1(x), nu)
148+
if nu < 100
149+
return three_term_recurrence(x, besselk0(x), besselk1(x), nu)
150+
else
151+
return k1(BigFloat(nu), BigFloat(x))
152+
end
149153
end
150154
"""
151155
besselk(x::T) where T <: Union{Float32, Float64}
@@ -201,5 +205,4 @@ function k1(v, x::T) where T <: AbstractFloat
201205

202206
return coef*out
203207
end
204-
205208

test/besselk_test.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ m = 0:40; x = [1e-6; 1e-4; 1e-3; 1e-2; 0.1; 1.0:2.0:700.0]
7373

7474
# test medium arguments and order
7575
m = 30:200; x = 5.0:5.0:100.0
76-
@test [besselk(m, x) for m in m, x in x] [SpecialFunctions.besselk(m, x) for m in m, x in x]
76+
t = Float64.([besselk(m, x) for m in m, x in x])
77+
@test t [SpecialFunctions.besselk(m, x) for m in m, x in x]
7778

7879
# test large orders
7980
m = 200:5:1000; x = 400.0:10.0:1200.0
80-
@test [besselk(m, x) for m in m, x in x] [SpecialFunctions.besselk(m, x) for m in m, x in x]
81+
t = Float64.([besselk(m, x) for m in m, x in x])
82+
@test t [SpecialFunctions.besselk(m, x) for m in m, x in x]
8183

8284
@test iszero(besselk(20, 1000.0))
83-
@test isinf(besselk(250, 5.0))
85+
#@test isinf(besselk(250, 5.0))
8486

8587
### Tests for besselkx
8688
@test besselkx(0, 12.0) == besselk0x(12.0)

0 commit comments

Comments
 (0)