You are on page 1of 30

Chapter: Numerical Integration

Learning outcomes
At the end of the lesson students will be able to evaluate the integrals by
Trapezoidal and Simpson’s 1/3 rule

5/20/2021 1
Introduction
•We can use numerical integration to estimate the values of definite
integrals when a closed form of the integral is difficult to find or when an
approximate value only of the definite integral is needed.
•The most commonly used techniques for numerical integration are the
midpoint rule, trapezoidal rule and Simpson’s rule.
•The midpoint rule approximates the definite integral using rectangular
regions whereas the trapezoidal rule approximates the definite integral
using trapezoidal approximations.
•Simpson’s rule approximates the definite integral by approximating the
original function using piecewise quadratic functions

5/20/2021 2
𝑏
Approach: If we wish to evaluate a integral 𝑎
𝑓 𝑥 𝑑𝑥
Where, f(x) is called the integrand,
a = lower limit of integral
b = upper limit of integral

Then we can find the value of the above integral assuming 𝑓(𝑥) ≈ 𝑃𝑛 (𝑥)
Where, 𝑃𝑛 𝑥 = 𝑎0 + 𝑎1𝑥 + … + 𝑎𝑛 𝑥 𝑛 is a nth order polynomial.

𝑏 𝑏
So, we have 𝑎
𝑓 𝑥 𝑑𝑥 ≈ 𝑃
𝑎 𝑛
𝑥 𝑑𝑥 (Newton-Cotes Formula)
Note:
𝑏
• For trapezoidal rule, 𝑎
𝑓 𝑥 𝑑𝑥 is approximated assuming 𝑓(𝑥) ≈ 𝑃1 (𝑥)= a0 + a1x (first order Polynomial)
𝑏
• For Simpson’s 1/3 rule, 𝑎 𝑓 𝑥 𝑑𝑥 is approximated assuming 𝑓(𝑥) ≈ 𝑃2 (𝑥)= a0 + a1x + a2x2 (Second order Polynomial)

5/20/2021 3
Derivation of Trapezoidal Rule
Method I: Now, we can Derive the trapezoidal rule assuming
𝑏 𝑏
𝑎
𝑓 𝑥 𝑑𝑥 ≈ 𝑎 1
𝑃 𝑥 𝑑𝑥 where, P1 x is first order polynomial given by P1 x = a0 + a1x.

b b

 f ( x)dx   (a
a a
0  a1 x)dx
Also,
f (a )  f (b) (a0  a1a )  (a0  a1b)

2 2

 a0 x  a 2 x 2 
b
a

2a 0  a1 (a  b)
2

 b2  a2   ab
 a 0 (b  a)  a1    a0  a1   ... (ii )
 
 2   2 
  b  a 
 (b  a ) a0  a1   ... (i )
  2 

Combining (i ) and ii  we get


b
f (a)  f (b)

a
f ( x)dx  (b  a)
2
Now, we use the geometrical approach to derive trapezoidal Rule

𝑏
We know that, 𝑎
𝑓 𝑥 𝑑𝑥 = Area encloses by the curve y = f x , x − axis and ordinates at x = a, x = b.

5/20/2021 5
a) Derivation of Trapezoidal Rule(Elementary trapezoidal rule:)

𝑏
𝑎
𝑓 𝑥 𝑑𝑥 ≈ Area of trapezium
1
= ( sum of parallel sides)x height
2
1
= {f(a)+f(b)}(b-a)
2
[f(a)+f(b)]
= (b − a) .
2

5/20/2021 6
b. Derivation of composite trapezoidal rule
If a function f is continuous in [a,b] then
𝑏 h
𝑎
𝑓 𝑥 𝑑𝑥 ≈ 2 {f(x0)+2f(x1)+2f(x2)+2f(x3)+…………+2f(xn-1)+f(xn)}
b−a
Where [a,b] has been divided into n-sub intervals [x0,x1],[x1,x2],[x2,x3]……..[xn-1,xn] each of length h= n .

Proof:
We have a continuous function f defined in [a,b].
Now, we shall divide the interval [a,b] into n equally spaced sub-
b−a
intervals [x0,x1],[x1,x2],[x2,x3]……..[xn-1,xn] each of length h= .
n

