Chapter 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Chapter 5: Numerical Differentiation and Integration

Chapter 5
Numerical Differentiation and integration
In chapter 4, we are concerned with a general problem of interpolation.

i.e. given a set of values ( )( ) ( ) of x and y= ( ) , to find a polynomial ( ) of the


lowest degree such that y(x) and ( ) agree at the set of tabulated points.

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.

1. Derivatives using Newton’s forward interpolation formula

Newton’s forward interpolation formula is

( ) ( )( ) ( )( )( )
()

where u= ( )

Differentiating (i) w.r.t u and (ii) w.r.t x we get

( )

( )

By chain rule we have

( ) ( )

Page 1/8
Chapter 5: Numerical Differentiation and Integration
Expression (v) gives the value of at any x which is not tabulated

In particular

Putting u = 0 in to (v) we get

( ) ( ) ( )

Differentiating (v) once again we obtain

( ) ( )

( ) ( ) ( )

Notice: Formula for computing higher derivative may be obtained by successive differentiation

2. Derivative using Newton’s backward interpolation formula


The formula is
( ) ( )( ) ( )( )( )
( )

Where ( )

From ( )&( ) together with chain rule


( ) ( ) ( )
( ) ( )

( ) ( ) ( )

Differentiating (xii) w.r.t x gives


( )
( ) ( ( ) )

( ) ( ) ( )

Similarly we can find the derivatives of higher order at x= xn


Notice: In a similar way different formulae can be derived by starting with other interpolation formula

Page 2/8
Chapter 5: Numerical Differentiation and Integration

Example: from the table of value compete

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

Solution: the difference table is

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

∫ ∫

Approximating y by Newton’s forward difference formula, we obtain


( ) ( )( )
∫ ( )

Where

Page 4/8
Chapter 5: Numerical Differentiation and Integration
Hence
( ) ( )( )
∫ ( )

This gives on simplification


( ) ( )
∫ ( )

or
( ( ) ( ) ( ) ) ….()

The above equation () is called Gauss Legendre Quadrature formula.


Now we deduce quadrature formulae, namely
1. Trapezoidal rule (When n = 1)
2. Simpson’s rule (When n = 2) Simpson’s rule

3. Simpson’s ⁄ rule (When n = 3)

1. Trapezoidal rule
Letting n = 1 in the general formula () above, all difference higher than the first will become zero and
we obtain

∫ [ ] ( ) ( )

Similarly one can show that

∫ ( )

∫ ( )

For the last interval[ ], we have

∫ ( )

Combing all the expressions, we obtain the rule

∫ [ ( ) ] This is known as the trapezoidal rule.

Page 5/8
Chapter 5: Numerical Differentiation and Integration

2. Simpson’s rule /Simpson’s rule/

The rule is obtained by putting n = 2 in equation  (quadrature formula)


i.e by replacing the curve y = f(x), by ⁄ arcs of second degree polynomials or paraboral thus,
( )
∫ * + * +

[ ]

Similarly

∫ [ ]

and finally

∫ [ ]

Summing up we obtain

∫ [ ( ) ( ) ]

Which is known as Simpson’s ⁄ rule or simply Simpson’s rule.


Note: this rule requires the divisions of the whole range in to an even number of subintervals of width h.
3. The Simpson’s three-eighth Rules
The rule is obtained by putting n = 3 in equation  (quadrature formula)

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 n3  3 y n2  3 y n1  y n 
x3
8 xn  3
8
Adding the above integrals, we get:
xn

 f ( x)dx  8 ( y  y n )  3( y1  y 2  y 4  y5  ...  y n2  y n1 )  2( y3  y 6  ...  y n3 )


3h
0
x0

which is known as Simpson’s three-eighth rule.

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

(i) Trapezoidal Rule


(ii) Simpson’s one-third rule
(iii) Simpson’s three-eighth rule, take h = 1

Example 1: calculate ∫ correct to four decimal places, taking six intervals by trapezoidal rule

Solution : Here we have

( )

⁄ ⁄
( )

The trapezoidal rule can be written as


∫ [ ( ) ]

[ ( ) )]

∫ Correct to four decimal places.

Example2: Find∫ , taking n=6, correct to five significant figures (using Simpson’s rule)
Solution: we have ( ) , n=6

X 0.0 0.1 0.2 0.3 0.4 0.5 0.6

1.0000 1.10517 1.22140 1.34986 1.49182 1.64872 1.82212


Simpson’s rule
[( ) ( ) ( )]

∫ correct to five significant figures.

Page 7/8
Chapter 5: Numerical Differentiation and Integration
Exercise:

1. given the following table of values for a function f(x)

x 0.25 0.35 0.45 0.55 0.65 0.75


f(x) 0.24740 0.34290 0.43497 0.52269 0.60518 0.68164
Use Newton’s interpolation formula to find the approximate value of
a. f’(0.25) and f’’(0.25)
b. f’(0.7) and f’’(0.7)

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

You might also like