I know that I asked the same question before, but as I am pretty new here the question was asked poorly and not reproducible. Therefore I try to do it better here. (If I only ed
It's also worth noting that in the integrate.c source file, the description for the error message is
error messages
...
ier = 5 the integral is probably divergent, or
slowly convergent. it must be noted that
divergence can occur with any other value of ier.
so despite the fact the message says "probably-divergent" it seems with your code it is more likely to be slowly convergent.
Also, you can continue to run when you get this message and extract the error if you set stop.on.error=FALSE
r <- integrate(Vectorize(function(t)
integrate(function(g) ff(g,t), -2.5,0)$value
), -2, 2, stop.on.error=FALSE);
r$value
R doesn't claim to be a fancy mathematical solver like the Wolfram products such as Mathematica. It doesn't do any symbolic simplifications of integrals and that's the kind of stuff that Wolfram's been perfecting over the years. if you're just looking to numerically solve a bunch of double integrals, programs like Mathematica or Maple are probably better choices. That just doesn't seem to be where R spends as much of its development resources.