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

Numerical+Integration

The document discusses numerical integration methods, focusing on the Trapezoidal Rule and Simpson's Rule for approximating definite integrals. It provides formulas, examples, and error analysis for both methods, emphasizing the relationship between the number of trapezoids or intervals and the accuracy of the approximation. Additionally, it includes specific examples demonstrating the application of these rules to various functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Numerical+Integration

The document discusses numerical integration methods, focusing on the Trapezoidal Rule and Simpson's Rule for approximating definite integrals. It provides formulas, examples, and error analysis for both methods, emphasizing the relationship between the number of trapezoids or intervals and the accuracy of the approximation. Additionally, it includes specific examples demonstrating the application of these rules to various functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

NUMERICAL INTEGRATION

b
▪ It uses numerical procedures to evaluate  a
f ( x ) dx approximately if F could not be
expressed in terms of elementary functions such as polynomial, rational or
trigonometric functions.

A. The Trapezoidal Rule

For the trapezoidal element, its area Ak is


y
f ( xk − 1 ) + f ( xk )
Ak = xk
2
f(xk )
f(xk – 1)
xk x
xk – 1 xk

In general, for a regular partition of an interval [a, b] on which a function f is continuous, the
so-called Trapezoidal Rule is given by

b f ( x0 ) + f ( x 1 ) f ( x 1 ) + f ( x2 ) f ( xn− 1 ) + f ( xn )

a
f ( x ) dx  x
2
+ x
2
+ + x
2

b−a
Since x = , then
n

b b-a
 a
f ( x ) dx   f ( x 0 ) + 2f ( x 1 ) + 2f ( x 2 ) + … + 2f ( xn-1 ) + f ( xn ) 
2n 

where:
x0 = a, xn = b and xk = a + kx, k = 0, 1, …, n

Examples
6
1. Use the trapezoidal rule with n = 4 to find an approximation to  2
x 2 − 2 dx .

Solution:
Here, f ( x ) = x2 − 2

If we use n = 4: x = (6 – 2)/4 = 1

x0 = 2 f ( x0 ) = 22 − 2 = 2

x1 = 3 f ( x1 ) = 32 − 2 = 7

x2 = 4 f ( x 2 ) = 4 2 − 2 = 12

x3 = 5 ( )
f x 3 = 5 2 − 2 = 23

x4 = 6 f ( x4 ) = 6 2 − 2 = 34

Consequently,

( ) ( )
6 b-a 

2
x 2 − 2 dx 
2n 
f ( x0 ) + 2 f ( x 1 ) + 2 f ( x 2 ) + 2 f x 3 + f x 4 

6 6−2
 2
x 2 − 2 dx   2 + 2 7 + 2 12 + 2 23 +
2(4) 
34 

 14.81

2 dx
2. Approximate 
1 x
by the Trapezoidal rule for n = 1, n = 2 and n = 6.

Solution:
1
f (x) =
x

n = 1: x = (2 – 1)/1 = 1

x0 = 1 f(x0) = 1/1 = 1
x1 = 2 f(x1) = 1/2

b−a 2−1 1
= =
2n 2(1) 2

2 dx 1 1
 1
  f ( x0 ) + f ( x 1 )  = ( 1 + 0.5 ) = 0.75
x 2 2

n = 2: x = (2 – 1)/2 = 0.5

x0 = 1 f(x0) = 1
x1 = 1 + ½ = 3/2 f(x1) = 2/3
x2 = 3/2 + ½ = 2 f(x2) = 1/2

b−a 2−1 1
= =
2n 2(2) 4

2 dx 1
 1 x

4
 f ( x 0 ) + 2 f ( x 1 ) + f ( x 2 ) 

1
=  1 + 2 ( 2 / 3 ) + 0.5  = 0.7083
4

n = 6: x = (2 – 1)/6 = 1/6

x0 = 1 f(x0) = 1
x1 = 1 = 1/6 = 7/6 f(x1) = 6/7
x2 = 7/6 + 1/6 = 4/3 f(x2) = 3/4
x3 = 4/3 + 1/6 = 3/2 f(x3) = 2/3
x4 = 3/2 + 1/6 = 5/3 f(x4) = 3/5
x5 = 5/3 + 1/6 =11/6 f(x5) = 6/11
x6 = 2 f(x6) = 1/2

b−a 2−1 1
= =
2n 2(6) 12
( ) ( ) ( )
2 dx 1 
 1

