# Improve speed to obtain numerical values of Bessel function?

Posted 2 years ago
3034 Views
|
4 Replies
|
2 Total Likes
|
 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 Answer
4 Replies
Sort By:
Posted 2 years ago
 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. Answer
Posted 2 years ago
 The range of the argument is as followsBesselJ[m,z]-10 < Re(z) < 10 -10 < Im(z) < 100 <= m <= 20 Answer
Posted 2 years ago
 Is $m$ always an integer? If you're letting $m$ be real, I don't see that much hope in making something fast. Answer
Posted 2 years ago
 Sorry, didn't mention this. m is always an integer. Answer