Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numerical integration and list of points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87674] Re: Numerical integration and list of points
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 15 Apr 2008 05:53:43 -0400 (EDT)

On 4/14/08 at 6:53 AM, guerom00 at gmail.com (guerom00) wrote:

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

Yes, it seems straightforward and it should work. If it isn't
working for you, then there must be something else going on with
your code you haven't shown. For example,

In[1]:= data =
   Sort[Transpose@{#, Sin[#]} &[RandomReal[{0, Pi}, {50}]]];
f = Interpolation[data];
NIntegrate[f[x], {x, 0, Pi}]

Out[3]= 2.

Gives the expected result


  • Prev by Date: Re: Numerical integration and list of points
  • Next by Date: Re: Numerical integration and list of points
  • Previous by thread: Re: Numerical integration and list of points
  • Next by thread: Re: Numerical integration and list of points