0
$\begingroup$

I want to Numerically integrate the following function

int[t_] := NIntegrate[A1[t - t3 - t2 - t1]*A2[t - t3 -t2]*A3[t - t3]*Exp[I*(h*(t1 + t2 + 
   t3) + h*(t1) + h*(t1 + t2))], {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500}, Method -> "AdaptiveMonteCarlo"]

Take h=5 (it doesn't matter in this case). A1, A2 and A3 are some interpolating function. So I want to use MonteCarlo method because A1, A2 and A3 are not converging properly in "Global Adaptive" method (or takes very long time to converge), but coverging quickly in MonteCarlo.

int[t_] := NIntegrate[A1[t - t3 - t2 - t1]*A2[t - t3 - t2]*A3[t - t3]
, {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500}, Method -> "AdaptiveMonteCarlo"]

This converges perfectly fine. However,

NIntegrate[Exp[I*(h*(t1 + t2 + 
    t3) +h*(t1) + h*(t1 + t2))], {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500},Method -> "AdaptiveMonteCarlo"]

this is not coverging at all (My deduction is that the exponential function is highly oscillating). Is it possible to somehow converge this function using some precursors?

$\endgroup$
14
  • $\begingroup$ h = 5; Integrate[ Exp[I*(h*(t1 + t2 + t3) + h*(t1) + h*(t1 + t2))], {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500}] results in 1/750 I (-1 + E^(2500 I))^2 (1 + E^(2500 I)) (-1 + E^(7500 I). Its numerical value equals 0.00110115 + 0.00178614 I. The one is close to zero and this explains the problems with the numerical integration since the modulus of the integrand equals 1. $\endgroup$
    – user64494
    Commented Apr 25, 2022 at 13:53
  • 1
    $\begingroup$ Let NIntegrate choose method automaticaly, is very exact and causes no problems NIntegrate[ Exp[I*(h*(t1 + t2 + t3) + h*(t1) + h*(t1 + t2)) /. h -> 5], {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500}] (* 0.00110115 + 0.00178614 I *) $\endgroup$
    – Akku14
    Commented Apr 25, 2022 at 14:15
  • $\begingroup$ @Akku14 I know that, but the problem is I cannot choose Global Adaptive method for A1, A2 and A3. That's the problem. So, when you combine the two integrands, it won't converge. $\endgroup$
    – sslucifer
    Commented Apr 25, 2022 at 14:17
  • $\begingroup$ BTW, the integral Integrate[ Exp[I*(h*(t1 + t2 + t3) + h*(t1) + h*(t1 + t2))], {t1, 0, Infinity}, {t2, 0, Infinity}, {t3, 0, Infinity}] diverges for h>=0. $\endgroup$
    – user64494
    Commented Apr 25, 2022 at 14:18
  • 1
    $\begingroup$ Show us the A1 ,A2 ,A3 $\endgroup$
    – Akku14
    Commented Apr 25, 2022 at 14:20

1 Answer 1

0
$\begingroup$

Since I didn't get any answer, I did some digging in the docs of NIntegrate and I found a reasonable method,

int[t_] := NIntegrate[A1[t - t3 - t2 - t1]*A2[t - t3 -t2]*A3[t - t3]*Exp[I*(h*(t1 + t2 + t3) + h*(t1) + h*(t1 + t2))]
, {t1, 0, 500}, {t2, 0, 500}, {t3, 0, 500}, Method -> {"LevinRule", "LevinFunctions" -> {"ExpRelated"}, "Points" -> 2}"]

So if you have an integrand of the form $f(x)*g(x)$, where $f(x)$ is non-oscillating and $g(x)$ is highly oscillating, one can use the Levin rule. In my case, the integrand is exactly of the form. The efficiency is not as good as I would like, but this is the best I came up with.

$\endgroup$
3
  • $\begingroup$ All that is not so simple. Up to the documentation, the Levin rule is applicable to one-dimensional integrals only. Amn't I right? $\endgroup$
    – user64494
    Commented Apr 27, 2022 at 16:12
  • $\begingroup$ @user64494 Most of the example in the doc is for one dimensional integral, but it is nowhere written as it is only applicable for one dimensional. In my case, the 3-dimensional integral works well for Levin rule. $\endgroup$
    – sslucifer
    Commented Apr 27, 2022 at 16:30
  • $\begingroup$ Your claim "Most of the example in the doc is for one dimensional integral" does not correspond to reality: only the one-dimensional case is considered in the documentation. I'd like to quote e.g. "A Levin-type rule estimates the integral of an oscillatory function by approximating the antiderivative as a product of a polynomial and the oscillatory part of the integrand". I don't know any antiderivatives for multiple integrals. Sorry, "In my case, the 3-dimens[c]ional integral works well for Levin rule" are empty words. Deep regard. $\endgroup$
    – user64494
    Commented Apr 27, 2022 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.