Chapter 6: Techniques of Integration
Section 6.7: Numeric Methods
Use the Trapezoid rule with n=10 to approximate the definite integral ∫141+sinxlnx+1 ⅆx.
Define fx=1+sinxlnx+1, and let h=4−110=310. Then
Of course, a computing device of some sort is used to evaluate and sum the terms in the Trapezoid rule.
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)
∫141+sinxlnx+1 ⅆx→at 10 digits5.078061188
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 n=10.
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).
Tools≻Load Package: Student Calculus 1
Context Panel: Assign to a Name≻F
1+sinxlnx+1→assign to a nameF
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
ApproximateIntF,x=1..4.0,partition=10,method=trapezoid,output=value = 5.067162904
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 n−1 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 fx; and the stepsize, as h. The endpoints are written as floats so that the evaluation of the sum is numeric, and not symbolic.
Context Panel: Assign Function
fx=F→assign as functionf
Context Panel: Assign Name
Evaluate and Display Inline
h2f1.+f4.+2∑k=19f1.+k h = 5.067162905
Table 6.7.1(b) Implementing the Trapezoid rule from first principles
<< Previous Section Section 6.7
Next Example >>
© Maplesoft, a division of Waterloo Maple Inc., 2021. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
Download Help Document
What kind of issue would you like to report? (Optional)