@@ -8,6 +8,8 @@ x = 1e-15
8
8
@test Bessels. sphericalbessely (1 , x) ≈ SpecialFunctions. sphericalbessely (1 , x)
9
9
@test Bessels. sphericalbessely (5.5 , x) ≈ SpecialFunctions. sphericalbessely (5.5 , x)
10
10
@test Bessels. sphericalbessely (10 , x) ≈ SpecialFunctions. sphericalbessely (10 , x)
11
+ @test Bessels. sphericalbesselk (5.5 , x) ≈ SpecialFunctions. besselk (5.5 + 1 / 2 , x) * sqrt ( 2 / (x* pi ))
12
+ @test Bessels. sphericalbesselk (10 , x) ≈ SpecialFunctions. besselk (10 + 1 / 2 , x) * sqrt ( 2 / (x* pi ))
11
13
12
14
# test zero
13
15
@test isone (Bessels. sphericalbesselj (0 , 0.0 ))
@@ -20,33 +22,48 @@ x = 1e-15
20
22
@test Bessels. sphericalbessely (10 , 0.0 ) == - Inf
21
23
@test Bessels. sphericalbessely (290 , 0.0 ) == - Inf
22
24
25
+ @test isinf (Bessels. sphericalbesselk (0 , 0.0 ))
26
+ @test isinf (Bessels. sphericalbesselk (4 , 0.0 ))
27
+ @test isinf (Bessels. sphericalbesselk (10.2 , 0.0 ))
28
+
23
29
# test Inf
24
30
@test iszero (Bessels. sphericalbesselj (1 , Inf ))
25
31
@test iszero (Bessels. sphericalbesselj (10.2 , Inf ))
26
32
@test iszero (Bessels. sphericalbessely (3 , Inf ))
27
33
@test iszero (Bessels. sphericalbessely (4.5 , Inf ))
28
34
35
+ @test iszero (Bessels. sphericalbesselk (0 , Inf ))
36
+ @test iszero (Bessels. sphericalbesselk (4 , Inf ))
37
+ @test iszero (Bessels. sphericalbesselk (10.2 , Inf ))
38
+
29
39
# test NaN
30
40
@test isnan (Bessels. sphericalbesselj (1.4 , NaN ))
31
41
@test isnan (Bessels. sphericalbesselj (4.0 , NaN ))
32
42
@test isnan (Bessels. sphericalbessely (1.4 , NaN ))
33
43
@test isnan (Bessels. sphericalbessely (4.0 , NaN ))
34
44
45
+ @test isnan (Bessels. sphericalbesselk (1.4 , NaN ))
46
+ @test isnan (Bessels. sphericalbesselk (4.0 , NaN ))
47
+
35
48
# test Float16, Float32 types
36
49
@test Bessels. sphericalbesselj (Float16 (1.4 ), Float16 (1.2 )) isa Float16
37
50
@test Bessels. sphericalbessely (Float16 (1.4 ), Float16 (1.2 )) isa Float16
38
51
@test Bessels. sphericalbesselj (1.4f0 , 1.2f0 ) isa Float32
39
52
@test Bessels. sphericalbessely (1.4f0 , 1.2f0 ) isa Float32
40
53
54
+ @test Bessels. sphericalbesselk (Float16 (1.4 ), Float16 (1.2 )) isa Float16
55
+ @test Bessels. sphericalbesselk (1.0f0 , 1.2f0 ) isa Float32
41
56
42
57
for x in 0.5 : 1.0 : 100.0 , v in [0 , 1 , 5.5 , 8.2 , 10 ]
43
58
@test isapprox (Bessels. sphericalbesselj (v, x), SpecialFunctions. sphericalbesselj (v, x), rtol= 1e-12 )
44
59
@test isapprox (Bessels. sphericalbessely (v, x), SpecialFunctions. sphericalbessely (v, x), rtol= 1e-12 )
60
+ @test isapprox (Bessels. sphericalbesselk (v, x), SpecialFunctions. besselk (v+ 1 / 2 , x) * sqrt ( 2 / (x* pi )), rtol= 1e-12 )
45
61
end
46
62
47
63
for x in 5.5 : 4.0 : 160.0 , v in [20 , 25.0 , 32.4 , 40.0 , 45.12 , 50.0 , 55.2 , 60.124 , 70.23 , 75.0 , 80.0 , 92.3 , 100.0 , 120.0 ]
48
64
@test isapprox (Bessels. sphericalbesselj (v, x), SpecialFunctions. sphericalbesselj (v, x), rtol= 3e-12 )
49
65
@test isapprox (Bessels. sphericalbessely (v, x), SpecialFunctions. sphericalbessely (v, x), rtol= 3e-12 )
66
+ @test isapprox (Bessels. sphericalbesselk (v, x), SpecialFunctions. besselk (v+ 1 / 2 , x) * sqrt ( 2 / (x* pi )), rtol= 1e-12 )
50
67
end
51
68
52
69
@test isapprox (Bessels. sphericalbessely (270 , 240.0 ), SpecialFunctions. sphericalbessely (270 , 240.0 ), rtol= 3e-12 )
0 commit comments