The purpose of this lab is to give you practice performing analytical and numerical integration with Maple.
The Maple int command will handle most integrals that can be done analytically. Both definite and indefinite integrals can be done, as shown by the following examples.
Notice that Maple doesn't include a constant of integration for indefinite integrals.
Unfortunately, there are lots of integrals that can't be done analytically. (The ones that can be done tend to appear in calculus texts. The ones that can't be done often appear in real life.) When Maple can't do an integral, it simply returns it unevaluated. The example below show how to use the evalf command to get Maple to evaluate the integral numerically.
Maple uses a sophisticated numerical integration routine with automatic error control to evaluate definite integrals that it can't do analytically. In the next section of this lab, we introduce two simple numerical integration techniques that are widely used by engineers and scientists. These two methods are almost as simple as the rectangular rules from the last lab, but they are accurate enough to be useful.
The rectangular rules we used in the last lab are very simple to understand and use, but they are not very efficient. By this, we mean that a large number of subintervals is often required to get accurate results. Two widely used rules for approximating areas are the trapezoidal rule and Simpson's rule. The Maple student package has commands trapezoid and simpson that implement these methods. The command syntax is very similar to the rectangular approximations. See the examples below. Note that an even number of subintervals is required for the simpson command.
The trapezoidal rule uses trapezoids to approximate the area over the subinterval as shown below with only two subintervals in Figure for .
Figure: Geometry of the trapezoidal rule.
Since the area of a trapezoid is the width times the average of the two heights, the area of the trapezoid above the subinterval is
Adding up all the areas gives 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. The basic idea is to fit the function 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 is required for Simpson's method.)