# How to integrate a function which is only known at discrete points

I have an integration to do. I want to integrate.

$\int_0^\infty sin^2(2\pi t)f(t)dt$

where $f(t)$ takes values from an array in the form $\{t,f(t)\}$

The time steps in the array is 1.1s. Can you please suggest a method to do this? I tried using the Trapezoidal method for numerical integration but gave a bad approximation. Is there an easy method with inbuilt function or another method?

-
Providing some code for f[t] or using Integrate might help :) –  Öskå Aug 7 at 9:55
f[t] is just an array of points in the form {t,f(t)} and seems like integrate cannot perform integration over array. –  jason Aug 7 at 10:02
Well, one might need the array right? And have you tried anything to say that it doesn't perform integration over an array? Please share. –  Öskå Aug 7 at 10:05
Your function f(t) is discrete? –  molekyla777 Aug 7 at 10:12

Let's denote values {t, f(t)} as F, then interpolate this array with ListInterpolation.

fx = ListInterpolation[F[[All, 2]], {F[[1, 1]], F[[-1, 1]]}]


Now we may use Integrate with fx

Integrate[Sin[2*Pi*t]*fx[t], {x, F[[1, 1]], F[[-1, 1]]}]


As you see, it's not exactly what you want: the domain of integration is {F[[1, 1]], F[[-1, 1]]}.

-

If you were to have, for example,

dt = .01;
tbl = Table[{t, Exp[Cos[t]]}, {t, 0, 10, dt}];


(that is, your $f(t)$ corresponds to my tbl) then another way is

Total @ MapThread[
Sin[2*Pi #1]^2 * #2 &,