x 12 
f ( x0 ) + 2 f ( x 1 ) + 2 f ( x 2 ) + 2 f x 3 + 2 f x 4 + 2 f x5 + f ( x6 ) 

1
  1 + 2 ( 2 / 6 ) + 2 ( 3 / 4 ) + 2 ( 2 / 3 ) + 2 ( 3 / 5 ) + 2 ( 6 / 11 ) + 0.5 
12
 0.6949

Error for Trapezoidal Rule


b
Suppose I =  a
f ( x ) dx and Tn is an approximation to I using n trapezoids. We define

the error in the method to be En = I − Tn .

Theorem: Upper Bound for the Error


If there exists a number M > 0 such that f " ( x )  M for all x in [a, b], then

M (b − a)
3
En 
12n2

Note:
1. En is inversely proportional to n2. Thus, if the number of trapezoids is doubled, the error
E2n is less than ¼ the error bound for En.
2. The formula can be utilized to determine the number of trapezoids that will yield a
specified accuracy.

Examples
2 dx
1. Determine a value of n that give approximation to  1 x
accurate to two decimal places.

Solution:
1 2
f (x) = f '' ( x ) =
x x3

Since f'' decreases on [1, 2], it follows that f''(x)  f''(1) = 2. Thus,
M = 2, (b – a) = 2 – 1 = 1

Therefore,
M (b − a)
3
En 
12n2
2(1)
3
0.005 
12n2
12 ( 0.005 ) 1

2 n2
1
0.03 
n2
100
n 6
3

1
2. Approximate 1/2 cos x dx by the Trapezoidal rule so that the error is less than 0.001.

Solution:
f ( x ) = cos x
1  sin x 
f '' ( x ) =  − cos x 
4x  x 

For x in the interval [1/2, 1]:

sin x
0 1
x
0  cos x  1

Consequently,
1
f '' ( x ) 
4x
1
f '' ( x ) 
2

Thus,
M = ½, (b – a) = ½
M (b − a)
3
En 
12n2
3
11
 
22
0.001 
12n2
125
n2   5.21
24
n  2.282

Use n = 3 (odd)
n = 3: x = (1 – ½)/3 = 1/6

x0 = ½ f(x0) = cos 1/2


x1 = ½ + 1/6 = 2/3 f(x1) = cos 2/3
x2 = 4/6 + 1/6 = 5/6 f(x2) = cos 5/6
x3 = 4/6 + 1/6 = 1 f(x3) = cos 1

1
1 1−
 cos x dx  2  cos 1 / 2 + 2 cos 2 / 3 + 2 cos 5 / 6 + cos 1 
1/2 2(3)  
 0.3244

B. Simpson’s Rule
▪ Numerical integration using area under a parabolic arc connected by three points

To begin, let us find the area under an arc of a parabola that passes through three points P 0(x0,
y0), P1(x1, y1) and P2(x2, y2), where x0 < x1 < x2 and x1 – x0 = x2 – x1 = h. As shown in the figure, this
can be done by finding the area under the graph of y = Ax2 + Bx + C on the interval [-h, h] so
that P0, P1 and P2 have coordinates (-h, y0), (0, y1) and (h, y2), respectively.
y
P1(0, y1)
P0(-h, y0) P2(h, y2)

x
-h h

The interval [-h, h] is chosen for simplicity; the area in question does not depend on the location
of the y-axis. Clearly,

−h ( Ax )
h
2
Area = + Bx + C dx
h
 x3 x2 
=A +B + Cx 
 3 2 
  −h

=
h
3
(
2 Ah 2 + 6C )
But, since the graph is to pass through (-h, y0), (0, y1) and (h, y2), we must have
y0 = Ah2 – Bh + C (a)
y1 = C (b)
y2 = Ah2 + Bh – C (c)

Solving equations (a), (b) and (c) for A, B and C, we find 2Ah2 = y0 + y2 – 2y1. Thus,

h
Area = ( y0 + 4 y 1 + y 2 )
3

Now, let us suppose y = f(x) is continuous on [a, b] and the interval is partitioned into n
subintervals of equal width x = (b – a)/n, where n is an even integer. On each interval [xk – 2, xk]
of width 2x, we approximate the graph of f by an arc of a parabola through points Pk – 2, Pk – 1,
and Pk on the graph that corresponds to the end points and midpoint of the subinterval. If Ak
denotes the area under the parabola on [xk – 2, xk], then

