1
$\begingroup$

I am trying to numerically integrate a messy function over the range $(0,\infty)$. Rather than integrating to $\infty$, I programmed a dynamic cutoff for which I can specify a desired precision. For example, if I want to guarantee 3 digits of precision, I call my function with a parameter "3" and the cutoff adjusts accordingly:

myIntegral[digitGoal_]:=NIntegrate[f[x],{x,0,cutoff[digitGoal]}]

cutoff[digitGoal_]:=<...>

The trouble is, the function is very sharply concentrated near zero, so at some point, when the cutoff becomes sufficiently large, the important region stops being sampled enough, and precision actually goes down. When I call myIntegral with increasing digits of precision, the results seem to improve for the first few digits, but eventually start to oscillate randomly about some value without getting more precise.

Is this a well-known issue, with standard techniques for resolving it? My best guess would be to instruct Mathematica to dynamically increase the sampling rate as the domain of integration increases, so that it doesn't "miss" the important part of the integrand as the region of integration increases. Any tips on how to do this?

$\endgroup$
  • $\begingroup$ There is a tutorial tutorial/NIntegrateOverview/NIntegrateIntegrationStrategies where you will find a dozen (if not more) of various strategies applied to singular integrals. There is no single approach, since it is integral-specific. In addition to that, you might like to have a look into this discussion: mathematica.stackexchange.com/questions/212167/… $\endgroup$ – Alexei Boulbitch Mar 11 at 14:51

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.