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:
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?