Is “spherical Bessel function” available in any of the libraries in Julia? I am aware that SpecialFunctions.jl package has Bessel function.

Looks like GSL.jl might have (on phone so cannot check). BTW, found it via pkg.julialang.org - that might help with the search.

If you use SpecialFunctions.jl You can define the spherical bessel `j`

and `y`

functions in one line each:

```
sphericalbesselj(ν, x) = √(π/2x)*besselj(ν+1/2, x)
sphericalbessely(ν, x) = √(π/2x)*bessely(ν+1/2, x)
```

I have to admit SpecialFunctions is a magical-magical package. It should be in Base julia :).

Thanks, this link will be very useful. GSL library does have the spherical bessel functions.

Yes, this is what I had implemented originally. I was concerned about two things:

- Need to write an additional check if x is close to 0.
- My guess is that the spherical Bessel functions might be faster to compute than cylindrical Bessel functions because they may be expressed in terms of trig functions.

My program calls these functions several thousand of times so performance was important.

Maybe those should be defined in SpecialFunctions.jl?

It used to be.

It was removed do it can be extended more easily. Without being tied to the very slow language release cycle, and being updatable for people still on the LTS.

E.g. in this case we might get a win from it since that can, as @dpsanders suggests. Be added with a simple PR

Ah that makes even more sense thanks for explaining.

I have made a PR to SpecialFunctions.jl with the spherical bessel functions. Test / performance / reliability suggestions much appreciated! https://github.com/JuliaMath/SpecialFunctions.jl/pull/196