0% found this document useful (0 votes)
5 views19 pages

Numerical Integration Techniques Explained

Uploaded by

Åmitesh kumar
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)
5 views19 pages

Numerical Integration Techniques Explained

Uploaded by

Åmitesh kumar
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

Differentiation,

Integration and
Differential Equations
UNIT 2 NUMERICAL INTEGRATION
Structure Page Nos
2.0 Introduction 24
2.1 Objectives 25
2.2 Methods Based on Interpolation 25
2.2.1 Methods Using Lagrange’s Interpolation
2.2.2 Methods Using Newton’s Forward Interpolation
2.3 Composite Integration 34
2.4 Summary 38
2.5 Solutions/Answers 39

2.0 INTRODUCTION
In Unit 1, we developed methods of differentiation to obtain the derivative of a
function f(x), when its values are not known explicitly, but are given in the form of a
table. In this unit, we shall derive numerical methods for evaluating the definite
integrals of such functions f(x). You may recall that in calculus, the definite integral
of f(x) over the interval [a, b] is defined as

b
lim
∫ f (x) dx = h → 0 R[h ]
a

(b − a )
where R[h] is the left-end Riemann sum for n subintervals of length h = and is
n
given by

n −1
R [h ] = ∑ h f (x
k −0
k)

for the nodal points x0, x1, …, xn, where x k = x0 +kh and x0 = a, xn = b.

The need for deriving accurate numerical methods for evaluating the definite integral
arises mainly, when the integrand is either
2 sin( x )
i) a complicated function such as f(x) = e − x or f ( x ) = etc. which have no
x
anti-derivatives expressible in terms of elementary functions, or

ii) when the integrand is given in the form of tables.

Many scientific experiments lead to a table of values and we may not only require an
approximation to the function f(x) but also may require approximate representations
of the integral of the function. Also, for functions the integrals of which can be
calculated analytically, analytical evaluation of the integral may lead to
transcendental, logarithmic or circular functions. The evaluation of these functions
for a given value of x may not be accurate. This motivates us to study numerical
integration methods which can be easily implemented on calculators.

In this unit we shall develop numerical integration methods where in the integral is
approximated by a linear combination of the values of the integrand i.e.
b

∫ f (x) dx = β
a
0 f ( x 0 ) + β1 f ( x 1 ) + ............ + β n f ( x n ) (1)

24
where x0, x1, ………xn are the points which divide the interval [a, b] into n sub- Numerical Integration
intervals and β0, β1, ………βn are the weights to be determined. We shall discuss in
this unit, a few techniques to determine the unknowns in Eqn. (1).

2.1 OBJECTIVES
After going through this unit you should be able to:

• state the basic idea involved in numerical integration methods for evaluating the
definite integral of a given function;
• use numerical integration method to find the definite integral of a function f(x)
whose values are given in the form of a table;
• use trapezoidal and Simpson’s rules of integration to integrate such functions
and find the errors in these formulas.

2.2 METHODS BASED ON INTERPOLATION


In Block 2, you have studied interpolation formulas, which fits the given data (xk, fk),
k = 0, 1, 2, …………….., n. We shall now see how these interpolation formulas can
be used to develop numerical integration methods for evaluating the definite integral
of a function which is given in a tabular form. The problem of numerical integration
is to approximate the definite integral as a linear combination of the values of f(x) in
the form
b n

∫a
f ( x ) dx ≈ ∑β
k =0
k fk (2)

where the n + 1 distinct points xk, k = 0, 1, 2, ………., n are called the nodes or
abscissas which divide the interval [a, b] into n sub-intervals with
(x0 < x1, < x2, ……. < xn-1 < xn) and βk, k =0, 1, ….n, are called the weights of the
integration rule or quadrature formula. We shall denote the exact value of the definite
integral by I and denote the rule of integration by

n
I h [f ] = ∑ β k f k (3)
k =0

The error of approximating the integral I by Ih [f] is given by

b n
E h [f ] = f ( x )dx −
∫ ∑β
k =0
kfk (4)
a

The order of the integration method (3) is defined as follows:

Definition : An integration method of the form (3) is said to be of order p if it


