Scaled spherical bessel functions

8 views (last 30 days)
Bart Boesman
Bart Boesman on 12 Mar 2013
Answered: Joshua Frechem on 2 Apr 2019
Hi all,
Does anyone know about routines that compute - preferably scaled - spherical bessel functions of the first and second kinds immediately by recursion? This in order to avoid under- and overflow for high-order bessels with small arguments. I know about the standard routines implemented in matlab for the bessel functions of integer order and for deriving the spherical ones from them, however I'd like to have a more stable routine.
Looking forward to any tips.
Thanks,
Bart

Answers (1)

Joshua Frechem
Joshua Frechem on 2 Apr 2019
I doubt this is still needed, but:
If you want to write your own script, you can use outward recursion for small arguments and then inward recursion for large arguments. However, this requires the knowledge of and in order to do the outward recursion and they are also helpful for the inward recursion for scaling (since they will be very large when unscaled). However, there are other ways to do the scaling because the amplitudes all add to one, which can be reasonably approximated if you take n high enough. The issue with the outward recursion is that it becomes unstable after approximately n=10, while the inward recursion doesn't, but it gets huge as you iterate in and you might run into precision issues if you don't work carefully - i.e. use doubles.
If you use the below algorithm and code it in matlab, you get excellent results for nearly any order spherical bessel for, at least a wide range, of the argument. I have tested it out to 50, but I can not confirm it past that. Though, they have scaling done so that it should work very well for large arguments.
If you make use of a parfor loop over the argument, you can interate the recursion through your desired argument range quite quickly, though perhaps not the most efficiently.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!