Let f(x0),f(x1),f(x2),f(x3)…………f(xn-1),f(xn) are successive ordinates


to the partitioned points x0,x1,x2,x3……..xn-1,xn .

If we join end of ordinates by the chord of curve then we have n-


number of successive trapeziums.
1
we have, area of each trapezium= ( sum of parallel sides) height.
2

5/20/2021 7
So, sum of area of all these n-trapezium is the required area.
𝑏
∴ 𝑎 𝑓 𝑥 𝑑𝑥 ≈ sum of area of n-trapezium

1 1 1 1
= [f(x0)+f(x1)]h + [f(x1)+f(x2)]h+ [f(x2)+f(x3)]h+……+ [f(xn-1)+f(xn)]h
2 2 2 2
h
= {f(x0)+f(x1)+f(x1)+f(x2)+f(x2)+f(x3)+f(x3)+…………+f(xn-1)+f(xn)
2
h
= {f(x0)+2f(x1)+2f(x2)+2f(x3)+…………+2f(xn-1)+f(xn)}
2

Remarks:
𝑏 h 𝑏−𝑎
1. 𝑓 𝑥 𝑑𝑥 = {y0+2y1+2y2+2y3+…………+2yn-1+yn} , where ℎ =
𝑎 2 𝑛

5/20/2021 8
Error and error bound of trapezoidal approximation
Error of approximation = E = actual value−aaproximated value = 𝑣 − 𝑣𝑎𝑝𝑝𝑟𝑜𝑥
b−a 3
Error bound of trapezoidal approximation ( max. expected error) = Et = 12n2 M
Where M= max. |f ’’(x)| in [a,b]
Note: number of sub intervals=n, number of partitioned points=n+1.
in adjoining figure no. of partitioned points= A,B,C,D,E =5
and no. of sub intervals = [ A,B],[B,C],[C,D],[D,E] =4

Example : Given a tabulated value of the velocity of an object


Time(s) 0 1 2 3
Velocity(m/s 0 10 12 14
Obtain the estimate distance traveled by the object in the interval [0,3]
by composite trapezoidal rule.
3
Solution: we have, distance= 0 vdt
Here, [0,3] is divided into 3 sub-intervals with partitioned points
t0=0,t1=1,t2=2,t3=3
3 ℎ
Then using composite trapezoidal rule, 0 vdt = 2{v0+2v1+2v2+v3}
1
= 2{0+2x10+2x12+14}
5/20/2021 =29m. 9
1 1
Example Given I = 𝑑𝑥,
0 1+𝑥 2
a. Use single segment Trapezoidal rule to find the approximate value of
integral.

Solution:
We know,
 f ( a )  f ( b )
I  ( b  a ) 
 2

Here, a = 0 and b = 1
1
𝑓 (𝑥 ) = .
1+𝑥 2
1 1 1
𝑆0, 𝑓(0) = = 1, and 𝑓(1) = =
1+02 1+12 2
Now by using trapezoidal rule,
1 1 𝑏−𝑎 1−0
0 1+𝑥 2
𝑑𝑥 ≈ [𝑓 (0) + 𝑓(1) = ( )[1 + 0.5 = 0.75
2 2
𝟏
𝟏
∴ 𝒅𝒙 ≈ 𝟎. 𝟕𝟓. 𝑨𝒏𝒔
𝟏 + 𝒙𝟐
𝟎

5/20/2021 10
1 1
Example: Find the approximate value for 0 1+𝑥 2
𝑑𝑥, n=2 using composite trapezoidal rule.
𝑏 1 1
Solution: Given, 𝑎
𝑓 𝑥 𝑑𝑥 = 0 1+𝑥 2
𝑑𝑥
1
⇒a=0, b=1 and f(x)=
1+𝑥 2
Number of sub-intervals(n)= 2
𝑏−𝑎 1−0
Height of sub-intervals(h)= = = 0.5
𝑛 2
∴ the partitioned points and their ordinates are given by
x 𝑥0 = 𝑎 =0 𝑥1 = 𝑎 + ℎ =0.5 𝑥2 = 𝑎 + 2ℎ =1
f(x) 1 0.8944 0.7071

Now using composite trapezoidal rule


1 1 ℎ
0 2
𝑑𝑥 ≈ {f(x0)+2f(x1)+f(x2)]
1+𝑥 2
0.5
= { 1+ 2x0.8944 + 0.7071}
2
= 0.874 which is required approximation.

5/20/2021 11
3
Example: Evaluate 1 exlnx dx using composite trapezoidal rule for three points subintervals.
𝑏 3
Solution: Given, 𝑎 𝑓 𝑥 𝑑𝑥 = 1 exlnx dx
⇒a=1, b=3 and f(x)= exlnx

No. of partitioned points = 3


Number of sub-intervals(n)= 3-1=2

𝑏−𝑎 3−1
Height of sub-intervals(h)= = = 1
𝑛 2

∴ The partitioned points and their ordinates are given by

x 𝑥0 = 𝑎 = 1 𝑥1 = 𝑎 + ℎ = 2 𝑥2 = 𝑎 + 2ℎ = 3
f(x) 0 5.1217 22.0662

Now using composite trapezoidal rule


3 x ℎ
1 e lnx dx ≈ 2
{f(x0)+2f(x1)+f(x2)}
1
= 2 { 0+2x5.1217+ 22.0602}
= 16.1548, which is required approximation.
5/20/2021 12
π
Example : Approximate 𝑠𝑖𝑛𝑥 𝑑𝑥 ,n=6 using composite trapezoidal rule For trigonometric function change your
0
𝑏 π Calculator in radian mode.
Solution: Given, 𝑎 𝑓 𝑥 𝑑𝑥 = 0 𝑠𝑖𝑛𝑥 𝑑𝑥
⇒a=0, b=𝜋 and f(x)= 𝑠𝑖𝑛𝑥
Number of sub-intervals(n)= 6
𝑏−𝑎 𝜋−0 𝜋
Height of sub-intervals(h)= = =
𝑛 6 6
∴ The partitioned points and their ordinates are given by

x 𝑥0 =0 𝜋 𝜋 𝜋 2𝜋 5𝜋
𝑥1 = 𝑥2 = 𝑥3 = 𝑥4 = 𝑥5 = 𝑥6 = 𝜋
6 3 2 3 6
f(x) 0 0.7071 0.9306 1 0.9306 0.7071 0

Now using composite trapezoidal rule


π ℎ
0
𝑠𝑖𝑛𝑥 𝑑𝑥 ≈ {f(x0)+2f(x1)+2f(x2)+2f(x3)+2f(x4) +2f(x5)+f(x6)}
2
𝜋
=2⨯6 { 0+ 2x0.7071 +2x 0.9306 +2x1 +2x0.9306+2x0.7071+0}
=2.2386, which is required approximation.

5/20/2021 13
2 1
Example: Given I = 0 1+𝑥 𝑑𝑥
a) Approximate I using composite trapezoidal rule with five points sub- intervals.
b) Determine the actual value of I
(c) Find the error of approximation from Its actual value
(d) Find the absolute error bound of approximation. Does error lies within the bound?
(e) How many partition point is required to get approximation within the accuracy of 10-2?
𝑏 2 1
Solution: Given, 𝑎
𝑓 𝑥 𝑑𝑥 = 0 1+𝑥
𝑑𝑥
1
⇒a=0, b=2 and f(x)= 1+𝑥
a) Number of sub-intervals(n) = 4
𝑏−𝑎 2−0
Height of sub-intervals(h)= 𝑛 = 4 = 0.5
∴ the partitioned points and their ordinates are given by

x 𝑥0 =0 𝑥1 =0.5 𝑥2 =1 𝑥3 =1.5 𝑥4 =2
f(x) 1 0.667 0.5 0.4 0.333

Now using composite trapezoidal rule


2 1 ℎ
0 1+𝑥
𝑑𝑥 ≈ {f(x0)+2f(x1)+2f(x2)+2f(x3)+f(x4)}
2
0.5
= 2 { 1+ 2x0.667 +2x 0.5 +2x 0.4 + 0.333}
= 1.1167, which is required approximation.
5/20/2021 14
b) Also actual value of integral is given by
2 1 2
0
𝑑𝑥= [ ln(1 + x)]0 = ln3 – ln1= 1.0986 − 0 =1.0986
1+𝑥

