MathGroup Archive 2001

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

Search the Archive

Re: "Incremental Integration"?


On Sat, 1 Dec 2001 08:19:28 +0000 (UTC), in comp.soft-sys.math.mathematica you wrote:

>Given a rather messy function  f[x] , I want to make a Table of its integral 
>from  x0 up to a set of equally spaced points xn = x0 + n*dx  with maximum value 
>xFinal -- in other words
>   g[x_] := NIntegrate[f[xi], {xi, x0, x}]
>   Table[ {x, g[x]}, {x, x0, xFinal, dx}]
>Is Mathematica smart enough to calculate each successive value using the 
>previous value plus integration just over the increment in x to the next value?

I believe (I'll post this so experts can correct me) that high-order integration schemes yield only biased estimates of the partial integrals up to the interior integration points. Only the full integral is accurate to the nominal order. So there is, I think, a fundamental impediment to extracting partial integrals along the way toward calculating the full integral. So even if your force an integrator to choose specific points of integration, good estimates of the partial integrals to these points of integration are not available.

The low-order trapezoidal rule is an exception: The full integral is expressed in terms of sum of partial integrals. If your "messy" function is multiply discontinuous in slope (but not in value), then trapezoidal might be as good as any. This is trivial to code, so I won't bother.

Otherwise, given my comments above, I would do the following:

With[{dx = 0.1, xmax = 1}, 
   Table[NIntegrate[f[x], {x, x1, x1 + dx}], {x1, 0, xmax - dx, dx}]

An alternative, perhaps easier to read (when pasted into Mathematica) is

\!\(\(\(With[{dx = 0.1, xmax = 1}, \[IndentingNewLine]Table[
      N[\[Integral]\_x1\%\(x1 + dx\)f[x] \[DifferentialD]x], {x1, 0, 
        xmax - dx, dx}]\[IndentingNewLine]]\)\(\[IndentingNewLine]\)
Tom Burton

  • Prev by Date: Re: "Incremental Integration"?
  • Next by Date: Re: Weird trigonometric integral and Simplification question
  • Previous by thread: Re: "Incremental Integration"?
  • Next by thread: Re: Import power point slides to Mathematica - please help !