246x Filetype PDF File size 0.32 MB Source: www.ece.mcmaster.ca
Chapter5: Numerical Integration and Differentiation
PARTI:NumericalIntegration
Newton-Cotes Integration Formulas
TheideaofNewton-Cotesformulasistoreplaceacomplicatedfunctionortabu-
lated data with an approximating function that is easy to integrate.
I = Z bf(x)dx ≈ Z bf (x)dx
n
a a
2 n
where f (x) = a +a x+a x +...+a x .
n 0 1 2 n
1 TheTrapezoidalRule
Using the first order Taylor series to approximate f(x),
I = Z bf(x)dx ≈ Z bf (x)dx
1
a a
where
f (x) = f(a) + f(b) − f(a)(x − a)
1 b −a
1
Then Z · ¸
b f(b) −f(a)
I ≈ a f(a)+ b −a (x−a) dx
= (b−a)f(b)+f(a)
2
The trapezoidal rule is equivalent to approximating the area of the trapezoidal
Figure 1: Graphical depiction of the trapezoidal rule
under the straight line connecting f(a) and f(b). An estimate for the local trun-
2
cation error of a single application of the trapezoidal rule can be obtained using
Taylor series as
E =−1f′′(ξ)(b−a)3
t 12
where ξ is a value between a and b.
Example: Use the trapezoidal rule to numerically integrate
f(x) = 0.2 + 25x
from a = 0 to b = 2.
Solution: f(a) = f(0) = 0.2, and f(b) = f(2) = 50.2.
I = (b −a)f(b)+f(a) = (2−0)× 0.2+50.2 = 50.4
2 2
Thetrue solution is
Z 2f(x)dx = (0.2x+12.5x2)|2 = (0.2×2+12.5×22)−0 = 50.4
0
0
Because f(x) is a linear function, using the trapezoidal rule gets the exact solu-
tion.
Example: Use the trapezoidal rule to numerically integrate
2
f(x) = 0.2 + 25x + 3x
3
from a = 0 to b = 2.
Solution: f(0) = 0.2, and f(2) = 62.2.
I = (b − a)f(b) + f(a) = (2 − 0) × 0.2 + 62.2 = 62.4
2 2
Thetrue solution is
Z 2 2 3 2 2 3
0 f(x)dx = (0.2x+12.5x +x )|0 = (0.2×2+12.5×2 +2 )−0 = 58.4
Therelative error is ¯ ¯
¯58.4 − 62.4¯
|ǫt| = ¯ ¯ ×100% = 6.85%
¯ 58.4 ¯
4
no reviews yet
Please Login to review.