Thursday, July 17, 2014

Integral estimate from many short quadratic functions...

The end result is:

The reasoning is, suppose you have your function f(x) and a point a, then these two functions are close to equal around x=0 for smaller and smaller values of d...

The bottom formula M is just the second degree Maclauren series of f(x-a) using divided differences for the first and second derivative..
So for example:

The red function approximates sin(x-.75) around 0
So to find the area of sin(x) from let's say [x-d... x+d] we can integrate M with respect to x instead:

Then evaluate this integral from x-d to x+d with x = 0.

That simplified nicely! 
Now to do a whole interval we can just do the sum of this above function over the interval but that will count all but the very left and very right interval twice as [x-d..x+d] and [x-2*d..x] overlap the [x-d..x] region and the same on the right side of x, but either one quadratic function will be an overestimate and the other an underestimate or they're both overestimates or they're both underestimates any of which case the average is better than the worst of the two, so we divide by 2 after all is done and that minimizes the error overall, this is an oversimplification, but correcting for the far left and far right interval only being counted once adds complication for not much gain, and the error when d is small is small.

And that's the given formula... for example [.5..3] for sin(x) and d=.01 :
for d = .001

**Comparison with other methods**
Other than the fact that the above example is a periodic function which the trapezoidal rule tends to work for really well, for other classes of functions it should be much better than the trapezoidal rule for approximately the same amount of computation because it fits closer to the real curve... It compares to the Simpson's rule that it is quite like doing the Simpson's rule over many small intervals and adding the results together. Since the Simpson's rule uses a quadratic function over the entire interval and this uses many smaller quadratic functions over the interval, so it is more accurate in general, though Simpson's rule is faster to compute.
It would be pretty straight forward to extend this to many small cubic, quartic, etc.. approximations over small intervals.

No comments:

Post a Comment