produces exact results for all polynomials of degree less than or equal to p.

In Eqn. (3) we have 2n+2 unknowns viz., n + 1 nodes xk and the n + 1 weights, βk and
the method can be made exact for polynomials of degree ≤ 2n + 1. Thus, the method
of the form (3) can be of maximum order 2n + 1. But, if some of the values are
prescribed in advance, then the order will be reduced. If all the n + 1 nodes are
prescribed, then we have to determine only n + 1 weights and the corresponding
method will be of maximum order n.

We first derive the numerical method based on Lagrange’s interpolation.


25
Differentiation, 2.2.1 Methods Using Lagrange’s Interpolation
Integration and
Differential Equations Suppose we are given the n + 1 abscissas xk’s and the corresponding values fk’s are
known that the unique Lagrange’s interpolating polynomial Pnn(x) of degree ≤ n,
satisfying the interpolatory conditions Pn (xk)= f(xk), k = 0, 1, 2, ….. n, is given by

n
f ( x ) ≈ Pn ( x ) = ∑L
k =0
k ( x )f k (5)

with the error of interpolation

π( x ) n +1
E n +1 [Pn ( x )] = f (α) , with x 0 < α < x n (6)
(n + 1)!

( x − x 0 ) ( x − x1 )....( x − x k −1 ) ( x − x k +1 )....( x − x n )
where Lk (x) =
( x k − x 0 ) ( x k − x1 ) ......( x k − x k −1 ) ( x k − x k +1 )....( x k − x n )

and π( x ) = ( x − x 0 ) ( x − x 1 )...( x − x n ) .

We replace the function f(x) in the definite integral (2) by the Lagrange interpolating
polynomial Pn (x) given by Eqn. (5) and obtain

b n b n
I n [f ] = ∫
a
Pn ( x )dx = ∑∫
k =0
a
L k ( x )f k dx = ∑β
k −0
kfk (7)

b
where β k = ∫La
k ( x ) dx. (8)

The error in the integration rule is

b b
π( x )
E n [f ] = E n +1 [Pn ( x )] dx =
∫ ∫ (n + 1)!f
n +1
(α)dx (9)
a a

We have

b
M n +1
E n [f ] ≤ ∫ π( x ) dx (10)
(n + 1)!
a

max
where M n +1 = f n+1 ( x )
x0 < x < xn

Let us consider now the case when the nodes xk ‘s are equispaced with x0 = a, xn = b
b−a
with the length of each subinterval as h = . The numerical integration methods
n
given by (7) are then known as Newton-Cotes formulas and the weights βk’s given
by (8) are known as Cotes numbers. Any point x ε [a, b] can be written as x = x0 +
sh.

With this substitution, we have

π (x) = h n+1 s (s─1) (s─2) (s─3) ……(s─n)


26
Numerical Integration
(−1) n − k s(s − 1)....(s − k + 1)(s − k − 1).....(s − n )
L k (x) = (11)
k! (n − k )!

Using x = x0 + sh and changing the variable of integration from x to s, we obtain

n
(−1) n − k
βk =
k! (n − k )! ∫
h s(s − 1)(s − 2).........(s − k + 1)(s − k − 1)......(s − n ) ds
0
(12)

n
h n + 2 M n +1
and E n [f ] ≤ ∫ s(s − 1)(s − 2).....(s − n)ds (13)
(n + 1)!
0

We now derive some of the Newton Cotes formulas viz. trapezoidal rule and
Simpson’s rule by using first and second degree Lagrange polynomials with equally
spaced nodes.

Trapezoidal Rule

When n = 1, we have x0 = a, x1= b and h = b─a. Using Eqn. (12) the Cotes numbers
can be found as

1
h
β 0 = − h ∫ (s − 1)ds = ;
0
2
1
h
and ∫
β1 = h s ds =
0
2
.

Substituting the values of β0 and β1 in Eqn. (7), we get

h
IT [ f ] = [f 0 + f1 ] (14)
2

The error of integration is

1
h3 h3 h3
E T [f ] ≤ M2 ∫ s (s − 1) ds = − M2 = M2
2 12 12
0

Where M2 = max f " ( x )


