Re: Numerical integration and list of points

*To*: mathgroup at smc.vnet.net*Subject*: [mg87662] Re: [mg87622] Numerical integration and list of points*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Tue, 15 Apr 2008 05:51:23 -0400 (EDT)*Reply-to*: hanlonr at cox.net

data = Sort[RandomReal[{0, 1}, {10, 2}]]; f = Interpolation[data]; xMin = f[[1, 1, 1]]; xMax = f[[1, 1, 2]]; Plot[f[x], {x, xMin, xMax}] Integrate[f[x], {x, xMin, xMax}] -2.16322 NIntegrate[f[x], {x, xMin, xMax}] -2.16322 Bob Hanlon ---- guerom00 <guerom00 at gmail.com> wrote: > Hello everyone, > > I have a function which I read as a list of points. I want then to > estimate its integral. I do more or less this : > > data={{x1,y1},{x2,y2},...,{xN,yN}} > f=Interpolation[data] > NIntegrate[f[x],{x,x1,xN}] > > Is it the correct way ? Because Mathematica hangs without giving me an > answer although it seems a pretty straightforward thing to do... > > Thanks for any suggestions. >