Next: Exercises
Up: Labs and Projects for
Previous: Purpose
> with(student);
> trapezoid(x^2,x=0..4,4);
> evalf(trapezoid(x^2,x=0..4,4));
> evalf(trapezoid(x^2,x=0..4,10));
> simpson(x^2,x=0..4);
> evalf(simpson(x^2,x=0..4));
> evalf(simpson(x^2,x=0..4,10));
The trapezoidal rule uses trapezoids to approximate the area over the i-th subinterval as shown above with only two subintervals in the figure for y = x2 +1.
Since the area of a trapezoid is the width times the average of the two heights, the area of the trapezoid above the i-th subinterval is
Adding up all of the areas gives us the usual formula
for a uniform partition with N subintervals. You can think of the trapezoidal rule as the result of approximating the function by straight line segments.
The derivation of Simpson's rule is more complicated and will not be discussed here. It is described in detail in the text (Bradley and Smith pgs. 303-306). The basic idea is to fit the function f(x) with segments of parabolas. Three points are required to define a parabola, so two adjacent subintervals are used for each parabola segment. (This is why an even number of subintervals are required for Simpson's method.)
Christine M Palmer