Chapter 6: Techniques of Integration
Section 6.7: Numeric Methods
|
Example 6.7.7
|
|
Use the Trapezoid rule to approximate the area under the curve determined by the following data points.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 6.7.7(a) Data points determining a curve
|
|
|
|
|
|
|
Solution
|
|
|
Mathematical Solution
|
|
•
|
Figure 6.7.7(a) shows the eleven data points and the piecewise linear curve connecting them.
|
•
|
The Trapezoid rule, with and gives the area as
|
|
|
|
|
|
|
|
|
|
|
|
>
|
use plots in
module()
local X,Y,S,q,f,p1,p2,p3,k;
q:=-2*x^5+2*x^4-4*x^3+5*x^2+4*x+4;
for k from 0 to 10 do
f[k] := evalf(eval(q,x=-1+k/5),4);
end do;
X:=[seq(k/5,k=-5..5)]:
Y:=[seq(f[k],k=0..11)]:
S:=[seq([X[k],Y[k]],k=1..11)]:
p1:=plot(X,Y,view=[-1..1,0..13]):
p2:=plot(S,style=point,symbol=solidcircle,symbolsize=15,color=green):
p3:=display(p1,p2,labels=[x,y]);
print(p3);
end module:
end use:
|
|
Figure 6.7.7(a) Piecewise linear curve
|
|
|
|
|
|
•
|
Of course, the most tedious part of the calculation is entering the data!
|
|
|
Maple Solution
|
|
Enter the data
|
•
|
Form a list of the eleven function values in Table 6.7.7(a).
|
•
|
Context Panel: Assign to a Name≻
|
|
|
Apply the Trapezoid rule
|
•
|
Because lists are enumerated from 1, the eleven data points must be referenced as .
|
|
=
|
|
|
The use of a list for the function values is a simplification that is counterbalanced by the need to shift the indices of the data points upward by 1.
|
|
|
<< Previous Example Section 6.7
Next Example >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. 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
|