x0 <x<x1

b
Thus, by trapezoidal rule, ∫ f (x ) dx is given by
a

h h3
I[f ] = (f 0 + f 1 ) − M2
2 12

The reason for calling this formula the trapezoidal rule is that geometrically when f(x)
is a function with positive values then h (f0 + f1)/2 is the area of the trapezium when
height h = b─a and parallel sides as fo and f1. This is an approximation to the area
under the curve y = f(x) above the x-axis bounded by the ordinates x = x1 (see Fig. 1.)
27
Differentiation, Since the error given by Eqn. (15) contains the second derivative, trapezoidal rule
Integration and integrates exactly polynomials of degree ≤ 1.
Differential Equations

P1

a = x0 x1 = b

Fig. 1

Let us now consider an example.

Example 1: Find the approximate value of

1
dx
I= ∫ 1+ x
0

using trapezoidal rule and obtain a bound for the error. The exact value of
I = ln2 = 0.693147 correct to six decimal places.

Solution: Here x0 = 0, x1=1, and h = 1 – 0 = 1. Using Eqn. (14), we get

1 1
IT [f ] = 1 +  = 0.75
2  2

Actual error = 0.75 – 0.693147 = 0.056853.

The error in the trapezoidal rule is given by

1 2 1
ET [f ] ≤ max 3
= = 0.166667
12 (1 + x ) 6

Thus, the error bound retain is much greater than the actual error.

We now derive the Simpson’s rule.

Simpson’s Rule

b−a a+b
For n = 2, we have h = , x 0 = a, x 1 = and x 2 = b.
2 2

From (12), we find the Cotes numbers as

2
h h
β0 =
20 ∫
(s − 1) (s − 2) ds =
3
28
2 2 Numerical Integration
4h h h

β1 = h s(s − 2) ds =
0
3
, β2 =
20 ∫
s(s − 1) ds = .
3

Eqn. (7) in this case reduces to

h
I S [f ] = [f 0 + 4f1 + f 2 ] (17)
3

b
Eqn. (17) is the Simpson’s rule for approximating I = ∫ f (x ) dx
a
The magnitude of the error of integration is

2
h 4M3
E2[f ] ≤ ∫ s (s − 1) (s − 2) ds
3!
0

h 4M3  
1 2
=
3! 
0
∫ 1

 s (s − 1) (s − 2) ds + s(s − 1) (s − 2) ds 

 s 4 1 2

h 4M3 2  s4 2
=  − s + s  +  − s + s  
3 3
3!  4  4
0 
 
1 

h 4M3  1 1 
= − =0
3!  4 4 

This indicates that Simpson’s rule integrates polynomials of degree 3 also exactly.
Hence, we have to write the error expression (13) with n = 3. We find

5 2
ES [ f ] ≤h M4
∫ s(s − 1) (s − 2) (s − 3) ds
24
0

h 5M 4  
1 2
=
24  0 ∫ 1

 s(s − 1) (s − 2) (s − 3) ds + s (s − 1) (s − 2) (s − 3) ds 

(18)

− h 5M 4
=
90

max
where M 4 = f IV (X)
x0 < x < x2

Since the error in Simpson’s rule contains the fourth derivative, Simpson’s rule
integrates exactly all polynomials of degree ≤ 3.

b
Thus, by Simpson’s rule, ∫ f (x) dx is given by
a

5
h
I S [f ] = [f 0 + 4f 1 + f 2 ] − h M 4
3 90
29
Differentiation, h
Integration and Geometrically, [f 0 + 4f1 + f 2 ] represents the area bounded by the quadratic curve
Differential Equations 3
passing through (x0 , f0), (x1 , f1) and (x2 , f2) above the x-axis and lying between the
ordinates x = x0, x = x2 (see figure. 2).

y
f

P2

x
a= x0 x1 x2 = b
Fig. 2

In case we are given only one tabulated value in the interval [a, b], then h = b – a, and
the interpolating polynomial of degree zero is P0(x) = fk. In this case, we obtain the
rectangular integration rule given by

b
I R [f ] = f k dx ≈ hf k
∫ (19)
a

