SpecialFunctions.jl icon indicating copy to clipboard operation
SpecialFunctions.jl copied to clipboard

zeros of Bessel J function

Open jlapeyre opened this issue 7 years ago • 2 comments

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.

jlapeyre avatar Apr 18 '18 10:04 jlapeyre

I'd find this really useful.

jtravs avatar Sep 09 '18 10:09 jtravs

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

jlapeyre avatar Sep 11 '18 14:09 jlapeyre