Unit II - Numerical Methods IV Sem
Unit II - Numerical Methods IV Sem
Numerical Methods - I
FINITE DIFFERENCES:
FORWARD DIFFERENCES:
Let y0, y1, y2, ……. yr ….. be the values of a function y = f(x) corresponding to the values x0,
x1, x2, ……. xr ….. of x respectively. Then
yr = yr +1 − yr r = 0, 1, 2, 3, ……..
n yr = n −1 yr +1 − n −1 yr r = 0, 1, 2, 3, ……..
In a difference table the values of x are called arguments and the values of y are called
entries. The first entry y0 is called the leading term and the differences y0, 2y0, 3y0 ….. are
called leading differences.
BACKWARD DIFFERENCES:
Let y0, y1, y2, ……. yr ….. be the values of a function y = f(x) corresponding to the values x0,
x1, x2, ……. xr ….. of x respectively. Then
1
The first backward difference of f(x) is defined as
yr = yr − yr −1 r = 1, 2, 3, ……..
n yr = n −1 yr − n −1 yr −1 r = n, n + 1, n + 2, ……..
y4
x4 y4
Interpolation:
Let y0, y1, y2, ……. yn be n + 1 values of an unknown function y = f(x) corresponding
to the n + 1 values x0, x1, x2, ……. xn of x respectively. With these values of x and y in hand,
suppose we wish to estimate the value of y corresponding to a specified value of x that lies
between x0 and xn. The process of making this estimation is called interpolation. The process
of estimating the values of y for some value of x outside the interval (x0 , xn) is called
extrapolation. The word interpolation generally includes the word extrapolation as well.
Statement:
2
r (r − 1) 2 r (r − 1)(r − 2) 3
y = f ( x) = y0 + r y0 + y0 + y0 + .........
2! 3!
r (r − 1)(r − 2)..........(r − n + 1) n
......................... + y0
n!
Statement:
r (r + 1) 2 r (r + 1)(r + 2) 3
y = f ( x ) = y n + r y n + yn + yn + .........
2! 3!
r (r + 1)(r + 2)..........(r + n − 1) n
......................... + yn
n!
Problem 1: Given
Find f(0.25).
Solution: We first form the following difference table.
xr = x0 + rh = 0.25
3
xr − x0 0.25 − 0.1
r = = = 1.5 .
h 0.1
r (r − 1) 2 r (r − 1)(r − 2) 3
f ( xr ) = yr = y0 + r y0 + y0 + y0
2! 3!
r (r − 1)(r − 2)(r − 3) 4 r (r − 1)(r − 2)(r − 3)(r − 4) 5
+ y0 + y0
4! 5!
xr = x0 + rh = 1.1
xr − x0 1.1 − 1
r = = = 0.25 .
h 0.4
r (r − 1) 2 r (r − 1)(r − 2) 3
f ( xr ) = yr = y0 + r y0 + y0 + y0
2! 3!
4
(0.25)(0.25 − 1) (0.25)(0.25 − 1)(0.25 − 2)
f (1.1) = 3.49 + (0.25)(1.33) + (−0.19) + (−0.41)
2 6
= 3.81789
Problem 3: Find the interpolating polynomial f(x) satisfying f(0) = 0, f(2) = 4, f(4) = 56, f(6)
= 204, f(8) = 496, f(10) = 980 and hence find f(3).
Solution: The forward difference table for the given data is shown below
xr = x0 + rh = x
xr − x0 x − 0 x
r = = = .
h 2 2
x x x x x
− 1 − 1 − 2
x
f ( x) = 0 + ( 4 ) + 2 2 ( 48 ) + 2 2 2 ( )
48
2 2 6
f ( x) = 2 x + x( x − 2)(6) + x( x − 2)( x − 4)
f ( x) = x 3 − 2 x .
For x = 3 we get
5
f (3) = 33 − 2(3) = 21
Problem 4: From the following table estimate the number of students who obtained marks
Marks 30 - 40 40 - 50 50 - 60 60 - 70 70 - 80
No. of
31 42 52 35 31
Students
Solution: We shall reconstitute the given table with f(x) representing the number of students
less than x marks. That is,
xr = x0 + rh
6
xr − x0 45 − 40
r = = = 0.5 .
h 10
(b) The number of students scoring marks between 40 and 45 = f (45) − f (40) = 48 − 31 − 17
Problem: Given
x 1 2 3 4 5 6
f(x) 4 7 9 20 24 30
Find f(2-5).
Problem: Using Newton’s backward formula find the value of f(7) if
x 2 4 6 8
f(x) 10 25 43 50
7
Newton’s general Interpolation formula:
Let y0, y1, y2, ……. yn be n + 1 values of an unknown function y = f(x) corresponding
to the n + 1 values x0, x1, x2, ……. xn of x, which are not necessarily equally spaced
respectively. Let us define the divided differences
y j − yi
xi , x j =
x j − xi
x j , xk − xi , x j
xi , x j , xk =
xk − xi
x j , xk , x p − xi , x j , xk
xi , x j , xk , x p =
x p − xi
and so on. Here xi, xj, xk, xp, …. are any specified values of x and yi, yj, yk, yp, …. are the
corresponding values of y = f(x).
y = y0 + ( x − x0 ) x0 , x1 + ( x − x0 ) ( x − x1 ) x0 , x1 , x2 + ( x − x0 ) ( x − x1 )( x − x2 ) x0 , x1 , x2 , x3 +
.............................. + ( x − x0 ) ( x − x1 )( x − x2 ) .......( x − xn−1 ) x0 , x1 , x2 , x3 ,......xn
Problem 1: Given that f(0) = 8, f(1) = 68 and f(5) = 123 construct a divided difference table
using the table determine the value of f(2).
y1 − y0 68 − 8
Now x0 , x1 = = = 60
x1 − x0 1− 0
y2 − y1 123 − 68
x1 , x2 = = = 13.75
x2 − x1 5 −1
8
x1 , x2 − x0 , x1 = 13.75 − 60 = −9.25
x0 , x1 , x2 =
x2 − x0 5−0
Using the entries in the table and taking x = 2 in the Newton’s divided difference formula we
get y = y0 + ( x − x0 ) x0 , x1 + ( x − x0 ) ( x − x1 ) x0 , x1 , x2
Problem 2: Using Newton’s divided difference formula, find f(8), f(15) given
x 4 5 7 10 11 13
f(x) 48 100 294 900 1210 2029
9
1210 − 900 33 − 27
= 310 =1
11 − 10 13 − 7
x4 = 11 y4 = 1210 409 − 310
= 33
13 − 10
2018 − 1210
= 409
14 − 11
x5 = 14 y5 = 2028
Using the entries in the table and taking x = 2 in the Newton’s divided difference formula we
get
f ( x) = y0 + ( x − x0 ) x0 , x1 + ( x − x0 ) ( x − x1 ) x0 , x1 , x2 + ( x − x0 ) ( x − x1 )( x − x2 ) x0 , x1 , x2 , x3
f ( x) = 48 + ( x − 4 ) 52 + ( x − 4 )( x − 5 )15 + ( x − 4 )( x − 5 )( x − 7 )1
f ( x) = x3 − x 2
f (8) = 83 − 82 = 448
x 5 7 11 13 17
f(x) 150 392 1452 2366 5202
Solution: Here x0 = 5, x1 = 7, x2 = 11, x3 = 13, x4 = 17
10
Using the entries in the table and taking x = 9 in the Newton’s divided difference formula we
get
f ( x) = y0 + ( x − x0 ) x0 , x1 + ( x − x0 ) ( x − x1 ) x0 , x1 , x2 + ( x − x0 ) ( x − x1 )( x − x2 ) x0 , x1 , x2 , x3
f ( x) = 150 + ( 9 − 5 )121 + ( 9 − 5 )( 9 − 7 ) 24 + ( 9 − 5 )( 9 − 7 )( 9 − 11)1
x -4 -1 0 2 5
f(x) 1245 33 5 9 1335
Solution: Here x0 = - 4, x1 = - 1, x2 = 0, x3 = 2, x4 = 5
Using the entries in the table in the Newton’s divided difference formula we get
f ( x) = y0 + ( x − x0 ) x0 , x1 + ( x − x0 ) ( x − x1 ) x0 , x1 , x2 + ( x − x0 ) ( x − x1 )( x − x2 ) x0 , x1 , x2 , x3
f ( x) = 1245 + ( x + 4 ) ( −404) + ( x + 4 )( x + 1) (94) + ( x + 4 )( x + 1)( x − 0 ) ( −14)
+ ( x + 4 )( x + 1)( x − 0 )( x − 2 ) (3)
f ( x) = 3x 4 − 5 x3 + 6 x 2 − 14 x + 5
11
Problem: Use Newton’s divided difference method to compute f(5.5) from the following
data
x 0 1 4 5 6
f(x) 1 14 15 6 3
Problem: Obtain the Newton’s divided difference interpolation polynomial and hence find
f(6) from the following data
x 3 7 9 10
f(x) 168 120 72 63
Problem: Obtain the Newton’s divided difference interpolation polynomial from the
following data
x -1 0 1 3
f(x) 2 1 0 -1
Problem: Obtain the Newton’s divided difference interpolation polynomial from the
following data
x 5 6 9 11
f(x) 12 13 14 16
Problem: Obtain the Newton’s divided difference interpolation polynomial from the
following data
x -1 0 3 6 7
f(x) 3 -6 39 822 1611
12
Lagrange’s Interpolation Formula: (Values of x are not necessarily equally spaced)
Let y0, y1, y2, ……. yn be n + 1 values of an unknown function y = f(x) corresponding
to the n + 1 values x0, x1, x2, ……. xn of x, which are not necessarily equally spaced
respectively. It can be proved that the polynomial representation of y is given by the
following formula
( x − x1 )( x − x2 ) ( x − x3 ) ......... ( x − xn ) ( x − x0 ) ( x − x2 ) ( x − x3 ) ......... ( x − xn )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ......... ( x0 − xn ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) .........( x1 − xn ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ......... ( x − xn )
+ y + ........................................................................
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ......... ( x2 − xn ) 2
( x − x0 ) ( x − x1 )( x − x2 ) ......... ( x − xn−1 )
+ ........................................................................+ y
( xn − x0 )( xn − x1 )( xn − x2 ) ......... ( xn − xn−1 ) n
Problem 1: Using Lagrange’s interpolation formula, find f(11) from the following data:
x 2 5 8 14
y = f(x) 94.8 87.9 81.3 68.7
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
13
Problem 2: Using Lagrange’s interpolation formula, find f(6) from the following data:
x 3 7 9 10
y = f(x) 168 120 72 63
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
( 6 − 7 )( 6 − 9 )( 6 − 10 ) ( )( )( )
f (6) = (168) + 6 − 3 6 − 9 6 − 10 (120 ) +
( 3 − 7 )( 3 − 9 )( 3 − 10 ) ( 7 − 3)( 7 − 9 )( 7 − 10 )
( 6 − 3)( 6 − 7 )( 6 − 10 ) ( )( )( )
+ ( 72 ) + 6 − 3 6 − 7 6 − 9 ( 72 )
( 9 − 3)( 9 − 7 )( 9 − 10 ) (10 − 3)(10 − 7 )(10 − 9 )
x 5 6 9 11
y = f(x) 12 13 14 16
Solution:
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
14
(10 − 6 )(10 − 9 )(10 − 11) ( )( )( )
f (6) = (12 ) + 10 − 5 10 − 9 10 − 11 (13) +
( 5 − 6 )( 5 − 9 )( 5 − 11) ( 6 − 5 )( 6 − 9 )( 6 − 11)
(10 − 5 )(10 − 6 )(10 − 11) ( )( )( )
+ (14 ) + 10 − 5 10 − 6 10 − 9 (16 )
( 9 − 5 )( 9 − 6 )( 9 − 11) (10 − 5 )(10 − 6 )(10 − 9 )
Problem 4: Using Lagrange’s interpolation formula, find f(5) from the following data:
x 1 3 4 6 9
y = f(x) -3 9 30 132 156
Solution: Here x0 = 1, x1 = 3, x2 = 4, x3 = 6, , x4 = 9
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x4 ) ( x − x0 ) ( x − x2 ) ( x − x3 ) ( x − x4 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 )( x0 − x4 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 )( x0 − x4 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x4 ) ( x − x0 ) ( x − x1 )( x − x2 )( x − x4 )
+ y2 + y +
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 )( x0 − x4 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 )( x0 − x4 ) 3
( x − x0 ) ( x − x1 )( x − x2 ) ( x − x3 )
+ y
( x4 − x0 ) ( x4 − x1 )( x4 − x2 ) ( x4 − x3 ) 4
( 5 − 3)( 5 − 4 )( 5 − 6 )( 5 − 9 ) ( )( )( )( )
f (5) = ( −3) + 5 − 1 5 − 4 5 − 6 5 − 9 ( 9 ) +
(1 − 3) (1 − 4 ) (1 − 6 )(1 − 9 ) ( 3 − 1)( 3 − 4 )( 3 − 6 )( 3 − 9 )
( 5 − 1)( 5 − 3)( 5 − 6 )( 5 − 9 ) ( )( )( )( )
+ ( 30 ) + 5 − 1 5 − 3 5 − 4 5 − 9 (132 )
( 4 − 1) ( 4 − 3)( 4 − 6 )( 4 − 9 ) ( 6 − 1)( 6 − 3)( 6 − 4 )( 6 − 9 )
( 5 − 1)( 5 − 3)( 5 − 4 )( 5 − 6 )
+ (156 )
( 9 − 1)( 9 − 3)( 9 − 4 )( 9 − 6 )
Problem 5: Using Lagrange’s interpolation formula, find f(9) from the following data:
x 5 7 11 13 17
y = f(x) 150 392 1452 2366 5202
Solution: Here x0 = 5, x1 = 7, x2 = 11, x3 = 13, , x4 = 17
Lagrange’s formula is
15
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x4 ) ( x − x0 ) ( x − x2 ) ( x − x3 ) ( x − x4 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 )( x0 − x4 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 )( x0 − x4 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x4 ) ( x − x0 ) ( x − x1 )( x − x2 )( x − x4 )
+ y2 + y +
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 )( x0 − x4 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 )( x0 − x4 ) 3
( x − x0 ) ( x − x1 )( x − x2 ) ( x − x3 )
+ y
( x4 − x0 ) ( x4 − x1 )( x4 − x2 ) ( x4 − x3 ) 4
( 9 − 7 )( 9 − 11)( 9 − 13)( 9 − 17 ) ( )( )( )( )
f (5) = (150 ) + 9 − 5 9 − 11 9 − 13 9 − 17 ( 392 ) +
( 5 − 7 )( 5 − 11)( 5 − 13)( 5 − 17 ) ( 7 − 5 )( 7 − 11)( 7 − 13 )( 7 − 17 )
( 9 − 5)( 9 − 7 )( 9 − 13)( 9 − 17 ) ( )( )( )( )
+ (1452 ) + 9 − 5 9 − 7 9 − 11 9 − 17 ( 2366 )
(11 − 5)(11 − 7 )(11 − 13)(11 − 17 ) (13 − 5 )(13 − 7 )(13 − 11)(13 − 17 )
( 9 − 5 )( 9 − 7 )( 9 − 11)( 9 − 13)
+ ( 2366 )
(17 − 5 )(17 − 7 )(17 − 11)(17 − 13)
Problem 6: If y(1) = 3, y(3) = 9, y(4) = 30, y(6) = 132 find Lagrange’s interpolation
polynomial and hence find y at x = 5.
Solution: Here x0 = 1, x1 = 3, x2 = 4, x3 = 6,
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
( x − 3)( x − 4 )( x − 6 ) ( )( )( )
f ( x) = ( 3) + x − 1 x − 4 x − 6 ( 9 ) +
(1 − 3) (1 − 4 ) (1 − 6 ) ( 3 − 1)( 3 − 4 )( 3 − 6 )
( x − 1)( x − 3)( x − 6 ) ( )( )( )
+ ( 30 ) + x − 1 x − 3 x − 4 (132 )
( 4 − 1) ( 4 − 3)( 4 − 6 ) ( 6 − 1)( 6 − 3)( 6 − 4 )
1 3 3 22
f ( x) = − ( x − 13x 2 + 54 x − 72 ) + ( x3 − 11x 2 + 34 x − 24 )− ( 5) ( x3 − 10 x 2 + 27 x − 18 ) + ( x3 − 8 x 2 + 19 x − 12 )
10 2 5
4 2 29 42 1
f ( x) = x 3 − x 2 − x+ = ( 4 x3 − 2 x 2 − 29 x + 42 )
5 5 5 5 5
4 3 2 2 29 42
f (5) = ( 5) − ( 5) − ( 5) + = 69.4
5 5 5 5
16
Problem 7: Find Lagrange’s interpolation polynomial for the function f(x) given by the
following table.
x 0 -1 1
f(x) 1 2 3
and y0 = 1, y1 = 2, y2 = 3 and x = x.
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x0 ) ( x − x2 ) ( x − x0 ) ( x − x1 )
y = f ( x) = y0 + y1 + y
( x0 − x1 )( x0 − x2 ) ( x1 − x0 ) ( x1 − x2 ) ( x2 − x0 ) ( x2 − x1 ) 2
( x + 1)( x − 1) ( )( ) ( )( )
f ( x) = (1) + x − 0 x − 1 ( 2 ) + x − 0 x + 1 ( 3)
( 0 + 1)( 0 − 1) ( −1 − 0 ) −1 − 1
( ) (1 − 0 ) 1 + 1
( )
3
f ( x) = − ( x 2 − 1) + ( x 2 − x )+ ( x 2 + x )
2
3 2 1
f ( x) = x + x+ 1
2 2
Problem 8: Find Lagrange’s interpolation polynomial for the function f(x) given by the
following table.
x 1 2 3 4
f(x) 5 19 49 101
Solution: Here x0 = 1, x1 = 2, x2 = 3, x3 = 4,
Lagrange’s formula is
17
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
( x − 2 )( x − 3)( x − 4 ) ( )( )( )
f ( x) = ( 5 ) + x − 1 x − 3 x − 4 (19 ) +
(1 − 2 ) (1 − 3) (1 − 4 ) ( 2 − 1) ( 2 − 3) ( 2 − 4 )
( x − 1)( x − 2 )( x − 4 ) ( )( )( )
+ ( 49 ) + x − 1 x − 2 x − 3 (132 )
( 3 − 1)( 3 − 2 )( 3 − 4 ) ( 4 − 1)( 4 − 2 ) ( 4 − 3)
5 19 49 101 3
f ( x) = − ( x3 − 9 x 2 + 26 x − 24 ) + ( x3 − 8 x 2 + 19 x − 12 )− ( x 3 − 7 x 2 + 12 x − 8 ) + ( x − 6 x 2 + 11x − 6 )
6 2 2 6
f ( x) = x 3 + 2 x 2 + 2 x + 1
Problem 9: Find Lagrange’s interpolation polynomial for the function f(x) given by the
following table.
x 1 2 4 5
f(x) 14 41 197 360
Solution: Here x0 = 1, x1 = 2, x2 = 4, x3 = 5,
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
( x − 2 )( x − 4 )( x − 5 ) ( )( )( )
f ( x) = (14 ) + x − 1 x − 4 x − 5 ( 41) +
(1 − 2 )(1 − 4 ) (1 − 5 ) ( 2 − 1)( 2 − 4 ) ( 2 − 5 )
( x − 1)( x − 2 )( x − 5 ) ( )( )( )
+ (197 ) + x − 1 x − 2 x − 4 ( 350 )
( 4 − 1)( 4 − 2 ) ( 4 − 5 ) ( 5 − 1)( 5 − 2 )( 5 − 4 )
7 41 197 3 175 3
f ( x) = − ( x3 − 11x 2 + 38 x − 40 ) + ( x3 − 10 x 2 + 29 x − 20 )− ( x − 8 x 2 + 17 x − 10 ) + ( x − 7 x 2 + 14 x − 8 )
6 6 6 6
f ( x) = 2 x 3 + 3 x 2 + 4 x + 5
18
Problem 10: Find Lagrange’s interpolation polynomial for the function f(x) given by the
following table.
x 0 1 2 5
f(x) 2 3 12 147
Solution: Here x0 = 0, x1 = 1, x2 = 2, x3 = 5,
Lagrange’s formula is
( x − x1 )( x − x2 ) ( x − x3 ) ( x − x0 ) ( x − x2 ) ( x − x3 )
y = f ( x) = y0 + y +
( x0 − x1 )( x0 − x2 )( x0 − x3 ) ( x1 − x0 ) ( x1 − x2 ) ( x1 − x3 ) 1
( x − x0 ) ( x − x1 ) ( x − x3 ) ( x − x0 ) ( x − x1 )( x − x2 )
+ y2 + y
( x2 − x0 ) ( x2 − x1 ) ( x2 − x3 ) ( x3 − x0 )( x3 − x1 )( x3 − x2 ) 3
( x − 1)( x − 2 )( x − 5 ) ( )( )( )
f ( x) = ( 2 ) + x − 0 x − 2 x − 5 ( 3) +
( 0 − 1)( 0 − 2 )( 0 − 5 ) (1 − 0 ) (1 − 2 ) (1 − 5 )
( x − 0 )( x − 1)( x − 5 ) ( )( )( )
+ (12 ) + x − 0 x − 1 x − 2 (147 )
( 2 − 0 ) ( 2 − 1) ( 2 − 5 ) ( 5 − 0 )( 5 − 1)( 5 − 2 )
1 3 49 3
f ( x) = − ( x3 − 8 x 2 + 17 x − 10 ) + ( x3 − 7 x 2 + 10 x )− 2 ( x3 − 6 x 2 + 5 x ) + ( x − 3x 2 + 2 x )
5 4 20
f ( x) = x 3 + x 2 − x + 2
19
INVERSE INTERPOLATION:
Let y0, y1, y2, ……. yn be n + 1 values of an unknown function y = f(x) corresponding
to the n + 1 values x0, x1, x2, ……. xn of x respectively. Then
( y − y1 )( y − y2 ) ( y − y3 ) ......... ( y − yn ) ( y − y0 ) ( y − y2 ) ( y − y3 ) .........( y − yn )
x= x0 + x +
( y0 − y1 )( y0 − y2 )( y0 − y3 ) ......... ( y0 − yn ) ( y1 − y0 ) ( y1 − y2 ) ( y1 − y3 ) ......... ( y1 − yn ) 1
( y − y0 ) ( y − y1 ) ( y − y3 ) ......... ( y − yn )
+ x + ........................................................................
( y2 − y0 ) ( y2 − y1 ) ( y2 − y3 ) ......... ( y2 − yn ) 2
( y − y0 ) ( y − y1 )( y − y2 ) ......... ( y − yn−1 )
+ ........................................................................+ x
( yn − y0 )( yn − y1 )( yn − y2 ) ......... ( yn − yn−1 ) n
Problem 1: Given
x 2 5 9 11
y = f(x) 10 12 15 19
Find x corresponding to y = 16.
( y − y1 )( y − y2 ) ( y − y3 ) ( y − y0 ) ( y − y2 ) ( y − y3 )
x= x0 + x +
( y0 − y1 )( y0 − y2 )( y0 − y3 ) ( y1 − y0 ) ( y1 − y2 ) ( y1 − y3 ) 1
( y − y0 ) ( y − y1 ) ( y − y3 ) ( y − y0 ) ( y − y1 )( y − y2 )
+ x2 + x
( y2 − y0 ) ( y2 − y1 ) ( y2 − y3 ) ( y3 − y0 )( y3 − y1 )( y3 − y2 ) 3
20
(16 − 12 )(16 − 15 )(16 − 19 ) ( )( )( )
x= ( 2 ) + 16 − 10 16 − 15 16 − 19 ( 5) +
(10 − 12 )(10 − 15 )(10 − 19 ) (12 − 10 )(12 − 15 )(12 − 19 )
(16 − 10 )(16 − 12 )(16 − 19 ) ( )( )( )
+ ( 9 ) + 16 − 10 16 − 12 16 − 15 (11)
(15 − 10 )(15 − 12 )(15 − 19 ) (19 − 10 )(19 − 12 )(19 − 15 )
Solution: Here x0 = 1, x1 = 3, x2 = 4,
( y − y1 )( y − y2 ) ( y − y0 ) ( y − y2 ) ( y − y0 ) ( y − y1 )
x= x0 + x1 + x
( y0 − y1 )( y0 − y2 ) ( y1 − y0 ) ( y1 − y2 ) ( y2 − y0 ) ( y2 − y1 ) 2
( 7 − 12 )( 7 − 19 ) ( )( ) ( )( )
x= (1) + 7 − 4 7 − 19 ( 3) + 7 − 4 7 − 12 ( 4 )
( 4 − 12 ) ( 4 − 19 ) (12 − 4 ) (12 − 19 ) (19 − 4 )(19 − 12 )
Problem 3: Apply Lagrange’s formula to find a root of the equation f(x) = 0 given that
f(30) = - 30, f(34) = - 13, f(38) = 3, f(42) = 18.
( y − y1 )( y − y2 ) ( y − y3 ) ( y − y0 ) ( y − y2 ) ( y − y3 )
x= x0 + x +
( y0 − y1 )( y0 − y2 )( y0 − y3 ) ( y1 − y0 ) ( y1 − y2 ) ( y1 − y3 ) 1
( y − y0 ) ( y − y1 ) ( y − y3 ) ( y − y0 ) ( y − y1 )( y − y2 )
+ x2 + x
( y2 − y0 ) ( y2 − y1 ) ( y2 − y3 ) ( y3 − y0 )( y3 − y1 )( y3 − y2 ) 3
21
x = −0.7820 + 6.5322 + 33.6818 − 2.2016 = 37.23
Problem 4: The following table gives the values of f() for certain values of . Find when
f() = 0.3887
( y − y1 )( y − y2 ) ( y − y0 ) ( y − y2 ) ( y − y0 ) ( y − y1 )
x= x0 + x1 + x
( y0 − y1 )( y0 − y2 ) ( y1 − y0 ) ( y1 − y2 ) ( y2 − y0 ) ( y2 − y1 ) 2
22
( y − y1 )( y − y2 ) ( y − y3 ) ( y − y4 ) ( y − y0 ) ( y − y2 ) ( y − y3 ) ( y − y4 )
x= x0 + x +
( y0 − y1 )( y0 − y2 )( y0 − y3 )( y0 − y4 ) ( y1 − y0 ) ( y1 − y2 ) ( y1 − y3 ) ( y1 − y4 ) 1
( y − y0 ) ( y − y1 ) ( y − y3 ) ( y − y4 ) ( y − y0 ) ( y − y1 )( y − y2 )( y − y4 )
+ x2 + x +
( y2 − y0 ) ( y2 − y1 ) ( y2 − y3 ) ( y2 − y4 ) ( y3 − y0 )( y3 − y1 )( y3 − y2 )( y3 − y4 ) 3
( y − y0 ) ( y − y1 )( y − y2 ) ( y − y3 )
+ x
( y4 − y0 ) ( y4 − y1 )( y4 − y2 ) ( y4 − y3 ) 4
Problem 6: Given
( y − y1 )( y − y2 ) ( y − y3 ) ( y − y4 ) ( y − y0 ) ( y − y2 ) ( y − y3 ) ( y − y4 )
x= x0 + x +
( y0 − y1 )( y0 − y2 )( y0 − y3 )( y0 − y4 ) ( y1 − y0 ) ( y1 − y2 ) ( y1 − y3 ) ( y1 − y4 ) 1
( y − y0 ) ( y − y1 ) ( y − y3 ) ( y − y4 ) ( y − y0 ) ( y − y1 )( y − y2 )( y − y4 )
+ x2 + x +
( y2 − y0 ) ( y2 − y1 ) ( y2 − y3 ) ( y2 − y4 ) ( y3 − y0 )( y3 − y1 )( y3 − y2 )( y3 − y4 ) 3
( y − y0 ) ( y − y1 )( y − y2 ) ( y − y3 )
+ x
( y4 − y0 ) ( y4 − y1 )( y4 − y2 ) ( y4 − y3 ) 4
23
( 0 + 0.45 )( 0 + 0.29 )( 0 + 0.12 )( 0 − 0.5 )
x= ( 2)
( −0.6 + 0.45 )( −0.6 + 0.29 )( −0.6 + 0.12 )( −0.6 − 0.5 )
( 0 + 0.6 )( 0 + 0.29 )( 0 + 0.12 )( 0 − 0.5 )
+ ( 2.2 ) +
( −0.45 + 0.6 )( −0.45 + 0.29 )( −0.45 + 0.12 )( −0.45 − 0.5 )
( 0 + 0.6 )( 0 + 0.45 )( 0 + 0.12 )( 0 − 0.5 )
+ ( 2.4 )
( −0.29 + 0.6 )( −0.29 + 0.45 )( −0.29 + 0.12 )( −0.29 − 0.5 )
( 0 + 0.6 ) ( 0 + 0.45 )( 0 + 0.29 )( 0 − 0.5 )
+ ( 2.6 ) +
( −0.12 + 0.6 )( −0.12 + 0.45 )( −0.12 + 0.29 )( −0.12 − 0.5 )
( 0 + 0.6 )( 0 + 0.45 )( 0 + 0.29 )( 0 + 0.12 )
+ ( 2.8 )
( 0.5 + 0.6 )( 0.5 + 0.45 )( 0.5 + 0.29 )( 0.5 + 0.12 )
24
NUMERICAL INTEGRATION
Numerical integration is the process of computing the value of a definite integral from the
tabulated values of the integrand. When applied to the integration of a function of a single
variable, the process is known as quadrature. The expression for the integral so obtained is
called a quadrature formula.
Trapezoidal Rule:
xn x0 + nh
f ( x)dx = f ( x)dx =
h
2
( y0 + yn ) + 2 ( y1 + y2 + y3 + ............. + yn−1 )
x0 x0
Note:
f ( x)dx =
x0 x0
f ( x)dx
=
h
3
( y0 + yn ) + 4 ( y1 + y3 + y5 + ............. + yn−1 ) + 2 ( y2 + y4 + y6 + ....... + yn−2 )
Note:
f ( x)dx =
x0 x0
f ( x)dx
=
3h
8
( y0 + yn ) + 3 ( y1 + y2 + y4 + y5 + ............. + yn−2 + yn−1 ) + 2 ( y3 + y6 + y9 + ....... + yn−3 )
Note:
Weddle’s Rule:
xn x0 + nh
x0
f ( x)dx =
x0
f ( x)dx
3h
= y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + 2 y6 + 5 y7 + y8 ...................
10
25
The co - efficients may be remembered in groups of six
First group 1, 5, 1, 6, 1, 5
Last group 2, 5, 1, 6, 1, 5, 1.
Note:
Note:
f ( x)dx = 10 ( y + y6 ) + 5 ( y1 + y5 ) + ( y2 + y4 ) + 6 y3
3h
0
x0
f ( x)dx =
3h
10
( y0 + y6 ) + 5 ( y1 + y5 + y7 + y11 ) + ( y2 + y4 + y8 + y10 ) + 2 y6 + 6 ( y3 + y9 )
x0
Problem:
Given
x 1 2 3 4 5 6 7
y = f(x) 2.105 2.808 3.614 4.604 5.857 7.451 9.467
7
evaluate f ( x)dx using
1
Solution:
Also, Here x0 = 1, x1 = 2, x2 = 3, x3 = 4, x4 = 5, x5 = 6, x6 = 7
26
7
f ( x)dx = 2 ( y + y6 ) + 2 ( y1 + y2 + y3 + y4 + y5 )
h
0
1
1
= ( 2.105 + 9.467 ) + 2 ( 2.808 + 3.614 + 4.604 + 5.857 + 7.451)
2
= 30.12.
f ( x)dx = 3 ( y + y6 ) + 4 ( y1 + y3 + y5 ) + 2 ( y2 + y4 )
h
0
1
1
= ( 2.105 + 9.467 ) + 2 ( 2.808 + 4.604 + 7.451) + 2 ( 3.614 + 5.857 )
3
= 29.9887
f ( x)dx = 8 ( y + yn ) + 3 ( y1 + y2 + y4 + y5 ) + 2 y3
3h
0
1
3
= ( 2.105 + 9.467 ) + 3 ( 2.808 + 3.614 + 5.857 + 7.451) + 2 ( 4.604 )
8
= 29.9888
f ( x)dx = 10 ( y + y6 ) + 5 ( y1 + y5 ) + ( y2 + y4 ) + 6 y3
3h
0
1
3
= ( 2.105 + 9.467 ) + 5 ( 2.808 + 7.451) + ( 3.614 + 5.857 ) + 6 ( 4.604 )
10
= 29.9886
Problem 2:
6
dx
Evaluate 1+ x
0
2
by using (a) Trapezoidal rule (b) Simpson’s 1/3rd rule
Solution:
27
1
Here f ( x) = , x0 = 0, xn = 6.
1 + x2
Let us divide the interval [x0, xn] = [0. 6] in to six equal parts with h = 1 as the length of each
part. So that n = 6. Let us find the values of y = f(x) at x0 = 0, x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 =
5, x6 = 6. The values are shown in the following table
x 0 1 2 3 4 5 6
y = f(x) 1 0.5 0.2 0.1 0.0588 0.0384 0.027
Here x0 = 0, x1 = 1, x2 = 2, x3 = 3, x4 = 4, x5 = 5, x6 = 6
1+ x
dx
2
=
h
2
( y0 + y6 ) + 2 ( y1 + y2 + y3 + y4 + y5 )
0
1
= (1 + 0.027 ) + 2 ( 0.5 + 0.2 + 0.1 + 0.0588 + 0.0384 )
2
= 1.4107.
1+ x
dx
2
=
h
3
( y0 + y6 ) + 4 ( y1 + y3 + y5 ) + 2 ( y2 + y4 )
0
1
= (1 + 0.027 ) + 2 ( 0.5 + 0.1 + 0.0384 ) + 2 ( 0.2 + 0.0588)
3
= 1.36607
1+ x
dx
2
=
3h
8
( y0 + yn ) + 3 ( y1 + y2 + y4 + y5 ) + 2 y3
0
3
= (1 + 0.027 ) + 3 ( 0.5 + 0.2 + 0.0588 + 0.0384 ) + 2 ( 0.1)
8
= 1.35697
28
6
1+ x
dx
2
=
3h
10
( y0 + y6 ) + 5 ( y1 + y5 ) + ( y2 + y4 ) + 6 y3
0
3
= (1 + 0.027 ) + 5 ( 0.5 + 0.0384 ) + ( 0.2 + 0.0588) + 6 ( 0.1)
10
= 1.37334.
Problem 3:
1
dx
Evaluate 1+ x
0
2
taking 7 ordinates by using (a) Trapezoidal rule (b) Simpson’s 1/3rd rule
(c) Simpson’s 3/8th rule and (d) Weddle’s rule. Hence evaluate an approximate value of
using Simpson’s 1/3rd rule.
Solution:
1
Here f ( x) = , x0 = 0, xn = 1 and n = 7 – 1 = 6.
1 + x2
xn − x0 1 − 0 1
Therefore h = = =
6 6 6
Let us divide the interval [x0, xn] = [0. 1] in to six equal parts with h = 1/6 as the length of
each part. The values of y = f(x) at different values of x are shown in the following table
1+ x
dx
2
=
h
2
( y0 + y6 ) + 2 ( y1 + y2 + y3 + y4 + y5 )
0
(1 / 6)
= (1 + 0.5) + 2 ( 0.9729 + 0.9 + 0.8 + 0.6923 + 0.5901)
2
= 0.784217.
29
1
1+ x
dx
2
=
h
3
( y0 + y6 ) + 4 ( y1 + y3 + y5 ) + 2 ( y2 + y4 )
0
(1 / 6)
= (1 + 0.5) + 4 ( 0.9729 + 0.8 + 0.5901) + 2 ( 0.9 + 0.6923)
3
= 0.785367
1+ x
dx
2
=
3h
8
( y0 + yn ) + 3 ( y1 + y2 + y4 + y5 ) + 2 y3
0
3(1 / 6)
= (1 + 0.5) + 3 ( 0.9729 + 0.9 + 0.6923 + 0.5901) + 2 ( 0.8 )
8
= 0.785369
1+ x
dx
2
=
3h
10
( y0 + y6 ) + 5 ( y1 + y5 ) + ( y2 + y4 ) + 6 y3
0
3(1 / 6)
= (1 + 0.5) + 2 ( 0.9729 + 0.5901) + ( 0.9 + 0.6923) + 6 ( 0.8 )
10
= 0.785365.
Deduction:
( tan −1 x )0 = 0.785367
1
− 0 = 0.785367
4
= 0.785367 = 4 ( 0.785367 ) = 3.141468
4
30
Problem 3:
1
xdx
Evaluate 1+ x
0
2
taking six equal strips by using
(c) Simpson’s 3/8th rule and (d) Weddle’s rule. Hence evaluate an approximate value of
log e 2 using Simpson’s 1/3rd rule.
Solution:
x
Here f ( x) = , x0 = 0, xn = 1 and n = 6.
1 + x2
xn − x0 1 − 0 1
Therefore h = = =
6 6 6
Let us divide the interval [x0, xn] = [0. 1] in to six equal parts with h = 1/6 as the length of
each part. The values of y = f(x) at different values of x are shown in the following table
(1 / 6)
= ( 0 + 0.5) + 2 ( 0.1621 + 0.3 + 0.4 + 0.4615 + 0.4918 )
2
= 0.344233 .
(1 / 6)
= ( 0 + 0.5) + 4 ( 0.1621 + 0.4 + 0.4918) + 2 ( 0.3 + 0.4615)
3
31
= 0.346589.
3(1 / 6)
= ( 0 + 0.5) + 3 ( 0.1621 + 0.3 + 0.4615 + 0.4918) + 2 ( 0.4 )
8
= 0.346638.
3(1 / 6)
= ( 0 + 0.5) + 2 ( 0.1621 + 0.4918) + ( 0.3 + 0.4615) + 6 ( 0.4 )
10
= 0.34655.
Deduction:
1
1 2 xdx
2 0 1 + x 2
= 0.346589
1
log e (1 + x 2 )0 = 0.346589
1
Problem:
A curve is drawn to pass through the points given by the following table
32
Using weddle’s rule estimate the area bounded by the curve, the x – axis and lines x = 1,
x = 4.
Solution:
Weddle’s rule
4
Required area = f ( x)dx =
3h
10
( y0 + y6 ) + 5 ( y1 + y5 ) + ( y2 + y4 ) + 6 y3
1
3(0.5)
= ( 2 + 2.1) + 5 ( 2.4 + 2.6 ) + ( 2.7 + 3) + 6 ( 2.8)
10
= 7.74.
Problem:
The following table gives the values of a function y = f(x) for some equidistant values of x
1
Evaluate f ( x)dx by using Trapezoidal rule.
0
Problem:
x dx with h = 0.2.
3
(1)
0
x dx with h = 1.
4
(2)
−3
Problem:
e
− x2
(1) Cosxdx (2) dx
0 0
33
dividing the interval in to 10 equal parts.
Problem:
5
By using the Simpson’s 1/3 rule evaluate f ( x)dx , given
rd
x 1 2 3 4 5
y = f(x) 13 50 70 80 100
Problem:
2
By using the Simpson’s 1/3 rule evaluate f ( x)dx , given
rd
Problem:
2
Evaluate 0
Cosxdx by dividing the interval in to eight equal parts.
Problem:
0.6
e
− x2
Evaluate dx taking seven ordinates.
0
Problem:
1
Evaluate e− x dx dividing the interval (0, 1) in to ten sub intervals (h = 0.1).
2
Problem:
1
dx
Evaluate 4x + 5
0
dividing the interval (0, 1) in to ten sub intervals (h = 0.1).
Problem:
Evaluate
34
1 1 7
dx 1 x 2 dx
(1) with h = (2) with n = 4. (3) x
2
log e xdx with n = 4.
0
1+ x 8 0 1+ x
3
3
2 5
(4) Sin d
0
with n = 10.. (5) log e xdx with n = 10.
1
Problem:
By dividing the range in to 6 equal parts, find the approximate value of eSinx dx using
0
Problem:
A solid of revolution is formed by rotating about the x – axis, the area between the x – axis,
the lines x = 0, x = 1 and a curve through the points with the following co ordinates
Problem:
A rocket is launched from the ground. It’s acceleration f is registered during the first 80
seconds and is tabulated below. Using the Simpson’s rule, find the velocity of the rocket at
t = 80 seconds
t (Sec) 0 10 20 30 40 50 60 70 80
f (cm/sec2) 30 31.63 33.34 35.47 37.75 40.33 43.25 46.69 50.67
Problem:
The velocity v (km/min) of a moped which starts from rest is given at fixed interval of time
t(min) as follows
t 0 2 4 6 8 10 12 14 16 18 20
v 0 10 18 25 29 32 20 11 5 2 0
Problem:
The following table gives 7 values of an independent variable x and the corresponding values
of y = f(x)
35
x 0 1 2 3 4 5 6
y 0.146 0.161 0.176 0.190 0.204 0.217 0.230
6
Evaluate f ( x)dx
0
by using Simpson’s 3/8th rule.
Problem:
0.3
Using Simpson’s 3/8th rule evaluate
0
1 − 8x3 dx taking 7 ordinates.
Problem:
1
dx
Evaluate 1+ x
0
taking 7 ordinates by applying Simpson’s 3/8th rule. Hence deduce the value
of loge2.
Problem:
1
Using Simpson’s 3/8th rule evaluate e− x dx taking 4 ordinates.
2
Problem:
3 5.2
dx
(3) (1 + x ) 2
with six subintervals of [0, 3]. (4) log xdx with n = 12
4
0
2
(5)
0
Cosxdx by dividing the interval in to six equal parts.
2
(6) 0
Sinxdx by dividing the interval in to three equal parts.
Problem:
5.2
Evaluate log xdx by using Weddle’s rule taking 7 ordinates.
4
Problem:
36
2
Evaluate
0
1 − 0.162Sin 2 d by using Weddle’s rule taking 7 ordinates.
Problem:
1.4
Evaluate ( Sinx − log x + e ) dx by using Weddle’s rule taking n = 12 ordinates.
0.2
x
Problem:
1.6
Evaluate xCosexhxdx by using Weddle’s rule taking n = 12 ordinates.
0.4
Problem:
The velocity v of a particle at distance s from a point on its linear path is given by the
following table
Estimate the time taken by the particle to traverse the distance 20 meters, using Simpson’s
1/3rd rule.
Problem:
A river is 80 ft wide. The depth d in feet at a distance x ft from one bank is given by the
following table
x 0 10 20 30 40 50 60 70 80
d 0 4 7 9 12 15 14 8 3
37