Skip to content

Commit b1ebeb6

Browse files
committed
add besselj small arguments
1 parent 9e16b47 commit b1ebeb6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/besselj.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,16 @@ function besselj_large_argument(v, x::T) where T
176176
b = sqrt(2 / T(pi)) / sqrt(αp * x)
177177
return cos(α)*b
178178
end
179+
180+
function besselj_small_arguments_orders(v, x::T) where T
181+
MaxIter = 100
182+
out = zero(T)
183+
a = inv(factorial(v)) * (x/2)^v
184+
t2 = (x/2)^2
185+
for i in 1:MaxIter
186+
out += a
187+
abs(a) < eps(T) * abs(out) && break
188+
a = -a / (v + i) * inv(i) * t2
189+
end
190+
return out
191+
end

0 commit comments

Comments
 (0)