# Improve speed to obtain numerical values of Bessel function?

GROUPS:
 Markus Schmidt 2 Votes Hi.I would to solve an optical waveguide problem, in which I need to numerically calculate multiple times Bessel functions with complex argument. The corresponding code works, but it is quite slow since it takes Mathematica ages to numerically get the value of the Bessel function.The following code ilustrates the problem : Table[N[BesselJ[m, x + I]], {m, 100}, {x, 100}]; // AbsoluteTiming This takes about 21 second, using Matlab below 1 second with identical precision. It there a way to speed this up to reasonable times (i.e., speed up the Bessel function calculation (incl. complex argument))? I found the following link, but I' m not an expert in C, so I' m not sure what to do : https://mathematica.stackexchange.com/questions/84982/how-to-improve-performance-of-besselj-to-the-level-of-gslThanks in advance,Markus
10 months ago
4 Replies
 Evaluating Bessel functions for complex arguments is an expensive undertaking in general. I haven't checked yet, so does MATLAB already support fast complex evaluations of Bessel functions? (I believe their implementation was only limited to real arguments.)In case a fast routine is really needed, can you give typical ranges for both the real and imaginary parts? A different method of evaluation is often done in the small and in the large (real or imaginary part) cases.
10 months ago
 The range of the argument is as followsBesselJ[m,z]-10 < Re(z) < 10 -10 < Im(z) < 100 <= m <= 20
10 months ago
 Is $m$ always an integer? If you're letting $m$ be real, I don't see that much hope in making something fast.
10 months ago
 Sorry, didn't mention this. m is always an integer.