x
Ak =  f ( xk − 2 ) + 4 f ( xk − 1 ) + f ( xk ) 
3 

Thus, Simpson’s rule consists of summing all the Ak:

x x 
( ) ( )
b

a
f ( x ) dx 
3
 f ( x 0 ) + 4 f ( x 1 ) + f ( x 2 )  +
3 
f ( x2 ) + 4 f x3 + f x4  +

x
+  f ( x n − 2 ) + 4 f ( x n − 1 ) + f ( x n ) 
3 

b−a
Using = x
n

( )
b b-a
a f ( x ) dx  3n 
f ( x 0 ) + 4f ( x 1 ) + f ( x 2 ) + 4f x 3 + … + 2f ( x n-2 ) + 4f ( x n-1 ) + f ( x n ) 

Example:
2 dx
Approximate 
1 x
by Simpson’s rule for n = 4.

Solution:
n = 4: x = (2 – 1)/4 = 1/4 = 0.25

x0 = 1 f(x0) = 1/1 = 1
x1 = 1.25 f(x1) = 1/1.25 = 0.8
x2 = 1.5 f(x2) = 1/1.5 = 0.67
x3 = 1.75 f(x3) = 1/1.75 = 0.57
x4 = 2 f(x4) = 1/2 = 0.5

b−a 2−1 1
= =
3n 3(4) 12

( ) ( )
b b-a 
a f ( x ) dx  3n 
f ( x0 ) + 4 f ( x 1 ) + 2 f ( x 2 ) + 4 f x 3 + f x 4 

1
=  1 + 4 ( 0.8 ) + 2 ( 0.67 ) + 4 ( 0.57 ) + 0.5 
12 
1
=  1 + 3.2 + 1.34 + 2.28 + 0.5 
12
= 0.6933

Error for Simpson’s Rule


b
If I = 
a
f ( x ) dx , then E n = I − S n

Theorem:
If there exists a number M > 0 such that f 4 ( x )  M for all x in [a, b], then

M (b − a)
5
En 
180n4

Example
2 dx
Determine a value of n so that the Simpson’s rule will give an approximation to 
1 x
that
is accurate to two decimal places.

Solution:
1 24
f (x)= f 4 (x) =
x x5

Since f 4 ( x )  f 4 ( 1 ) = 24 , hence M = 24
M (b − a)
5
En 
180 n4
24 ( 1 )
5
 0.05
180 n4
80
n4   26.67
3
n  2.27

Since n is even, use n = 4.

Exercises 8
I. Use Trapezoidal rule to obtain an approximation to the given integral for the indicated value
of n.

2 dx  /4

1 sin x
1. 1 3
x +1
n=5 2.

0
tan x dx n=3 3.
 0 x
dx n=5

II. Trapezoidal Rule problems


2 dx
1. Determine the number of trapezoids needed so that an approximation to −1 x + 3 is
accurate to two decimal places.
2. Use Trapezoidal Rule so that an approximation to the area under the graph of
1
f (x)= on [0, 2] is accurate to two decimal places.
1 + x2
3. The domain of f(x) = 10x is the set of real numbers and f(x) > 0 for all x. Use the
Trapezoidal Rule to approximate the area under the graph of f on [-2, 2] with n = 4.
4. The so-called moment of inertia I of a three-bladed ship’s propeller is given by
3  3  4.5 2
I=
2g
+
g 1 r Adr

Where  is the density of the metal, g is the acceleration of gravity, and A is the area of
a cross section of the propeller at a distance r ft from the center of the hub. If  = 570
lb/ft3 for bronze, use the data below and the Trapezoidal Rule to find an approximation
to I.
r(ft) 1 1.5 2 2.5 3 3.5 4 4.5
A(ft2) 0.3 0.5 0.62 0.7 0.6 0.5 0.27 0

III. Use the Simpson’s Rule to obtain an approximation to the given integral for the indicated
value of n.

1. 1 2.  sin x 3.  /2 dx
−1
x 2 + 1 dx n=2
0 x +
dx n=6  /4 2 + sin x n=2

IV. Simpson’s Rule problems


dx 3
1. Using Simpson’s rule, determine n so that the error in approximating
x
is less than  1
10-5. Compare with the n needed in the Trapezoidal rule to give the same accuracy.
3 dx
2. Find an upper bound for the error in approximating
0 2x + 1
by Simpson’s rule with n 
= 6.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy