How to calculate Bessel Function of the first kind fast?

1.5k Views Asked by At

I have wrote a C++ code to calculate the first kind of Bessel Functon by its infinite series definition. I took the sum of the first 20 series as the value of Bessel Function, which is same as MATLBA besselj()'s result by the accuracy of 1e-14. However, in my code there are huge amount times of Bessel value calculation and more the 90% of the whole running time is cost by Bessel value calclution. This method is too slow. Is there any method to calculate bessel function' quicker? In my calculation the arguments are Complex, the real parts are less than 3 and the imagine part are less than 1e-3. For there are many iteractions in the code so each bessel value should have the accuracy no less than 1e-10. Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

I'd suggest using a polynomial approximation that's designed to give good answers over the interval that interests you. The best way to do this is through Chebyshev approximation. I suspect that the Chebyshev approximation will have a lot less terms than the infinite series definition you are using. One way to calculate a good Chebyshev approximation would be to use the Chebfun package.

Alternatively, searching for "polynomial approximation of Bessel function" will provide you with plenty of material. Like this, for example.