1
$\begingroup$

This is the function that I am trying to integrate, I have interpolated it for best results (would rather not):

The integrand

There is a 'singularity' around 0, but I get the warnings and bad results even when integrating from $10^8$. Starting after the peak (say $1.5 \cdot 10^8$) does not help.

The error I am getting is:

NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in t near {t} = {5.3144*10^7}. NIntegrate obtained 1.74145.*^22 and 4.07865.*^18 for the integral and error estimates.

When I lower PrecisionGoal from 5 to 2, there is no warning message but the result is very much off the known value.

$\endgroup$
  • $\begingroup$ The function? Also you mention "far from the known value". How did you take this value? $\endgroup$ – Dimitris May 29 '15 at 14:36
  • 1
    $\begingroup$ Maybe rescale your function and your arguments, to a more natural range. Your argument is of the order 10^8 and the values are of the order of 10^-17. $\endgroup$ – kiara May 29 '15 at 14:44
  • 3
    $\begingroup$ Please show us the expression for the function you are trying to integrate, rather than just the plot; also show us how you interpolated it, and what expressions you use for the integral. Finally, what is your question exactly? $\endgroup$ – MarcoB May 29 '15 at 14:50
  • 1
    $\begingroup$ You can use Integrate on an InterpolatingFunction. It usually works better. $\endgroup$ – Michael E2 May 29 '15 at 15:51
  • $\begingroup$ Since you know the function is well behaved in the region of interest you can always just manually sample and use trapezoidal rule, foregoing NIntegrates adaptive sampling and convergence checks of course. related mathematica.stackexchange.com/a/48360/2079 $\endgroup$ – george2079 May 29 '15 at 19:21

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.