SpecialFunctions.jl
SpecialFunctions.jl copied to clipboard
zeros of Bessel J function
Here is code to compute zeros of the besselj function. Are you interested in a PR ?
It could be more efficient, maybe cache some of first zeros. But, it works. The asymptotic formula happens to land in the basin of the correct zero, even for the first zero. It then uses root finding.
I'd find this really useful.
I added support for Bessel functions of the second kind bessely_zero to FunctionZeros.jl. In testing it, I discovered an error in bessely in mpath.
I mentioned it might be kinda slow because I only use root finding, use a slow root finder, don't supply derivatives, etc. But, its still 100x faster than mpmath.
In [4]: import mpmath
In [5]: %timeit mpmath.besseljzero(1.0,1)
1000 loops, best of 3: 484 µs per loop
julia> using FunctionZeros; using BenchmarkTools;
julia> @btime besselj_zero(1.0,1)
3.018 μs (48 allocations: 2.16 KiB)
3.8317059702075125