Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

Numerical Integration

This document discusses numerical integration techniques, including the Trapezoidal Rule, Midpoint Rule, and Simpson's Rule, which are used to approximate definite integrals when exact solutions are difficult or impossible to obtain. It outlines the objectives of the session, explains the methods in detail, and provides examples and error analysis for each technique. Additionally, it includes exercises for practice and emphasizes the importance of increasing accuracy with larger sample sizes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Numerical Integration

This document discusses numerical integration techniques, including the Trapezoidal Rule, Midpoint Rule, and Simpson's Rule, which are used to approximate definite integrals when exact solutions are difficult or impossible to obtain. It outlines the objectives of the session, explains the methods in detail, and provides examples and error analysis for each technique. Additionally, it includes exercises for practice and emphasizes the importance of increasing accuracy with larger sample sizes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Contents

11 Session Eleven: Numerical Integration 2


11.1 Session Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
11.2 Numerical/Approximate Integration . . . . . . . . . . . . . . . . . . . . . . . 2
11.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
11.2.2 Trapezoidal Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
11.2.3 Midordinate/Midpoint Rule . . . . . . . . . . . . . . . . . . . . . . . 4
11.2.4 Simpson’s Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
11.3 Session Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
11.4 Student Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Calculus II Numerical Integration

11 Session Eleven: Numerical Integration


11.1 Session Objectives
By the end of this session, you should be able to:
(i) Apply approximation techniques in evaluating definite integrals ,

(ii) Find the error in using the approximation techniques.

11.2 Numerical/Approximate Integration


11.2.1 Introduction
Some functions are very difficult to integrate, and some are actually impossible. In many
cases (eg modelling airflow around a car), an exact answer may not even be strictly necessary.

Figure 1: Car airflow

There
Z b are two situations in which it is impossible to find the exact value of a definite integral
f (x) dx.
a

1. The first situation is when it impossible to find the antiderivative of f . For example,
it is impossible to evaluate the following integrals exactly:
Z 1 Z 1√
x2
e dx, 1 + x3 dx
0 −1

2. The second situation arises when the function is determined from a scientific experiment
through instrument readings or collected data. There may be no formula for the
function.

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 2


Calculus II Numerical Integration

In both cases we need to find approximate values of definite integrals. In this section we
shall discuss some of these different approximation/numerical techniques.

11.2.2 Trapezoidal Rule


Consider the area bounded by the graph of y = f (x), x0 = a and x5 = b in Figure 2

Figure 2: Trapezoidal Approximation [2]

We approximate the area under the curve by summing up the areas of the trapezoids. This
is called the Trapezoidal Rule.
Z b
b−a
f (x) dx ≈ [(f (x0 ) + f (x1 )) + (f (x1 ) + f (x2 )) +
a 2n
· · · + (f (xn−1 ) + f (xn ))]
b−a
= [f (x0 ) + 2f (x1 ) + 2f (x2 ) + · · · + 2f (xn−1 ) + f (xn )]
2n
b−a
≈ [f (x0 ) + 2(f (x1 ) + f (x2 ) + · · · + f (xn−1 )) + f (xn )]
2n

Trapezoidal Rule:
Z b
h
f (x) dx = [f (x0 ) + 2(f (x1 ) + f (x2 ) + · · · + f (xn−1 )) + f (xn )]
a 2
b−a
where h = n

Z 4
Example 11.2.1. Use Trapezoidal Rule to approximate the integral x2 dx with (a) n = 4
0
(b) n = 8
Solution:

4−0
(a) h = 4
= 1. So we have

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 3


Calculus II Numerical Integration

Z 4
1
x2 dx ≈ [f (0) + 2[f (1) + f (2) + f (3)] + f (4)]
0 2
1
= [0 + 2(1 + 4 + 9) + 16]
2
≈ 22 sq. units
4−0
(b) h = 8
= 21 . So we have
Z 4
0.5
x2 dx ≈ [f (0) + 2[f (0.5) + f (1) + f (1.5) + f (2)] + f (2.5)
0 2
+f (3) + f (3.5)] + f (4)]
1
= [0 + 2[0.25 + 1 + 2.25 + 4 + 6.25 + 9 + 12.25] + 16]
4
1 1
= [0 + 2(35) + 16] = · 86
4 4
≈ 21.5 sq. units
Z 4  3 4
2 x 64
Check that the exact area is x dx = = = 21.33
0 3 0 3

