# Integrating highly oscillatory functions

I have a logarithmic grid, upon which i have two functions that are similar to this one (this is only the last 100 points): These are essentially very similar to a Sin function at this point. I need to take the integral of two of these functions multiplied together, along with the position:

$$\int_0^R f_1(r)\; r\; f_2(r)\; dr$$

Unfortunately, this gives me functions similar to the following: I need to integrate these with high accuracy, but I'm not sure how to do it. There are a few options that I know of, but I expect there are more that I'm not sure of:

• I can interpolate the original functions (is cubic interpolation a good interpolation strategy for sinusoids and products of sinusoids?), then multiply the interpolated functions together at specific points and use something from this scicomp post

• I can switch the order of the interpolation and multiplication, multiplying the values I have, then taking the interpolation.

• I can do a simpler Simpsons rule approximation, though I'm not sure how to do such a thing on a non-uniform grid.

• Can you write out the form of the function, or is it a black box? – Bill Barth Feb 7 '14 at 23:01
• @BillBarth: Unfortunately, it is a black box. – Andrew Spott Feb 7 '14 at 23:11
• Are the functions periodic, or you understand how they are not periodic if so? If they're periodic, taking the Fourier transform and analytically integrating the trigonometric polynomial will give very high accuracy (exponential convergence for analytic functions). – Geoffrey Irving Feb 8 '14 at 1:39
• They are periodic within a certain range. Is taking the Fourier transform and then integrating the trigonometric polynomial really that efficient? I have to do this much more than 100,000 times, so efficiency matters at least a little bit. – Andrew Spott Feb 8 '14 at 2:01
• @GeoffreyIrving: Sorry, they are on a non-uniform grid, which makes taking the fourier transform difficult. – Andrew Spott Feb 10 '14 at 22:36