Chapter 5
Chapter 5
Chapter 5
Chapter 5
Numerical Differentiation and integration
In chapter 4, we are concerned with a general problem of interpolation.
Several methods are available to find the derivative of a function ( ) and evaluate the definite integral
∫ ( ) . However, when ( ) is a complicated function or when it is given a tabular form, we use
numerical methods.
Numerical Differentiation
Given a set of values ( )( ) ( ) of x and y, where the values of x are equidistant, the
function ( ) represented by an interpolation formula employing differences; such as Newton’s
forward or Newton’s backward interpolation formulas. Otherwise we must represent by Lagrange’s and Newton’s
divided difference formulas.
The general method for driving Numerical differentiation formulae is to differentiate interpolating polynomial.
( ) ( )( ) ( )( )( )
()
where u= ( )
( )
( )
( ) ( )
Page 1/8
Chapter 5: Numerical Differentiation and Integration
Expression (v) gives the value of at any x which is not tabulated
In particular
( ) ( ) ( )
( ) ( )
( ) ( ) ( )
Notice: Formula for computing higher derivative may be obtained by successive differentiation
Where ( )
( ) ( ) ( )
( ) ( ) ( )
Page 2/8
Chapter 5: Numerical Differentiation and Integration
For a) x = 1 b) x = 2
c) x = 6 d) x=5.5
x 1 2 3 4 5 6
y 1 8 27 64 125 216
7
2 8 12
19 6
3 27 18 0
37 6
4 64 24 0
61 6
5 125 30
91
6 216
a) We have x0 = 1, h = 1 & x = 1
Since x= 1 is at the beginning of the table, use Newton’s forward formula
i.e
( ) ( )
( ) ( ( ) ( ) ( ) )
=7–6+2=3
and
( ) ( )
( ) ( ( ) )
= 12 – 6 = 6
( ) ( )
Page 3/8
Chapter 5: Numerical Differentiation and Integration
b) : From the above example to find ( ) and
( )
( ) ( )
( ( ) ( ))
and
( ) ( )
( ( ) ( ))
Exercise: c & d
( since x=5.5 & x=6 are at the end of the table ,use Newton’s back ward difference interpolation
formula )
Numerical integration
The primary purpose of numerical integration is the evaluation of integrals which are either impossible or
else very difficult to evaluate analytically. Numerical integration is also essential for the evaluation of
integrals of functions available only at discrete points. Such functions often arise in the numerical solution
of differential equations or from experimental data taken at discrete intervals.
Consider the integral
∫ ( ) ∫
One replaces f(x) by an interpolating polynomial (x) and obtains on integration, an approximate value of
the definite integral.
Let the interval [a, b] be divided in to n equal subintervals such that
Clearly xn = xo + nh
Hence
∫ ∫
Where
Page 4/8
Chapter 5: Numerical Differentiation and Integration
Hence
( ) ( )( )
∫ ( )
or
( ( ) ( ) ( ) ) ….()
1. Trapezoidal rule
Letting n = 1 in the general formula () above, all difference higher than the first will become zero and
we obtain
∫ [ ] ( ) ( )
∫ ( )
∫ ( )
∫ ( )
Page 5/8
Chapter 5: Numerical Differentiation and Integration
[ ]
Similarly
∫ [ ]
and finally
∫ [ ]
Summing up we obtain
∫ [ ( ) ( ) ]
i.e a polynomial of degree three so that differences of order higher than three vanish, we get:
x3
3 3 1
f ( x)dx 3h y
x0
0
2
y 0 2 y 0 3 y 0
4 8
3h
8 y0 12( y1 y0 ) 6( y 2 2 y1 y 0 ) ( y3 3 y 2 3 y1 y0 )
8
3h
y 0 3 y1 3 y 2 y3
8
x6 xn
Similarly, f ( x)dx
3h
y3 3 y 4 3 y5 y6 , …, f ( x)dx
3h
y n3 3 y n2 3 y n1 y n
x3
8 xn 3
8
Adding the above integrals, we get:
xn
Note: To use Simpson’s three-eighth rule, the given interval of integration must be divided into sub-intervals whose
number n is a multiple of 3.
Page 6/8
Chapter 5: Numerical Differentiation and Integration
Example :
6
dx
Evaluate 1 x
0
2
by using
Example 1: calculate ∫ correct to four decimal places, taking six intervals by trapezoidal rule
( )
⁄ ⁄
( )
[ ( ) )]
Example2: Find∫ , taking n=6, correct to five significant figures (using Simpson’s rule)
Solution: we have ( ) , n=6
Page 7/8
Chapter 5: Numerical Differentiation and Integration
Exercise:
2. Evaluate the integral ∫ ( ) of the following data using the Trapezoid Rule and Simpson’s 1/3
rule.
x 0.0 0.1 0.2 0.3 0.4 0.5 0.6
f(x) 1 7 4 3 5 2 3.5
Page 8/8