MathGroup Archive 2002

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

Search the Archive

Re: ListIntegrate Info.

  • To: mathgroup at
  • Subject: [mg36465] Re: ListIntegrate Info.
  • From: Selwyn Hollis <slhollis at>
  • Date: Sun, 8 Sep 2002 03:30:41 -0400 (EDT)
  • References: <al9kjt$as1$>
  • Sender: owner-wri-mathgroup at

Be sure to note the following and what comes after it near the end of 
the Help Browser info on ListIntegrate:

``This package has been included for compatibility with previous 
versions of Mathematica. The functionality of this package has been 
superseded by improvements made to InterpolatingFunction."

In other words, ListIntegrate is a dinosaur that you don't need at all!

To integrate a list of data with Mathematica, one can proceed in either 
of two ways: (1) Construct an interpolating function and use NIntegrate 
(or, better, NIntegrateInterpolatingFunction) on that (which is what 
ListIntegrate apparently does); or (2) apply a simple routine that 
implements the trapezoidal rule, Simpson's rule, or maybe some higher 
order method.

Assuming you've chosen to take path #1, you need to realize the following:

(a) NIntegrate[Interpolation[data, InterpolationOrder->1][x], {x,a,b}] 
is equivalent to the trapezoidal rule;

(b) NIntegrate[Interpolation[data, InterpolationOrder->2][x], {x,a,b}] 
is *not* equivalent to Simpson's rule (because of the peculiar way that 
Interpolation works);

(c) Interpolation[data, InterpolationOrder->k] generally does not return 
a smooth function unless you set InterpolationOrder->n-1, where n is the 
number of data points, which is the case where a single polynomial of 
degree n-1 fits the data points.

(d) If you want to integrate a smooth interpolant, you can do this:

     NIntegrate[SplineFit[data, Cubic][x][[2]], {x,a,b}]

To understand better the way Interpolation works, look closely at the 
plots created by the following:

    data = Table[{i, Random[]}, {i, 0, 5}];
    Do[Plot[Interpolation[data, InterpolationOrder->k][x],
     {x, 0, 5}, PlotRange -> All], {k, 1, 6}]

(The last of those plots will give a warning message.)

Having said all that, you really should consider path #2 instead. Here 
are a couple of links to a MathGroup discussion of last July (somehow 
the thread got split up):

I hope all this helps some.

Selwyn Hollis

qualsystems*nospam* at wrote:
 > Hi,
 > Can someone provide me more information on how ListIntegrate works
 > than what is contained in the version 4 manual ? Is there a website
 > perhaps or tutorial ?
 > I would like to know how the beginning and end of a list of {x,y}
 > pairs that is being integrated is dealt with by ListIntegrate.
 > I know a series of polynomials is somehow used but how ? Do these
 > overlap ? Are they piecewise continuous ?
 > Are these polynomials available for inspection ? How do they change as
 > a function of "k" ?
 > optimum "k" value for a given list ? For any given list, will accuracy
 > monotonically increase with increasing values of "k" ? Is there
 > anything in the Option Inspector that could cause unexpected behaivor
 > with ListIntegrate ?
 > Are there any good rules of thumb or procedures that will help ensure
 > a reasonable answer is produced ?
 > Is there a way of estimating the error or accuracy of  integration
 > performed by ListIntegrate ?
 > Thanks for any help.

  • Prev by Date: RE: Can anyone simplify this?
  • Next by Date: RE: Solve of inverse quadratic finite element problem - resend
  • Previous by thread: ListIntegrate Info.
  • Next by thread: RE: Re: ListIntegrate Info.