Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
3  
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
1  
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
1  

2 Answers 2

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

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

Your Answer

 
discard

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.