11.2.3 Midordinate/Midpoint Rule


The Midpoint Rule (or Midordinate Rule) uses the area of a rectangular to approximate the
Z b
value of a definite integral f (x) dx as shown in Figure 3
a

Figure 3: Midpoint Approximation

Midpoint Rule:
Z b       
x0 + x1 x1 + x2 xn−1 + xn
f (x) dx = h f +f + ··· + f
a 2 2 2

b−a
where x0 = a, xn = b h = n

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 4


Calculus II Numerical Integration

Z 2
1
Example 11.2.2. Use the Midpoint Rule with n = 5 to approximate dx.
1 x
Solution:
With a = 1 and b = 2, we have h = 2−15
= 0.2
Z 2       
1 1 + 1.2 1.2 + 1.4 1.4 + 1.6
dx ≈ 0.2 f +f +f +
1 x 2 2 2
   
1.6 + 1.8 1.8 + 2
f +f
2 2
≈ 0.2 [f (1.1) + f (1.3) + f (1.5) + f (1.7) + f (1.9)]
 
1 1 1 1 1
≈ 0.2 + + + +
1.1 1.3 1.5 1.7 1.9
≈ 0.691908

We compute the error in Trapezoidal and Midpoint approximations. We work out Example
11.2.2 using Trapezoidal Rule with n = 5. Here h = 2−1
5
= 0.2
Z 2
1 0.2
dx ≈ [f (1) + 2[f (1.2) + f (1.4) + f (1.6) + f (1.8)] + f (2)]
1 x 2
 
1 2 2 2 2 1
= 0.1 + + + + +
1 1.2 1.4 1.6 1.8 2
≈ 0.695635
Z 2
1
The exact area is dx = ln x|21 = ln 2 = 0.693147 · · · .
1 x
The error in Trapezoidal and Midpoint approximations for n = 5 are:

ET ≈ −0.002488 and EM ≈ 0.001239


Z b Z b
Generally, ET = f (x) dx − Tn and EM = f (x) dx − Mn
a a

Table 1: Approximation Errors

n Tn Mn ET EM
5 0.695635 0.691908 -0.002488 0.001239
10 0.693771 0.692835 -0.000624 0.000312
20 0.693303 0.693069 -0.000156 0.000078

Table 1 shows the trend in the errors from the approximation of the integral of Example
11.2.2 as we increase the value of n. The following can be deduced from the table:
1. As n increases, the accuracy of the approximation increases

2. The errors in Trapezoidal and Midpoint are opposite in sign

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 5


Calculus II Numerical Integration

3. Midpoint approximation is more accurate than Trapezoidal

4. The error size in Midpoint is about half that of Trapezoidal approximation

Exercise 11.2.1. Use the Trapezoidal and Midpoint Rules with the specified values of n
below Z
2√ Z 1
1. 3
x − 1 dx; n = 10 2. sin(x3 ) dx; n = 10
1 0
Z 2 Z 4 √
1 t
3. dx; n=8 4. e sin t dt; n=8
0 1 + x6 0
Z 4 √ Z 6
5. ln x dx; n=6 6. ln(x3 + 2) dx; n = 10
1 4

11.2.4 Simpson’s Rule


Another rule for approximate integration is the Simpson’s Rule named after the English
Mathematician Thomas Simpson (1710–1761).The rule has a lot of application for instance
in calculation of ship stability and in naval architecture.

In Simpson’s Rule, we use parabolas instead of straight lines to approximate a curve. As


earlier, we consider a partition of [a, b] into n sub-intervals of equal length h = b−a
n
, but this
time with n even. Then on each consecutive pair of intervals, we approximate the curve
y = f (x) by a parabola as in Figure 4.

Figure 4: Simpson’s Approximation

If yi = f (xi ), then P (xi , yi ) is the point on the curve lying above xi . A typical parabola
passes through three consecutive points Pi , Pi+1 and Pi+2 .

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 6


Calculus II Numerical Integration

Figure 5 is a typical parabola from


Figure 4 to illustrate the rule with
x0 = −h, x1 = 0 and x2 = h. The
equation of the parabola through
P0 , P1 and P2 is of the form y =
Ax2 + Bx + C. So the area under
the parabola from x = −h to x = h
is:
Figure 5: Simpson’s Approximation
h
x3 x2
Z
(Ax2 + Bx + C) dx = A + B + Cx]h−h
−h 3 2
3 2
h h h3 h2
= + B + Ch + − B + Ch
3 2 3 2
h3
= (2Ah2 + 6C)
3
Since the parabolas passes through P0 (−h, y0 ), P1 (0, y1 ), and P2 (h, y2 ), we have

