Evaluation via Maple's built-in numeric integrator
|
•
|
Control-drag the given definite integral.
|
•
|
Context Panel: 2-D Math≻Convert To≻Inert Form
|
•
|
Context Panel: Approximate≻10 (digits)
|
|
|
|
|
Maple's built-in Trapezoid rule can be accessed either through the Approximate Integration tutor or through the ApproximateInt command in the Student Calculus1 package.
•
|
Figure 6.7.1(a) shows the state of the
tutor when the Trapezoid rule has been selected for approximating the given integral with .
|
•
|
The actual value of the integral is determined by Maple's built-in integrator, and the approximate value by the selected numeric method. The last digit of the value obtain by the tutor does not agree with the value obtained in the Mathematical Solution section because of a slight difference in how the numeric evaluation is handled by Maple.
|
|
|
Figure 6.7.1(a) Approximate Integration tutor
|
|
|
|
|
|
The form of the ApproximateInt command that generates the image in the tutor's plot window is available at the bottom of the tutor. Changing output = plot to output = sum causes the return to be the unevaluated sum that implements Maple's form of the Trapezoid rule. Changing output = plot to output = value causes the return to be the sum of exact terms that must be evaluated and added to obtain the Trapezoid rule approximation. However, if there is a floating-point number somewhere in the statement of the integral, then Maple evaluates and adds the terms in the Trapezoid rule numerically. These usages of the ApproximateInt command are illustrated in Table 6.7.1(a).
Initialize
|
•
|
Tools≻Load Package: Student Calculus 1
|
|
Loading Student:-Calculus1
|
Context Panel: Assign to a Name≻
|
|
Apply the ApproximateInt command with output set to sum
|
|
Apply the ApproximateInt command with output set to value
|
|
Apply the ApproximateInt command with output set to value, and the right endpoint a float
|
=
|
Table 6.7.1(a) Using the ApproximateInt command to implement the Trapezoid rule in Maple
|
|
|
Maple's implementation of the Trapezoid rule differs from the statement in Table 6.7.1. Using the ApproximateInt command, it can be seen that Maple evaluates the integrand at the interior nodes twice, rather than (as per Table 6.7.1) evaluating once and multiplying by 2.
|
|
|
The Trapezoid rule is implemented from first principles in Table 6.7.1(b). The integrand is defined as the function ; and the stepsize, as . The endpoints are written as floats so that the evaluation of the sum is numeric, and not symbolic.
•
|
Context Panel: Assign Function
|
|
|
•
|
Context Panel: Assign Name
|
|
|
•
|
Context Panel:
Evaluate and Display Inline
|
|
=
|
Table 6.7.1(b) Implementing the Trapezoid rule from first principles
|
|
|