The error in the integration rule is obtained from Eqn. (13) as

h 2 M1
ER f ≤ (20)
2

where max
M1 = f '(x )
a < x < b

If the given tabulated value in the interval [a, b] is the value at the mid-point then we
( a + b)
have x k = , and f k = f 1 . In this case h = b – a and we obtain the integration
2 k+
2
rule as

b
I M [f ]= f ∫ 1 dx ≈ hf 1
(21)
k+ k+
a 2 2

Rule (21) is called the mid-point rule. The error in the rule calculated from (13) is

h2
E M [f ]=
1/ 2

2 ∫
−1 / 2
s ds = 0

This shows that mid-point rule integrates polynomials of degree one exactly. Hence
the error for the mid-point rule is given by
30
Numerical Integration
h 3M 2 h 3M 2
E M [f ]≤
1/ 2

2 ∫−1 / 2
s (s − 1) ds =
24
(22)

max
where M 2 = f " ( x ) and h = b – a
a<x<b

We now illustrate these methods through an example.


2
Example 2 : Evaluate e − x dx, u sin g
0

a) Rectangular rule b) mid-point rule c) trapezoidal rule and d) Simpson’s rule. If


the exact value of the integral is 0.74682 correct to 5 decimal places, find the
error in these rules.
2
Solution: The values of the function f(x) = e − x at x = 0, 0.5 and 1 are

f(0) = 1, f(0.5) = 0.7788, f(1) = 0.36788

Taking h = 1 and using

a) I R [f ]= hf 0, we get I R [f ]=1.

b) I M [f ]= hf1 / 2, we get I M [f ]= 0.7788

h
c) I T [f ] = [f 0 + f1 ] we get I T [f ] = 1 (1 + 0.36788) = 0.68394.
2 2
Taking h = 0.5 and using Simpson’s rule, we get

h
d) I S [f ] = [f 0 + 4f1 + f 3 ]
3

h
= [f (0) + 4f (0.5) + f (1)]
3

= 0.74718
Exact value of the integral is 0.74682.

The errors in these rules are given by

E R [f ]= − 0.25318, E M [f ]= − 0.03198

E T [f ] = 0.06288, E s [t ] = − 0.00036.

You may now try the following exercise:


Ex.1) Use the trapezoidal and Simpson’s rule to approximate the following
integrals. Compare the approximations to the actual value and find a bound
for the error in each case.
2
a) ∫ 1n x dx
1

31
Differentiation, 0.1

∫x
1/ 3
Integration and b) dx
Differential Equations 0
π/4
c) ∫ tan x dx
0

We now derive integration methods using Newton’s forward interpolation formula.

2.2.2 Methods Using Newton’s Forward Interpolation


Let the data be given at equi-spaced nodal points x k = x 0 + sh, s = 0,1, 2, ........., n ,
Where x0 = a and xn = x0 + nh = b.

b−a
The step length is given by h = .
n

The Newton’s forward finite difference interpolation formula interpolating this data is
given by

∆2f 0 s (s − 1) (s − 2) ... (s − n + 1) ∆n f 0
f ( x ) ≈ Pn ( x ) = f 0 + s∆f 0 + s(s − 1) + ... + (23)
2 n!

with the error of interpolation

h n +1 s(s − 1) (s − 2) ... (s − n ) n +1
E n [f ]= f (α )
(n + 1) !

Integrating both sides of Eqn. (23) w.r.t. x between the limits a and b, we can
approximate the definite integral I by the numerical integration rule

b 1
 s (s − 1) 2 
I h [f ] = Pn ( x ) dx = h
∫ ∫ f 0 + s ∆f 0 + ∆ f 0 + ... ds (24)
2 
a 0

The error of interpolation of (24) is given by

1
h n + 2 M n +1
E h (f ) ≤
(n + 1) ! 0 ∫
s (s − 1) (s − 2) ... (s − 1) ds

We can obtain the trapezoidal rule (14) from (24) by using linear interpolation i.e.,
f(x) ≈ P1 ( x ) = f 0 + s ∆ f 0 . We then have

1
IT (x ) = h ∫ [f
0
0 + s∆f 0 ]ds