y0 = A(−h)2 + B(−h) + C = Ah2 − Bh + C


y1 = C
y2 = Ah2 + Bh + C
and therefore,
y0 + 4y1 + y2 = 2Ah2 + 6C

Thus, we can rewrite the area under the parabola as


h
(y0 + 4y1 + y2 )
3
Shifting the parabola of Figure 5, doesn’t change the area under it. So the area under the
parabola through P0 , P1 and P2 from x = x0 to x = x2 in Figure 4 is still
h
(y0 + 4y1 + y2 ).
3
Computing the areas under all parabolas in this manner and adding the results we get
Z b
h h h
f (x) ≈ (y0 + 4y1 + y2 ) + (y2 + 4y3 + y4 ) + (y4 + 4y5 + y6 )
a 3 3 3
h
+ · · · + (yn−2 + 4yn−1 + yn )
3
h
= (y0 + 4y1 + 2y2 + 4y3 + 2y4 + · · · + 2yn−2 + 4yn−1 + yn )
3
Take note of the pattern of the coefficients: 1, 4, 2, 4, 2, · · · , 4, 2, 4, 1.

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 7


Calculus II Numerical Integration

Simpson’s Rule:
Z b
h
f (x) dx = [f (x0 ) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + 2f (x4 ) + · · ·
a 3
+2f (xn−2 ) + 4f (xn−1 ) + f (xn )]

b−a
where h = n
Z 2
1
Example 11.2.3. Use Simpson’s Rule with n = 10 to approximate dx.
1 x
Solution:
h = 2−1
10
= 0.1. Thus,
Z 2
1 0.1
dx = [f (1) + 4f (1.1) + 2f (1.2) + 4f (1.3) + · · · + 2f (1.8)
1 x 3
+4f (1.9) + f (2)]

0.1 1 4 2 4 2 4 2 4 2
= + + + + + + + +
3 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8

4 1
+ +
1.9 2
≈ 0.693150

Note 11.2.1. Notice that Simpson’s Rule give us a much better approximation (S10 ≈
0.693150) to the true value of the integral (0.693147 · · · ) than Trapezoidal (T10 ≈ 0.693771)
or the Midpoint Rule (M10 ≈ 0.692835)
Z 1
x
Exercise 11.2.2. 1. Use Simpson’s Rule with n = 10 to approximate ee dx.
−1

2. The speedometer reading (v) on a car was observed at 1-minute intervals and recorded
in the following chart. Use Simpson’s Rule to estimate the distance traveled by the car.

t (min) 0 1 2 3 4 5 6 7 8 9 10
v(mkm/h) 40 42 45 49 52 54 56 57 57 55 56

The widths (in meters) of a kidney shaped swim-


ming pool were measured at 2-meter intervals as
3.
indicated in the figure. Use Simpson’s Rule to es-
timate the area of the pool.

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 8


Calculus II Numerical Integration

11.3 Session Summary


The accuracy of any of these methods depends to a certain extent on the function itself, but
any of the methods can be improved by increasing the number of strips used. In general, for
a given number of strips, Simpson’s Rule is the most accurate of the three.

11.4 Student Activity


For more material on logic check out [3, 5, 4, 2, 1]. You can also check more notes from:
Trapezoidal rule and Numerical integration.

References
[1] S. P. Hurd D. F. Wright and B. D. New. Essential Calculus. Hawkes learning System,
Charleston, SC, U.S.A, 2 edition, 2008.

[2] E. J. Purcell D. Verberg and S. E. Rigdon. Calculus. Pearson Prentice Hall, upper Saddle
River, New Jersey, NJ, U.S.A, 9 edition, 2007.

[3] E. H. Christopher R. H. Joel and D. W. Maurice. Thomas’s Calculus. Pearson, 14


edition, 2017, ISBN-13: 978-0134438986.

[4] L. Ron and H. E. Bruce. Calculus. Cengage Learning, 11 edition, 2017, ISBN-13: 978-
1337275347.

[5] J. Stewart. Calculus. CENGAGE Learning, Belmont, CA, U.S.A, 8 edition, 2016.

Copyright c Dr. Michael Munywoki, 2020. All rights reserved Page 9

You might also like