0% found this document useful (0 votes)
9 views

Numerical Integration

Numerical integration explanation

Uploaded by

dabonelati
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Numerical Integration

Numerical integration explanation

Uploaded by

dabonelati
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Chapter 5: Numerical Integration and Differentiation

PART I: Numerical Integration

Newton-Cotes Integration Formulas


The idea of Newton-Cotes formulas is to replace a complicated function or tabu-
lated data with an approximating function that is easy to integrate.
Z b Z b
I= f (x)dx ≈ fn(x)dx
a a

where fn(x) = a0 + a1x + a2x2 + . . . + anxn.

1 The Trapezoidal Rule

Using the first order Taylor series to approximate f (x),


Z b Z b
I= f (x)dx ≈ f1(x)dx
a a
where
f (b) − f (a)
f1(x) = f (a) + (x − a)
b−a
1
Then
Z b· ¸
f (b) − f (a)
I ≈ f (a) + (x − a) dx
a b − a
f (b) + f (a)
= (b − 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
1 00
Et = − f (ξ)(b − a)3
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.
f (b) + f (a) 0.2 + 50.2
I = (b − a) = (2 − 0) × = 50.4
2 2
The true solution is
Z 2
f (x)dx = (0.2x + 12.5x2)|20 = (0.2 × 2 + 12.5 × 22) − 0 = 50.4
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
f (x) = 0.2 + 25x + 3x2
3
from a = 0 to b = 2.
Solution: f (0) = 0.2, and f (2) = 62.2.
f (b) + f (a) 0.2 + 62.2
I = (b − a) = (2 − 0) × = 62.4
2 2
The true solution is
Z 2
f (x)dx = (0.2x + 12.5x2 + x3)|20 = (0.2 × 2 + 12.5 × 22 + 23) − 0 = 58.4
0

The relative error is


¯ ¯
¯ 58.4 − 62.4 ¯
|²t| = ¯¯ ¯ × 100% = 6.85%
58.4 ¯

4
Multiple-application trapezoidal rule:
Using smaller integration interval can reduce the approximation error. We can
divide the integration interval from a to b into a number of segments and apply
the trapezoidal rule to each segment. Divide (a, b) into n segments of equal
width. Then
Z b Z x1 Z x2 Z xn
I= f (x)dx = f (x)dx + f (x)dx + . . . + f (x)dx
a x0 x1 xn−1

where a = x0 < x1 < . . . < xn = b, and xi − xi−1 = h = b−a n , for i = 1, 2, . . . , n.


Substituting the Trapezoidal rule for each integral yields
f (x0) + f (x1) f (x1) + f (x2) f (xn−1) + f (xn)
I ≈ h +h + ... + h
" 2 2 # 2
n−1
X
h
= f (x0) + 2 f (xi) + f (xn)
2 i=1
Pn−1
f (x0) + 2 i=1 f (xi) + f (xn)
= (b − a)
2n
The approximation error using the multiple trapezoidal rule is a sum of the indi-
vidual errors, i.e.,
Xn X n
h3 00 (b − a)3 00
Et = − f (ξi) = − 3
f (ξi)
i=1
12 i=1
12n
5
Pn 00
00 i=1 f (ξi )
Let f = n . Then the approximate error is
(b − a)3 00
Et = − 2
f
12n

Example: Use the 2-segment trapezoidal rule to numerically integrate


f (x) = 0.2 + 25x + 3x2
from a = 0 to b = 2.
6
Solution: n = 2, h = (a − b)/n = (2 − 0)/2 = 1.
f (0) = 0.2, f (1) = 28.2, and f (2) = 62.2.
f (0) + 2f (1) + f (2) 0.2 + 2 × 28.2 + 62.2
I = (b − a) =2× = 59.4
2n 4
The relative error is
¯ ¯
¯ 58.4 − 59.4 ¯
|²t| = ¯¯ ¯ × 100% = 1.71%
58.4 ¯

You might also like