1
 s2 
= h s f 0 + ∆f 0 
 2 0

 ∆f  h
= h f 0 + 0  = [f 0 + f1 ]
 2  2
32
with the error of integration given by (15). Numerical Integration

Similarly Simpson’s rule (16) can be obtained from (24) by using quadratic
interpolation i.e., f (x) ≈ P2 (x).

Taking x0 = a, x1 = x0 + h, x2 = x0 + 2h = b, we have

b 2
 s (s − 1) 2 
Is [f ]= ∫ f ( x ) dx ≈ h ∫ f 0 + s ∆f 0 + ∆ f 0  ds
a 0  2 

 ∆2 f 0 
= h 2 f 0 + 2∆f 0 + 
 3 

h
= [f n + 4f1 + f 2 ].
3

The error of interpolation is given by Eqn. (18).

1
dx
Example 3: Find the approximate value of I = ∫ 1 + x u sin g
0

Simpson’s rule. Obtain the error bound and compare it with the actual error. Also
compare the result obtained here with the one obtained in Example 1.
1
Solution: Here x0 = 0, x1 = 0.5, x2 = 1 and h = .
2
Using Simpson’s rule we have

I s [f ] =
h
[f (0) + 4f (0.5) + f (1)] = 1 1 + 8 + 0.5 = 0.694445
3 6 3 

Exact value of I =ln 2 = 0.693147.

Actual error = 0.001297. The bound for the error is given by

h5 24
E s [f ] ≤ M 4 = 0.00833, where M 4 = max = 24
90 (1 + x ) 5

Here too the actual error is less than the given bound.

Also actual error obtained here is much less than that obtained in Example 1. You
may now try the following exercise.

1.5

∫e
x
Ex. 2) Find an approximation to dx, u sin g
1.1
a) the trapezoidal rule with h = 0.4
b) Simpson’s rule with h = 0.2

The Newton-Cotes formulas as derived above are generally unsuitable for use over
large integration intervals. Consider for instance, an approximation to
4

∫e
x
dx, using Simpson’s rule with h = 2. Here
0
33
Differentiation, 4

∫ e dx ≈ 3 (e )
x 2 0
Integration and + 4e 2 + e 4 = 56.76958.
Differential Equations 0

Since the exact value in this case e4 – e0 = 53.59815, the error is –3.17143. This error
is much larger than what we would generally regard as acceptable. However, large
error is to be expected as the step length h = 2.0 is too large to make the error
expression meaningful. In such cases, we would be required to use higher order
formulas. An alternate approach to obtain more accurate results while using lower
order methods is the use of composite integration methods, which we shall discuss in
the next section.

2.3 COMPOSITE INTEGRATION


In composite integration we divide the given interval [a, b] into a number of
subintervals and evaluate the integral in each of the subintervals using one of the
integration rules. We shall construct composite rules of integration for trapezoidal
and Simpson’s methods and find the corresponding errors of integration when these
composite rules are used.

Composite Trapezoidal Rule

(b − a )
We divide the interval [a, b] into N subintervals of length h = . We denote the
N
subintervals as

( x k −1 , x k ), k =1, 2, .. , N where x 0 = a , x N = b. Then

b N xk


I = f ( x ) dx = ∑ ∫
k =1 x k −1
f ( x ) dx (25)
a

Evaluating each of the integrals on the right hand side by trapezoidal rule, we have

N (26)
h
I T [f ] = ∑ [f k −1 + f k ] = h [f 0 + f N + 2(f1 + f 2 + ..... + f N −1 ) ]
k =1
2 2

