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

Improve accuracy of asymptotic expansion for very large arguments (besselj, bessely)

Open heltonmc opened this issue 1 year ago • 0 comments

Right now, for very large arguments there are some roundoff errors when the argument is very large.

julia> Bessels.besseljy_large_argument(11, 2e9)
(-6.441564914025336e-6, 1.663779215046842e-5)

julia> Bessels.besseljy_large_argument(big"11", big"2e9")
(-6.441565416278640966871190587378818114705713999893782928810537933625658595387592e-06, 1.663779195601368418718142484679994485342917679346562260323801403887512758594912e-05)

It would be nice to improve the accuracy of these expansions.

Edit: Though it does look like it then improves...

julia> SpecialFunctions.besselj(11.0, 2e9)
-6.441565416278642e-6

julia> besselj(11.0, 2e9)
-6.441564914025336e-6

julia> besselj(11.0, 2e20)
4.600631613945902e-11

julia> SpecialFunctions.besselj(11.0, 2e20)
4.600631613945894e-11

heltonmc avatar Aug 08 '22 15:08 heltonmc