"Roger Stafford" <email@example.com> wrote in message <firstname.lastname@example.org>... > "Marcio Barbalho" <email@example.com> wrote in message <firstname.lastname@example.org>... > > No, that was not my point. I can't change the data, nor should I. What I am trying to find is an alternative integrator to 'trapz'. > > To expound further upon the point Urs and I have been making about your data, Marcio, even though the data may have been determined very accurately from some hypothetical infinite continuum source of data, it can only be a discrete representation of that source. All the points between each of the discrete points are missing, and yet by definition what calculus defines as an integral depends, not just on those discrete points, but on all the points in between. For that reason, no integration routine that depends only on discrete data can ever give you a perfectly accurate answer. The error it is bound to make depends on the nature of that infinitude of points that were left out. > > The use of discrete quadrature routines is based purely on the ability of the known discrete points to predict something of the probable values of those that are missing. If your source has rather a smooth nature where its derivatives are reasonably well-behaved, there is something to be gained in using higher order routines. If the source is very unruly so that such prediction is inaccurate, then you are better off using the simpler routines such as trapz which does only first order approximation. > > You will notice that the above argument in no way casts aspersions on the data-gathering process itself, which may have been excellent. It states only that something is inherently being lost in the attempt to represent a continuum of data with a discrete representation. > > Roger Stafford
If your data is noisy, then it turns out that you don't really want to use a high order interpolant to integrate. Trapezoidal rule can actually be the best choice under some circumstances.