MathGroup Archive 2003

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

Search the Archive

Re: numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40588] Re: numerical integration
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Thu, 10 Apr 2003 03:43:26 -0400 (EDT)
  • References: <b70ntk$9jb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

data={{0,4.308115176},{180,11.83807029},
      {320,9.819597477},{380,9.003587475},
      {420,9.646700866},{540,9.003587475},
      {660,8.601966768},{720,8.090496405},
      {780,7.49290292},{900,7.536283436},
      {1020,7.086922454},{1080,6.876137912},
      {1140,6.580371983},{1200,6.430040607},
      {1320,6.300111915},{1380,6.077755024},
      {1500,6.101258682},{1680,5.96360292},
      {1800,5.821356082}};

xmin = Min[data[[All,1]]];
xmax = Max[data[[All,1]]];

f = Interpolation[data];

Plot[f[x], {x,xmin,xmax},
    PlotStyle->RGBColor[0, 0, 1], 
    Epilog->{AbsolutePointSize[4], 
        RGBColor[1, 0, 0], Point/@data},
    ImageSize->400];

Integrate[f[x], {x,xmin,xmax}]

14134.9

Looking at the effect of interpolating order on the integral:

ord = Table[{n, Integrate[
        Interpolation[data, InterpolationOrder->n][x], 
        {x,xmin,xmax}]}, {n,1,5}]

{{1,13701.4},{2,13885.3},{3,14134.9},{4,13946.9},{5,13524.5}}

Plot[Interpolation[ord][n], {n,1,5},
    PlotStyle->RGBColor[0, 0, 1], 
    Epilog->{AbsolutePointSize[5], 
        RGBColor[1, 0, 0], Point/@ord}];

Needs["NumericalMath`NIntegrateInterpolatingFunct`"];

NIntegrateInterpolatingFunction[f[x], {x,xmin,xmax}]

14134.9

"If you simply need to find the integral of an InterpolatingFunction 
object (as opposed to a function of one), it is better to use Integrate 
because this gives you the result which is exact for the polynomial 
approximation used in the InterpolatingFunction object."


Bob Hanlon

In article <b70ntk$9jb$1 at smc.vnet.net>, "C B" <cbhat at purdue.edu> wrote:

<< I have data which looks like ..

data = {{0,4.308115176},{180,11.83807029},{320,9.819597477},{380,
9.003587475},{420,9.646700866},{540,9.003587475},{660,
8.601966768},{720,8.090496405},{780,7.49290292},{900,7.536283436},{1020,7.08
6922454},{1080,6.876137912},{1140,
6.580371983},[1200,6.430040607},{1320,6.300111915},{1380,
6.077755024},{1500,6.101258682},{1680,5.96360292},{1800,5.821356082}}


X value is time (sec)
Y value is gas readings
I could plot the XY plot but I need to get area under the curve. For that I
tried
<<NumericalMath`NIntegrateInterpolatingFunct`
Interpolation
NIntegrateInterpolatingFunction

But I am just not being able to figure out the exact sytax. Does anyone have
any experience with this kind of problem? >><BR><BR>


  • Prev by Date: Re: split a list
  • Next by Date: Re: split a list
  • Previous by thread: RE: numerical integration
  • Next by thread: Alternative to ListContourPlot3D