`
h  
3 N
E T [f ] = − ∑
 f " (α i ) , x k −1 < α i < x k , for k = 1...., N.
12  i =1 

Now since f is a continuous function on the interval [a, b] we have as a consequence


of Intermediate-value theorem

N N

∑ i =1
f " (α i ) = f " (ξ) ∑ 1, where a < ξ < b.
i =1
3
−h
∴E T [f ]= f " (ξ) N, a < ξ < b.
12
− Nh 3
= h f " ( ξ)
12
− ( b − a ) h 2.
= f " (ξ).
12
34
max Numerical Integration
If M 2 = f " (ξ) . Then
a<ξ<b

(b − a ) h 2
E T [f ] ≤ M2 (27)
12

The error is of order h2 and it decreases as h decreases

Composite trapezoidal rule integrates exactly polynomials of degree ≤ 1. We can try


to remember the formula (26) as

h
I T [f ]=   [first ordinate + last ordinate + 2 (sum of the remaining ordinates)].
2

Composite Simpson’s Rule


In using Simpson’s rule of integration (17), we need three abscissas. Hence, we divide
the interval (a, b) into an even number of subintervals of equal length giving an odd
b−a
number of abscissas in the form a = x0 < x1 < x2 < ….. < x2n = b with h = and
2N
xk = x0 + kh, k = 0, 1, 2, …, 2N. We then write

b N x 2k


I = f ( x) dx = ∑ ∫
k =1 x 2 k − 2
f ( x ) dx (28)
a

Evaluating each of the integrals on the right hand side of Eqn. (28) by the Simpson’s
rule, we have

h
N = [f0 + f2N + 4(f1 + f3 +....+ f2N−1) + 2(f2 + f4 + ....+ f2N−2)] (29)
h
Is[f ] =
∑ [f2k−2+4f2k−1+f2k] 3
k=1
3

The formula (29) is known as the composite Simpson’s rule of numerical

integration. The error in (29) is obtained from (18) by adding up the errors. Thus we
get
h5  
N
E s [f ] = − ∑IV
 f (α )  , x 2 k − 2 < α k < x 2 k
90  k =1 
N
h5
= −
90
f iv
(ξ ) ∑i =1
1, a < ξ < b

Nh 5 IV
=− f (ξ)
90
(b − a ) h 4 IV
=− f (ξ).
180

max (b − a )
If M 4 = f IV (ξ) write using h =
a ≤ ξ ≤b 2N
(b − a ) 4
E s [f ] ≤ h M4 (30)
180
35
Differentiation, The error is of order h4 and it approaches zero very fast as h → 0. The rule integrates
Integration and exactly polynomials of degree ≤ 3. We can remember the composite Simpson’s rule
Differential Equations
as

h
Is [f ]=   [first ordinate + last ordinate + 2 (sum of even ordinates) + 4 (sum of the remaining odd ordinates)]
3

We now illustrate composite trapezoidal and Simpson’s rule through examples.

1
dx
Example 4: Evaluate ∫ 1+ x
0
using

(a) Composite trapezoidal rule (b) composite Simpson’s rule with 2, 4 and 8
subintervals.
1
Solution: We give in Table 1 the values of f (x) with h = from x = 0 to x = 1.
8
Table 1
x : 0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 1

f(x) : 1 8/9 8/10 8/11 8/12 8/13 8/14 8/15 8/16


f0 f1 f2 f3 f4 f5 f6 f7 f8

If N = 2 then h = 0.5 and the ordinates f 0, f4 and f8 are to be used

We get

1
I T [f ]= [f 0 + 2f 4 + f8 ]= 17 = 0.708333
4 24
1 25
Is [f ]= [f 0 + 4f1 + f 8 ]= = 0.694444
6 36

If N = 4 then h = 0.25 and the ordinates f0, f2, f4, f6, f8 are to be used.

We have

1
I T [f ] = [f 0 + f8 + 2(f 2 + f 4 + f 6 )]= 0.697024
8
1
I T [f ] = [f 0 + f 8 + 4 (f 2 + f 6 ) + 2 f 4 ] = 0.693254
12

If N = 8 then h = 1/8 and all the ordinates in Table 1 are to be used.

We obtain

1
I T [f ] = [f 0 + f8 + 2 (f1 + f 2 + f 3 + f 4 + f 5 + f 6 + f 7 )]= 0.694122
16

1
Is [f ] = [f 0 + f8 + 4 (f1 + f 3 + f 5 + f 7 ) + 2 (f 2 + f 4 + f 6 )]= 0.693147
24

The exact value of the given integral correct to six decimal places is ln2 = 0.693147.

We now give the actual errors in Table 2 below.


36
Table 2 Numerical Integration
N ET (f) Es (f)
2 0.015186 0.001297
4 0.003877 0.000107
8 0.000975 0.000008

Note that as h decreases, the errors in both trapezoidal and Simpson’s rule also
decreases. Let us consider another example.
1
dx
Example 5: Find the minimum number of intervals required to evaluate
0
1 + x ∫
with

an accuracy 10-6, by using the Simpson rule.

Solution: In example 4 you may observe from Table 2 that N ≈ 8 gives


(1.E─06) accuracy. We shall now determine N from the theoretical error bound for
Simpson’s rule which gives 1.E − 06 accuracy. Now

(b − a )5 M 4
E s [f ] ≤
2880 N 4

where

max
M4 = f IV ( x )
0 < x <1

max 24
= = 24
0 < x < 1 (1 + x )5

To obtain the required accuracy we should therefore have

24 24 * 10 6
≤ 10 − 6 , or N 4 ≥ = 8333.3333
2880 N 4 2880

∴N ≥ 9.5

We find that we cannot take N = 9 since to make use of Simpson’s rule we should
have even number of intervals. We therefore conclude that N = 10 should be the
minimum number of subintervals to obtain the accuracy 1.E – 06 (i.e., 10-6)
1
dx
Ex.3) Evaluate ∫1+ x
0
2
by subdividing the interval (0, 1) into 6 equal parts and

using.

(a) Trapezoidal rule (b) Simpson’s rule. Hence find the value of π and actual errors.

Ex. 4) A function f(x) is given by the table

x : 1.0 1.5 2.0 2.5 3.0

f(x) : 1.000 2.875 7.000 14.125 25.000

37
Differentiation, Ex.5) The speedometer reading of a car moving on a straight road is given by the
Integration and following table Estimate the distance traveled by the car in 12 minutes using
Differential Equations
(a) Trapezoidal rule (b) Simpson’s rule.

Time : 0 2 4 6 8 10 12
(minutes)
Speedo meter : 0 15 25 40 45 20 0
Reading

0.4

Ex.6) Evaluate ∫ (sin x − 1n x + e x ) dx


0.2
using (a) Trapezoidal rule (b)

Simpson’s rule taking h = 0.1. Find the actual errors.


2
Ex.7) Determine N so that composite trapezoidal rule gives the value of e − x dx
0
−x 2
correct upto 3 digits after the decimal point, assuming that e can be calculated
accurately.

2.4 SUMMARY
In this unit, we learnt the following :

1) If a function f(x) is not known explicitly but a table of values of x is given or


when it has no anti-derivative expressible in terms of elementary functions then
its integral cannot be obtained by calculus methods. In such cases numerical
integration methods are used to find the definite integral of f(x) using the given
data.

2) The basic idea of numerical integration methods is to approximate the definite


integral as a linear combination of the values of f(x) in the form

b n

∫ f ( x ) dx ≈ ∑β
k =0
k f (x k ) (See Eqn. (21))
a

where the (n+1) distinct nodes x k , k = 0,1, ...., n , with x 0 < x1 < x 2 < .... < x n divide
the interval (a, b) into n subintervals and β k , k = 0,1, ...., n are the weights of the
integration rule. The error of the integration methods is then given by

b n
E h [f ] = f ( x ) dx −
∫ ∑β
k =0
k f (x k ) (see Eqn. (4))
a

3) For equispaced nodes, the integration formulas derived by using Lagrange


interpolating polynomials Pn (x) of degree ≤ n, satisfying the interpolatory
conditions Pn ( x k ) = f ( x k ), k = 0,1, ..., n are known as Newton-Cotes formulas.
Corresponding to n = 1 and n = 2, Newton-Cotes formulas viz., trapezoidal rule
and Simpson’s rule are obtained.

38
4) For large integration intervals, the Newton-Cotes formulas are generally Numerical Integration
unsuitable for they give large errors. Composite integration methods can be
used in such cases by dividing the interval into a large number of subintervals
and evaluating the integral in each of the subintervals using one of the
integration rules.

2.5 SOLTIONS/ANSWERS
h
E1) a) I T [f ]= [f 0 + f1 ]= 0.346574
2

h
Is [f ]= [f 0 + 4f1 + f 2 ]
3
0 .5
= [41n 1.5 +1n 2]= 0.385835
3

Exact value of I = 0.386294

Actual error in I T [f ]= 0.03972

Actual error in IS [f ]= 0.0000459

Also
h 3 max 1 1
E T [f ] ≤ − 2
=− = − 0.083334
12 1 < x < 2 x 12

h5 max 6
E s [f ] ≤ − = − 0.002083
90 1 < x < 2 x 4

b) I T [f ]= 0.023208, E T [f ] = none .
IS [f ]= 0.032296, E S [f ] = none .

Exact value = 0.034812.

c) I T [f ] = 0.39270, E T [f ] = 0.161.

IS [f ]= 0.34778 , E S [f ] = 0.00831.

Exact value = 0.34657

E2) I T [f ]=1.49718

IS [f ]=1.47754

1
E3) With h = 1/6, the values of f(x) =
1 + x2

From x = 0 to 1 are

x : 0 1/6 2/6 3/6 4/6 5/6 1

f(x) : 1 0.972973 0.9 0.8 0.692308 0.590167 0.5


39
Differentiation, Now
Integration and
Differential Equations
h
I T [f ]= [f 0 + f 6 + 2(f1 + f 2 + f 3 + f 4 + f 5 )]
2

= 0.784241

h
IS [f ]= [f 0 + f 6 + 4 (f1 + f 3 + f 5 ) + 2(f 2 + f 4 )]
3

= 0.785398

[ ]10 = π4 .
1
dx
∫0
1+ x 2
= tan −1x Exact π = 3.141593

Value of π from I T [f ]= 4 x 0.784241 = 3.136964

Error in calculating π by I T [f ] is E T [f ]= 0.004629

Value of π from Is [f ]= 4 x 0.785398 = 3.141592

Error in π by I s [f ] is E s [f ]= 1.0 ×10 −6

h
E4) I T [f ]=   [f 0 + f 4 + 2(f1 + f 2 + f 3 ) ]
2

= (1 / 4 )[1 + 25 + 2(2.875 + 7 + 14.125)] = 18.5


h
Is [f ]=   [f 0 + f 4 + 2f 2 + 4(f1 + f 3 )]
3
= (1 / 6) [1 + 25 + 2 x 7 + (2.875 + 14.125)]=18

E5) Let v 0 = 0, v 1 = 15, v 2 = 25, v 3 = 40, v 4 = 45, v 5 = 20, v 6 = 0. Then

12
I= ∫
0
v dt ,

h
I T [v] =   [v 0 + v 6 + 2( v1 + v 2 + v 3 + v 4 + v 5 )] =290
2
880
Is [v]= = 293.33.
30

E6) The values of f(x) = sin x = 1n x + ex are

f (0.2) = 3.02951, f (0.3) = 2.849352, f (0.4) = 2.797534

 0.1 
I T [f ]=   [f (0.2) + 2f (0.3) + f (0.4)]= 0.57629
 2 

 0.1 
IS [f ]=   [f (0.2) + 4f (0.3) + f (0.4)]= 0.574148
 3 

Exact value = 0.574056


40
ET = 2.234 x 10-3 Numerical Integration

Es = 9.2 x 10-5

E7) Error in composite trapezoidal rule

(b − a ) 3 max
E T [f ] = − 2
M2 , M2 = f " (x) .
12 N 0 < x <1

Thus

1 max
E T [f ] ≤ 2
f " (x)
12 N 0 ≤ x ≤1

2 2
f ( x ) = e − x , f " ( x ) = e − x (4x 2 − 2)

2
f " ' ( x ) = e − x 4x (3 − 2 x 2 ) = 0 when or x = 0, x = 1.5

max [f " (0) , f " (1)] = max 2, 2e −1 = 2 [ ]


For getting the correct value upto 3 digits, we must have

2 103 10 4
< 10 − 03 or N 2 > =
12 N 2 6 60
or

100
N> ≈12.9 .
(60)

The integer value of N =13.

41
Differentiation,
Integration and
Differential Equations

42

You might also like