I want to numerically integrate this equation (in python without calling Mathematica):

$\int_0^\infty {\rm d}k f(k) J_v(r k) J_n(s k)$

where $f(k)$ is a non-smooth function, $J_v$ are the Bessel function of the fist kind, and $r$ and $s$ are just constants. In practice I have to integrate

$\int_a^b {\rm d}k f(k) J_v(r k) J_n(s k)$

with usual values for $a \sim 10^{-8}$ and $b \sim 10^{16}$, where $f(k)→0$ for $b≥10^{16}$. I wrote a code based on Levin's paper that partially solves my problem, with this method I can integrate up to 50 without much computational power. A exponential change of variables $k=10^u$, helps me to integrate up to $∼10^2$.

Now, I can compute the integral for larger upper limits with more computational power but the error of the integral dramatically increase when I reach $b∼10^3$, pretty far for what I want to do.

I have tested this method in the case where $f(k)=k^{−p}$ and using the analytical solution of this paper and using Mathematica with the following instruction:

NIntegrate[f[k]BesselJ[v,r k]BesselJ[v, s k], {k, a, b}, Method -> {"OscillatorySelection", Method -> "LevinRule", "FourierFiniteRangeMethod" -> {"GlobalAdaptive"}}]

Clearly Mathematica deals with the integral nicely, much better than my code.

So, my question is: what am I missing? What does Mathetica do that I don't?

Any help or ideas are really appreciated. Thanks in advance!

  • 2
    $\begingroup$ It has been a while since I last looked at Levin's paper, but in the meantime: have you seen this? $\endgroup$ – J. M. will be back soon Jul 29 '15 at 15:51
  • $\begingroup$ @J. M. Apropos of Levin, I was against him, and on the losing team, in a doubles ping pong game last month. $\endgroup$ – Daniel Lichtblau Jul 29 '15 at 16:12
  • $\begingroup$ @Daniel, As in David Levin of Tel Aviv himself? I didn't know he played table tennis… ;) $\endgroup$ – J. M. will be back soon Jul 29 '15 at 16:22
  • $\begingroup$ @J. M. Yes, that Levin. Basement here $\endgroup$ – Daniel Lichtblau Jul 29 '15 at 17:00
  • 1
    $\begingroup$ Hmm, in that case, apart from Levin's papers, you might consider looking for papers by Arieh Iserles on oscillatory integration. If all else fails, you can always fall back on Longman's method. $\endgroup$ – J. M. will be back soon Jul 29 '15 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.