Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Providing some code for f[t] or using Integrate might help :) – Öskå Aug 7 '14 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 '14 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 '14 at 10:05
Your function f(t) is discrete? – molekyla777 Aug 7 '14 at 10:12

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 &,
    Thread @ tbl
   ] * dt

But of course any technique can be easily used (trapezoidal or more sophisticated approaches).

share|improve this answer

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]]}.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.