I am using Mathematica to numerically integrate a numerically-defined function (from an interpolation and data). This function has a sequence of somewhat unevenly spaced sharp peaks which dominate the integral. When I use NIntegrate, the initial sampling doesn't pick up all of the the sharp peaks, and hence, the total value of the integral is wrong.
I would like to set the initial step size used by NIntegrate to be something small enough that it will find all of the relevant peaks. However, I would prefer not to use a numerical integration method with a fixed sampling size, as the adaptive features are beneficial in actually determining the contribution from each peak.
One option, of course, is to break the integral up into a series of sequentially evaluated integrals; however, as the peaks are unevenly spaced, this would be time-consuming. I'd much prefer setting the initial spacing if that's possible.
Any ideas? Thank you!
(The specific function to be integrated is not very important, and since it is interpolated, I did not attach it here but if there's a need for it I can provide a sample.)
Comments
Post a Comment