Skip to content

Commit c600f1a

Browse files
committed
add besselj tests
1 parent f0676fa commit c600f1a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Bessels.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Bessels
22

33
export besselj0
44
export besselj1
5+
export besselj
56

67
export bessely0
78
export bessely1

src/Float64/bessely.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function bessely1(x::Float64)
5151
return p * SQ2OPI(T) / sqrt(x)
5252
end
5353
end
54+
#=
5455
function bessely(n::Int, x)
5556
if n < 0
5657
n = -n
@@ -74,6 +75,7 @@ function bessely(n::Int, x)
7475
7576
anm2 = bessely0(x)
7677
anm1 = bessely1(x)
78+
an = zero(x)
7779
7880
k = 1
7981
r = 2 * k
@@ -87,3 +89,4 @@ function bessely(n::Int, x)
8789
8890
return sign * an
8991
end
92+
=#

test/besselj_test.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# general array for testing input to SpecialFunctions.jl
2-
x = 0.01:0.01:100.0
2+
x = 1e-6:0.01:100.0
33

44
### Tests for besselj0
55
j0_SpecialFunctions = SpecialFunctions.besselj0.(big.(x)) # array to be tested against computed in BigFloats
@@ -58,3 +58,9 @@ j1_32 = besselj1.(Float32.(x))
5858
# test that Inf inputs go to zero
5959
@test besselj1(Inf32) == zero(Float32)
6060
@test besselj1(Inf64) == zero(Float64)
61+
62+
## Tests for besselj
63+
# note this is not complete just a simple test
64+
65+
@test besselj(3, 1.0) SpecialFunctions.besselj(3, 1.0)
66+
@test besselj(-5, 6.1) SpecialFunctions.besselj(-5, 6.1)

0 commit comments

Comments
 (0)