c) Error of approximation (𝐸 ) = 𝑣 − 𝑣𝑎𝑝𝑝𝑟𝑜𝑥 = 1.0986 − 1.1167 = 0.0181

b−a 3
d) We have absolute error bound of trapezoidal approximation ( max. expected error) |𝐸𝑡 |= M
12n2
Where M= max. |f ’’(x)| in [a, b]

1
Now, we have f(x) = = (1 + x)-1
1+𝑥
f’(x) = -1(1 + x)-2
2
f’’(x) = 2(1 + x)-3 = 3
1+𝑥
∴ M = max. |f”(x)| in [a, b] = [0, 2]
2
M =| |= 2
1+0 3
b−a 3 2−0 3 8
So, |𝐸𝑡 | = M = .2 = .2 = 0.0833
12n2 12.42 12 . 16
here, 𝐸 < | 𝐸𝑡|

i.e. 0.0181 < 0.0833 ⇒ error is within bound.


5/20/2021 15
e) Let n be number of subintervals is required to get approximation within the
accuracy of 10−2
b−a 3 -2
So, we have, |𝐸𝑡 | = M ≤ 10
12n2
2−0 3 1
Or, .2 ≤
12.n2 100
4 1
Or, 2 ≤
3n 100
⇒ 3n2 ≥ 400
⇒ n2 ≥ 133.33
⇒ n ≥ 133.33 = 11.53 ≈ 12

