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?

  • 3
    $\begingroup$ Providing some code for f[t] or using Integrate might help :) $\endgroup$ – Öskå Aug 7 '14 at 9:55
  • $\begingroup$ f[t] is just an array of points in the form {t,f(t)} and seems like integrate cannot perform integration over array. $\endgroup$ – jason Aug 7 '14 at 10:02
  • 1
    $\begingroup$ 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. $\endgroup$ – Öskå Aug 7 '14 at 10:05
  • $\begingroup$ Your function f(t) is discrete? $\endgroup$ – molekyla777 Aug 7 '14 at 10:12
  • 1
    $\begingroup$ reference.wolfram.com/language/ref/Interpolation.html $\endgroup$ – george2079 Aug 7 '14 at 10:21

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).

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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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