RE: Re: ListIntegrate Info.

*To*: mathgroup at smc.vnet.net*Subject*: [mg36499] RE: [mg36465] Re: ListIntegrate Info.*From*: "DrBob" <drbob at bigfoot.com>*Date*: Mon, 9 Sep 2002 00:29:49 -0400 (EDT)*Reply-to*: <drbob at bigfoot.com>*Sender*: owner-wri-mathgroup at wolfram.com

Check out the NumericalMath`GaussianQuadrature` and NumericalMath`NewtonCotes` packages. Bobby Treat -----Original Message----- From: Selwyn Hollis [mailto:slhollis at earthlink.net] To: mathgroup at smc.vnet.net Subject: [mg36499] [mg36465] Re: ListIntegrate Info. 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: <<NumericalMath`SplineFit` 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): http://library.wolfram.com/mathgroup/archive/2002/Jul/msg00490.html http://library.wolfram.com/mathgroup/archive/2002/Jul/msg00519.html I hope all this helps some. ---- Selwyn Hollis qualsystems*nospam* at mindspring.com 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. > > >