∴ Number of subintervals = 12 or more and


Required number of partitioned points = n + 1 = 13 or more.

5/20/2021 16
Exercise 1:
𝑏
1. Approximate 𝑎
𝑓 𝑥 𝑑𝑥 given the table of values

x 1 5/4 3/2 7/4 2


f(x) 10 8 7 6 5

Compute the estimate by the composite trapezoidal rule.

2. Compute the approximate value for the followings using composite trapezoidal rule
21 4 4
(a) 1 𝑥 𝑑𝑥 , n = 2 (b) 0 (2𝑥 + 1) 𝑑𝑥, 𝑛 = 4 (c) 0 (2𝑐𝑜𝑠3𝑥 − 1) 𝑑𝑥, 𝑛 = 4

2 𝑥 1
3. Using composite trapezoidal rule Evaluate 0
2 𝑑𝑥 , using composite trapezoidal rule with h = 2 .
42
4. How large should we take n in order to guarantee that the trapezoidal approximation for 1 𝑥 𝑑𝑥 is accurate
within 0.0001.
2 1
5. Using composite trapezoidal rule Evaluate 0 𝑥 −2 𝑑𝑥 , using composite trapezoidal rule with h = 2

5/20/2021 17
Topic : Simpson’s 1/3 Rule

Simpson’s 1/3rd rule is an extension of Trapezoidal rule where the integrand is


approximated by a second order polynomial. It is based upon a quadratic interpolation
such that the definite integral of original function is approximated using piecewise
quadratic functions ( second degree polynomial).
b b

 f ( x)dx   P ( x)dx
a a
2 , where 𝑃2 𝑥 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2

Simpsons 1/3 rule


Area under second degree polynomial 𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 in [a, b]
𝑏 h a+b
is given by 𝑎 𝑓(𝑥) = { f(a)+ 4f(
3 2 ) + f(b)}
where [a, b] is divided into three equally spaced partitioned points
a+b b−a
a, m= , b such that h=
2 2

5/20/2021 18
Proof: Let [a, b] has been divided into three equally spaced partitioned points
a+b b−a
a, m= , b such that h=
2 2
f (a)  a0  a1a  a2 a 2
2
 ab  ab  ab
f   a0  a1    a2  
 2   2   2 
f (b)  a0  a1b  a 2 b 2

𝑎+𝑏
Here, 𝑓 (𝑎) + 4𝑓 + 𝑓 (𝑏)
2
2
𝑎+𝑏 𝑎+𝑏
= (𝑎0 + 𝑎1 𝑎 + 𝑎2 𝑎2 ) + 4 𝑎0 + 𝑎1 + 𝑎2 + (𝑎0 + 𝑎1 𝑏 + 𝑎2 𝑏 2 )
2 2
= {6𝑎0 + 3𝑎1 (𝑏 + 𝑎) + 2𝑎2 (𝑏 2 + 𝑏𝑎 + 𝑎2 ) .....(i)

5/20/2021 19
b b

 
Now, f ( x)dx  (a0  a1 x  a 2 x 2 )dx
a a
𝑏
𝑥2 𝑥3
= 𝑎0 𝑥 + 𝑎1 + 𝑎2
2 3 𝑎

𝑏−𝑎
= {6𝑎0 + 3𝑎1 (𝑏 + 𝑎) + 2𝑎2 (𝑏2 + 𝑏𝑎 + 𝑎2 ) ...(ii)
6

b
ba   ab 
so, 
a
f ( x)dx 
6 
 f ( a )  4 f 
 2 
  f (b ) 

b
h  ab  ba

Therefore, f ( x)dx   f (a)  4 f 
a
3  2 
  f (b) as we have h 
 2

5/20/2021 20
3. Derivation of Composite Simpson's rule( Simpson's 1/3 rule)
𝑏 h
If a function f is continuous in [a,b] then 𝑓 𝑥 𝑑𝑥 ≈
𝑎 3 {f(x0)+4f(x1)+2f(x2)+4f(x3)+…………+4f(xn-1)+f(xn)}
b−a
Where [a,b] has been divided into n-sub intervals [x0,x1],[x1,x2],[x2,x3]……..[xn-1,xn] each of length h=
n .

Proof: We have a continuous function f defined in [a,b]


Here we have to find the area under the curve y=f(x),
x-axis and the ordinates at x=a, x=b. Which is
𝑏
represented by 𝑎 𝑓 𝑥 𝑑𝑥.
Now we shall divide the interval [a,b] into n equally
spaced sub-intervals [x0,x1],[x1,x2],[x2,x3]……..[xn-1,xn]
b−a
each of length h=
n
Let f(x0),f(x1),f(x2),f(x3)…………f(xn-1),f(xn) are successive
ordinates to the partitioned points x0,x1,x2,x3……..xn-1,xn
As we know, area under second degree polynomial with
three points sub-intervals xi-1, xi, xi+1 is given by

𝑥𝑖+1 h
𝑓 𝑥 𝑑𝑥 ≈ { f(xi-1)+ 4f(xi)+ f(xi+1)}.
𝑥𝑖−1 3

5/20/2021 21
𝑏
∴ 𝑎
𝑓 𝑥 𝑑𝑥 ≈ sum of area under the parabolic arcs with each successive three points sub intervals.
ℎ ℎ ℎ
= [f(x0)+4f(x1)+f(x2] + [f(x2)+4f(x3)+f(x4]+…+ [f(xn-2)+4f(xn-1)+f(xn]
3 3 3

h
= {f(x0)+4f(x1)+f(x2)+f(x2)+4f(x3)+f(x4)+…………+4f(xn-1)+f(xn)}
3

h
= {f(x0)+4f(x1)+2f(x2)+4f(x3)+…………+4f(xn-1)+f(xn)}.
3

Error and error bound of Simpson’s approximation


Error of approximation= actual value−aaproximated value = 𝑣 − 𝑣𝑎𝑝𝑝𝑟𝑜𝑥
b−a 5
The absolute error bound of Simpson’s approximation ( max. expected error)= 180n4 M ,
Where M= max. f4(x) in [a,b]
Note: number of sub intervals=n, number of partitioned points=n+1.

Note: the number of subintervals for Simpson’s rule is 2 or multiple of 2(even)

5/20/2021 22
Example
𝟏 𝟐
Using simpson’s 𝟑 rule evaluate 𝟎
(𝟐𝒙 − 𝟏)𝟐 𝒅𝒙 with n = 4.
2
Soln: Given integral is 0 (2𝑥 − 1)2 𝑑𝑥 with n = 4

Here, 𝑓 (𝑥 ) = (2𝑥 − 1)2 , 𝑎 = 0, 𝑏 = 2, 𝑛 = 4, 𝑎𝑛𝑑 ℎ =?


𝑏−𝑎 2−0 1
We know, ℎ = = =
𝑛 4 2

Also as n = 4, so we will have 5 end-points. Presenting end points and corresponding


ordinates in the table below:
x 𝑥0 =0 𝑥1 =0.5 𝑥2 =1 𝑥3 =1.5 𝑥4 =2
f(x) 1 0 1 4 9

1
Now, using Simpson’s rule
3
2

(2𝑥 − 1)2 𝑑𝑥 ≈ [𝑓(𝑥0 ) + 4𝑓 (𝑥1 ) + 2𝑓 (𝑥2 ) + 4𝑓(𝑥3 ) + 𝑓 (𝑥4 )
3
0

1
= [1 + 4.0 + 2.1 + 4.4 + 9
2.3
1
= [28 = 4.667. 𝐴𝑛𝑠
6
5/20/2021 23
𝜋
Example: Estimate the following integral using simpson’s 1/3 rule, 0
𝑠𝑖𝑛𝑥 𝑑𝑥,
𝑛 = 6.

𝜋
Soln: Given integral is 0
𝑠𝑖𝑛𝑥 𝑑𝑥, 𝑛 = 6.

Here, 𝑓 (𝑥 ) = 𝑠𝑖𝑛𝑥, 𝑎 = 0, 𝑏 = 𝜋, 𝑛 = 6, 𝑎𝑛𝑑 ℎ =?


𝑏−𝑎 𝜋 −0 𝜋
We know, = =
𝑛 6 6

As n = 6, so we will have 7 end-points. Presenting end-points and corresponding


ordinates in the table below:
x 0 𝜋 6 𝜋 3 𝜋 2 2𝜋 3 5𝜋 6 𝜋
f(x) 0 1 2 3 2 1 3 2 1 2 0

Now, using simpson’s 1/3 rule,


6

𝑠𝑖𝑛𝑥 𝑑𝑥 ≈ [𝑓 (𝑥0 ) + 4𝑓 (𝑥1 ) + 2𝑓 (𝑥2 ) + 2𝑓 (𝑥3 ) + 4𝑓 (𝑥4 ) + 2𝑓 (𝑥5 ) + 𝑓(𝑥6 )
3
0

𝜋 1 3 3 1
= 0+4× +2× +4×1+2× +4× +0
6.3 2 2 2 2
𝜋
= 8 + 2 3 = 𝟐. 𝟎𝟎𝟎𝟖𝟔. Ans...
18
5/20/2021 24
1 1
Example: Define Simpson’s rule, hence evaluate 0 1+𝑥
𝑑𝑥 , for n = 4

Solution: Definition part


If a function f is continuous in [a,b]
b h
then a f x dx ≈ {f(x0)+4f(x1)+2f(x2)+4f(x3)+…………+4f(xn-1)+f(xn)} where [a,b] has been divided
3
b−a
into n-sub intervals [x0,x1],[x1,x2],[x2,x3]……..[xn-1,xn] each of length h= .
n
Second part
1 1
Given integral is 0 𝑑𝑥 with n = 4
1+𝑥
1
Here, 𝑓 (𝑥 ) = , 𝑎 = 0, 𝑏 = 1, 𝑛 = 4, 𝑎𝑛𝑑 ℎ =?
1+𝑥
𝑏−𝑎 1−0 1
We know, ℎ = = =
𝑛 4 4

Also as n = 4, so we will have 5 end-points. Presenting end points and


corresponding ordinates in the table below:

5/20/2021 25
x 𝑥0 =0 𝑥1 =0.25 𝑥2 =0.5 𝑥3 =0.75 𝑥4 =1
f(x) 1 0.8 2/3 4/7 0.5
Now, using Simpson’s 1/3 rule,
1
1 ℎ
𝑑𝑥 ≈ [𝑓 (𝑥0 ) + 4. 𝑓 (𝑥1 ) + 2𝑓 (𝑥2 ) + 4𝑓(𝑥3 ) + 𝑓 (𝑥4 )
0 1+𝑥 3

0.25 2 4
≈ ( )
1 + 4. 0.8 + 2. ( ) + 4 + 0.5
3 3 7
1 1747
= . = 0.69325
12 210

5/20/2021 26
4
Example: Given I = 0 𝑥4 𝑑𝑥
a) Approximate I using Simpson’s 1/3 rule with n = 4.
b) Determine the actual value of I
(c) Find the error of approximation from Its actual value
(d) Find the absolute error bound of approximation. Does error lies within the bound?
1
(e) How many partition point is required to get approximation within the accuracy of 2 × 10-3?
𝑏 4
Solution: Given, 𝑎 𝑓 𝑥 𝑑𝑥 = 0 𝑥4 𝑑𝑥
⇒a=0, b=2 and f(x)=𝑥4
a) Number of sub-intervals(n) = 4
𝑏−𝑎 4−0
Height of sub-intervals(h)= 𝑛 = 4 = 1
∴ the partitioned points and their ordinates are given by
x 𝑥0 =0 𝑥1 =1 𝑥2 =2 𝑥3 =3 𝑥4 =4
f(x) 0 1 16 81 256

Now using composite trapezoidal rule


4 4 ℎ
0
𝑥 𝑑𝑥 ≈ {f(x0)+4f(x1)+2f(x2)+4f(x3)+f(x4)}
3

1
= 3 { 0+ 4x1 +2x 16 +4x 81 + 256}

5/20/2021 = 205.333, which is required approximation. 27


b) Also actual value of integral is given by
4
4 4 𝑥5 1
0
𝑥 𝑑𝑥= [ ] = (45 – 05) =204.8
5 0 5

c) Error of approximation (𝐸 ) = 𝑣 − 𝑣𝑎𝑝𝑝𝑟𝑜𝑥 = 205.333 − 204.8 = 0.533

b−a 5
d) We have absolute error bound of Simpson’s approximation ( max. expected error) |𝐸𝑡 |= M
180n4
Where M= max. |f4(x)| in [a, b]

Now, we have f(x) = 𝑥4


f1(x) = 4x3
f2(x) = 12x2
f3(x) = 24x
f4(x) = 24
∴ M = max. |f4(x)| in [a, b] = [0, 4]
So, M = 24
b−a 5 4−0 5 24576
So, |𝐸𝑡 | = M = 24 = = 0.5333
180n4 180.44 46080
here, 𝐸 < | 𝐸𝑡|

i.e. 0.533 ≤ 0.5333 is true ⇒ error is within bound.


5/20/2021 28
e) Let n be number of subintervals is required to get approximation within the
1
accuracy of × 10-3
2
b−a 5 1
So, we have, |𝐸𝑡 | = 4 M ≤ ×10-3
180n 2

4−0 5 1 1
Or,
180.n4 .24 ≤ 2 × 1000
2048 1 1
Or, ≤ ×
15n4 2 1000
⇒ 15n4 ≥ 2048 ×2 ×1000
⇒ n4 ≥ 273066.667
4
⇒ n ≥ 273066.667 = 22.85 ≈ 23

∴ Number of subintervals = 23 or more and


Required number of partitioned points = n + 1 = 24 or more.

5/20/2021 29
Exercise 2:
1. A survey shows that a function f has the values as in the table

x 1 1.25 1.5 1.75 2


f(x) 10 8 7 6 5

2
Use composite Simpson’s 1/3 rule to Approximate 1
𝑓 𝑥 𝑑𝑥 given the table of values.

2. Compute the approximate value for the followings using Simpson’s 1/3 rule
𝜋
21 1
(a) 1 𝑥
𝑑𝑥 , n =2 (b) 0
1+ 𝑥 3 𝑑𝑥, 𝑛 =4 (c) 2
0
𝑐𝑜𝑠𝑥 𝑑𝑥, 𝑛 = 2
.

2 1
3. Compute an approximate value of 0 𝑥+1 𝑑𝑥 , by using Simpson’s 1/3 rule with five points subintervals. Then
compare with the actual value of the integral. Next, determine the absolute error bond for the approximation and
numerically verify an upper bound on it.
41
4. How large should we take n in order to guarantee that the approximation of 1 𝑥 𝑑𝑥, using Simpson’s 1/3 rule is
accurate within 0.0001.

5/20/2021 30

You might also like