Numerical All
Numerical All
Solution of Equations
Bisection Method: The Bisection
Method is applicable for numerically
solving the equation ( ) = 0 for
the real variable , where ( ) is
a continuous function defined on an
interval [ , ] and where ( )
and ( ) have opposite signs. In this
case, by the intermediate value
theorem, the continuous
function ( ) must have at least one root in the interval (a, b).
At each step the method divides the interval [ , ] in two equal subintervals [ , ] and
[ , ] by computing the midpoint = of the interval [ , ]. Unless is itself a root
(which is very unlikely, but possible) there are now only two possibilities:
either ( ) and ( ) have opposite signs and there is a root between and , or ( )
and ( ) have opposite signs and there is a root between and . Explicitly, if ( )
and ( ) have opposite signs, then the method sets as the new value for , and if ( )
and ( ) have opposite signs then the method sets as the new . (If ( ) = 0
then may be taken as the solution and the process stops.) In both cases, the new ( )
and ( ) have opposite signs, so the method is applicable to this smaller interval. In this
way an interval that contains a zero of ( ) is reduced in width by 50% at each step. The
process is continued until the interval is sufficiently small, i.e., ( ) is near to zero.
3 . Perform five interaction of the bisection method to determine the smallest positive real
root of ( ) = −5 +1 = 0
Solution : we get (0) = 1 (+ve)
(1) = −3 (-ve)
Hence the root lies between 0 & 1, So we take = = 0.5
Now, ( ) = (0.5) = −01.375 (-ve)
.
Hence the root lies between 0 & , So we take = = =0.25
We find, ( ) = (.25) = −0.234 (-ve)
.
Hence the root lies between 0 & . So we take = = =.125
We obtain, ( ) = (.125) = 0.377 (+ve)
Hence the root lies between & , So we take = = .1875
We obtain, ( ) = (.1875) = 0.069 (+ve)
. .
Hence the root lies between & . So we take = = =0.21875
We obtain, ( ) = (.21875) = −0.08 (-ve)
Hence the root lies between & . So we take = = 0.203125
We obtain, f( ) = f(.203125) = -0.007, which is near to zero.
Hence the smallest positive real root of the given equation is 0.20325
Solution of Equation 3
4. Use bisection method find of the equation √ − = 0 on [0,1]
Let , ( ) = √ −
Solution : we get (0) = − 1 (-ve)
(1) = 0.45970 (+ve)
Hence the root lies between 0 & 1. So we take = = 0.5
Now, ( ) = (0.5) = −0.17048 (-ve)
.
Hence the root lies between 1 & . So we take = = =0.75
We find, ( ) = (.75) = 0.13434 (+ve)
. .
Hence the root lies between & so we take = = =.625
Hence =0. 625
Method of False Position: The False Position Method is applicable for numerically
solving the equation ( ) = 0 for the real variable , where ( ) is a continuous
function defined on an interval [ , ] and where ( ) and ( ) have opposite signs. In
Solution of Equation 4
this case, by the intermediate value theorem, the continuous function ( ) must have at
least one zero in the interval (a, b).
Iteration Method :
1. Find a real root of the equation ( ) = + − 1 = 0 by iteration method .
Solution : we get
(0) = −1 (-ve)
(1) = 1 (+ve)
So, a root lies between 0 and 1 . Therefore we can take =0.5
To find this root , we put the equation in the form = ( ).
So + −1 = 0
or, =
√
So that ( ) = and ′( ) = ( ) /
√
′(
we have | )| < 1 for = = 0.5
Solution of Equation 6
Hence the iteration method can be applied.
We get,
= ( ) = (.5)= 0.81649
= ( ) = (.81649)= .74196
= ( ) = (.74196)=.75767
= ( ) = (.75767)= .75427
= ( ) = (.75427)= .75500
= ( ) = (.75500)= .75485
= ( ) = (.75485)= .75488
Hence the approximate value of the root is 0.75488.
2. Find the root of the equation 2 = + 3 correct to three decimal places by using
iteration method .
Solution : The given equation can be put in the form, = ( + 3)
So that ( ) = (cosx+3)
and ′( ) = (− )
′(
we have | )| = | |<1
Hence the iteration method can be applied .
Take , =1
We get,
= ( ) = (1)=1.7701
= ( ) = (1.7701)= 1.40098
= ( ) = (1.40098)=1.5845
= ( ) = (1.5845)= 1.4931
= ( ) = (1.4931)= 1.5388
= ( ) = (1.5388)= 1.5160
= ( ) = (1.5160)= 1.5274
= ( ) = (1.5274)= 1.5217
= ( ) = (1.5217)= 1.5245
= ( ) = (1.5245)= 1.5231
Hence the approximate value of the root is 1.5231.
4. Use the iteration method to find a real root of the following equations.
(a) = 3 −1 (e) = 10
(b) x = ( ) (f) =
(c) = (5 − ) (g) = -1
(d) = 10( − 1) (h) =
Newton-Raphson Method:
Let be an approximate root of ( ) = 0 and let = + ℎ be the correct root so that
( ) = 0 that is, ( + ℎ) = 0
Now expending ( + ℎ) by Taylor’s series , we obtain,
ℎ
( )+ℎ ( )+ ( )+ … … … … = 0
2!
Neglecting the second and higher order derivatives, we have
( )+ℎ ( ) = 0
( )
or, ℎ = −
( )
A better approximation than is therefore given by when ,
( )
= −
( )
Successive approximations are giveb by , , . … … … …
( )
Where , = --
( )
Which is Newton – Raphson formula.
Newton’s Interpolation
Established the Newton’s forward difference interpolation formula.
Solution: Give the set of ( + 1) values, viz.( , ), ( , ), ( , ), … … … . ( , ),
of and , it is required to find ( ) , a polynomial of the nth degree such that y and
( ) agree at the tabulated points. Let the values of x be equidistant.
i.e., Let = + ℎ for = 1,2,3, … … … … .
Since ( ) is a polynomial of the nth degree, it may be written as
( )= + ( − ) + ( − )( − ) + ( − )( − )( − ) +
… … … … … . . + ( − )( − )( − ) … … … ( − ) ………(1)
Imposing now the condition that y and ( ) should agree at the set of tabulated values.
When = then =
When = then = + ( − )
= + ℎ
ℎ= -
ℎ= −
ℎ= ∆
∆
=
When = then = + ( − )+ ( − )( − )
= + 2ℎ + 2ℎ. ℎ
= +2 ℎ+2 ℎ
= + 2∆ + 2 ℎ
2 ℎ = − − 2∆
= − − 2( − )
= − −( − )
=∆ −∆
=∆
∆ ∆
= =
!
Similarly we get
∆
=
!
…………….
…………….
∆
= !
Putting the value of , , … …… … … ….. (1) we get
∆ ∆
(x) = + ( − )+ ( − )( − )
!
∆
+ ( − )( − )( − ) + ⋯……………
3! ℎ
Newton’s Interpolation 11
∆
+ ( − )( − )( − )…………..( − ) ……. (2)
!
Sitting = + ℎ
Then =
( )
= = − = −1
( )
= = − = −2
Similarly,
( ( ) ) ( )
= = − = − ( − 1)
Putting this value’s in (2) we get
( ) ( )( ) ( )( )….( )
( )= + ∆ + ∆ + ∆ +⋯+ ∆
! ! !
Where p =
Which is the Newton’s forward difference interpolation formula and is useful for
interpolation near the beginning of a set of tabulated value?
Here h=1, =0
Hence p= = =x
Therefore from Newton’s forward interpolation formula we get
( ) ( )( )
y(x) = 1+x(-1)+ (2) + (6)
! !
= 1-x+ − + ( − 3 + 2)
= 1-x+ − + − 3 + 2
= −2 +1
Which is the required polynomial and (4) = 4 − 2(4) + 1
= 64 − 32 + 1
Newton’s Interpolation 12
= 33
2. The population of a country in the decennial census were as under .Estimate The
population for the year 1895.
Year : x 1891 1901 1911 1921 1931
Population : y(In thousands ) 46 66 81 93 101
x y ∆ ∆ ∆ ∆
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101
3. Given,
45° = 0.7071
50° = 0.7660
55° = 0.8192
60° = 0.8660
Find 52° by using Newton’s forward interpolation formula.
Solution: We know that the Newton’s forward difference interpolation formula is,
( ) ( )( ) ( )( ) …… ( )
(x)= +p∆ + ∆ + ∆ +… … …+ ∆
! ! !
Newton’s Interpolation 13
… ...(1)
[Where, p= ]
We have,
x 45° 50° 55° 60°
y 0.7071 0.7660 0.8192 0.8660
x y ∆ ∆ ∆
45° 0.7071
0.0589
50° 0.7660 -0.0057
0.0532 -0.0007
55° 0.8192 -0.0064
0.0468
60° 0.8660
° °
Here, ℎ = 5° , = 45° , = 52°, = °
= 1.4
So, from (1) we get,
1.4(1.4 − 1)
(52°) = 0.7071 + 1.4(0.0589) + (−0.0057)
2!
1.4(1.4 − 1)(1.4 − 2)
+ (−0.0007)
3!
= 0.7071 + 0.08246 − 0.001567 + 0.0000392
= 0.7880032
Thus, 52° = 0.788 ( approximately ).
( )=
( ) ( )( ) ( )( )….( )
+ ∇ + ∇ + ∇ + ⋯……+ ∇
! ! !
Where p =
Which is the Newton’s backward difference interpolation formula and is useful for
interpolation near the end of a set of the value?
4. The population of a country in the decennial census where as under .Estimate the
population for the year 1925.
Year : x 1891 1901 1911 1921 1931
Population : y (In thousands ) 46 66 81 93 101
Solution: Here the interpolation is desired at the end of the table and so we use Newton’s
backward differences interpolation formula.
We know that the Newton’s backward difference interpolation formula is,
( )=
( ) ( )( ) ( )( )….( )
+ ∇ + ∇ + ∇ + ⋯……+ ∇
! ! !
Now, put
ℎ = 10 , = 1931 , = 1925
= = -0.6
The difference table is :
x y ∇ ∇ ∇ ∇
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101
x Y ∇ ∇ ∇ ∇
0.10 0.1003
0.0508
0.15 0.1511 0.0008
0.0516 0.0002
0.20 0.2027 0.0010 0.0002
0.0526 0.0004
0.25 0.25553 0.0014
0.0540
0.30 0.3093
Here(1) gives
(0.26) =
. ( . ) . ( . )( . )
0.3093 − 0.8(0.0540) + (0.0014) + (0.0004) +
! !
. ( . )( . )( . )
(0.0002)
!
= 0.2662
Interpolation with unequal Intervals 17
Interpolation with unequal Intervals
Discus about Divided Differences.
Let ( ), ( ),……………. ( )be the entries corresponding to the arguments
, , … … … … … … . where the intervals − , − , − may not be
equal.Then the first divided difference of ( ) for the arguments , is defined as
( ) ( ) ( ) ( )
and is denoted by , , that is, ( , )=
Similarly the other first divided differences of ( ) for the arguments
, ; , ;…………; , are
( ) ( )
( , )=
( ) ( )
( , )=
………………………………..
( ) ( )
( , )=
The second divided difference of ( ) for the three arguments , is defined as
( , ) ( , )
( , , )=
( , ,…. ) ( , ,….. )
The nth divided difference is given by ( , , ,…… )=
Note: If two of the arguments coincide the divided difference can be given a meaning
assigned by taking the limit. Thus
( , ) = lim → ( , + )
( ) ( )
=lim → ( )
( ) ( )
=lim →
= ( )
( )
Similarly ( , ,….. )= ( )
!
(r+1) arguments
Theorem: The divided difference are symmetrical in all its arguments, That is
independent of the order of the arguments.
Proof: We have
( ) ( ) ( ) ( )
( , )= = = ( , )
( ) ( )
= +
( )
=∑ , Showing that ( , ) is symmetrical in , ,
( , ) ( , )
Again ( , )=
Interpolation with unequal Intervals 18
( ) ( ) ( ) ( )
= [ − ]
( ) ( ) ( ) ( )
= [ − − + ]
1 ( ) 1 1 ( )
= [ − ( )( − )+ ]
− − − − −
( ) ( )
= [ − ( ) + ]
( )( )
( ) ( )( ) ( )
= [ −( )( )
+ ]
( ) ( ) ( )
= +( )( )
+( )( )
( )( )
( ) ( ) ( )
=( )( )
+( )( )
+( )( )
( )
=∑ ( )( )
,Showing that ( , , ) is symmetrical in , ,
Let us assume similar symmetrical expressions for the (n-1)th divided differences. That is,
let us assume that
( )
( , ,…… )=
( − )( − ) … … … … . . ( − )
( )
+ + ⋯…………
( − )( − ) … … … … . . ( − )
( )
+
( − )( − ) … …… …. .( − )
( )
=
( − )( − ) … … … … . . ( − )
And similar expressions for the other (n-1)th divided difference.
( , ,…… ) ( , ,…… )
Then ( , ,…… )=
( ) ( ) ( )
= [ + + −
( )……..( ) ( )……..( ) ( )……..( )
( ) ( ) ( )
+ + ⋯ ….+ ]
( )……..( ) ( )……..( ) ( )……..( )
( ) ( ) ( )
= + +
( )……..( ) ( )……..( ) ( )……..( )
( )
=∑
( )……..( )
showing that the nth divided difference ( , , … … ) is also symmetrical in
, , … … and thus completing the proof of the theorem by mathematical induction.
Theorem: The nth divided differences of a polynomial of the nth degree are constant.
Proof: First consider the function ( ) = .The first divided differences of this function
are given by
( ) ( )
( , )=
Interpolation with unequal Intervals 19
=
= + + ⋯ ……. + +
Which is a homogeneous expression of degree n-1 in and .The second divided
differences are given by
( , )− ( , )
( , , )=
−
( , ) ( , )
=
= [ ( , )− ( , )]
( )
( ) ( ) ( ) ( )
= [ − ]
= [ − ]
= [( + . + ⋯ … …… + + )−( + . +
…… … … + + )]
= + +
=( + +⋯+ )+ ( +⋯+ ) +⋯………….+
Which is a homogeneous expression of degree n-2 in , , by induction it can be
shown that ( , ,……………., ) is a homogeneous expression of degree n-m.
In particular, The nth divided difference of ( ) = is an expression of degree zero, it
is a constant, and is therefore independent of the values of , ,………
Since the nth divided difference of are constant, Therefore the divided differences of
of order greater than n will all be zero.
If ( ) = , where a is a constant, Then the nth divided difference of ( ) =
(The nth divided difference of )
Which is a constant.
Hence if ( ) = + + ⋯…………+ be a polynomial of degree n, Then
the nth divided differences of all the terms except will be zero. and so the nth
divided difference of the whole polynomial will be constant.
Ex 1. Fit a polynomial which passes through the points (1,4), (3,7), (4,8) and (6,11) by
using Newton’s divided difference formula. Also find the value of y at x=2.
Soln. The difference table is as follows.
1 4
7−4
= 1.5
3−1
1 − 1.5
3 7 4−1
= −.167
8−7
=1 . 167 + .167
4−3 6−1
4 8 = .067
1.5 − 1
11 − 8 = .167
= 1.5 6−3
6−4
6 11
Ex 2. If ( ) = , find ( , ), ( , , ) ( , , , )
Soln : We have
( ) ( ) ( )( )
( , )= = = .
= ( )
=− …………. (1)
. .
( , ) ( , )
Again ( , , ) =
.
= .
( ) ( )
= .
= .
( ){( ) }
= . =
Similarly ( , , , ) = −
Ex 3. Show that ∆
= + +
Soln: ( ) =
∆ ( ) ( )
Now ( )= ( , )=
=
= + +
∆
Similarly ( )= + +
∆ ( )= ∆
Now
= ( , , )
( , ) ( , )
=
=
Interpolation with unequal Intervals 22
=
( )( )
=
= + + proof.
+
( )( )( )……( )
+( )( )( )………( )
+ ⋯…………
+( )( )……….( )
∴ using (1) , we get
⇒
( − )( − )…… ……( − )
+
( − )( − )( − )…………( − )
+ + ⋯ … … … ..
( − )( − )( − )………( − )
+ =0
( − )( − )( − )…………( − )
⇒( )( )………….( )
= ( )( )( )……….( )
+ ( )( )( )……….( )
+ ⋯ … … … … … … ..+( )( )( )…………( )
( )( )( )…………( )
⇒ =( )( )( )………..( )
+
( )( )( )…………( )
( )( )( )………..( )
+……………..
( )( )( )…………( )
+( )( )( )………..( )
( )( )…………( ) ( )( )…………( )
∴ =( )( )………..(
+ ( )( )………..( )
+……………..
)
( )( )…………( )
+( )( )………..( )
Interpolation with unequal Intervals 23
Which is Lagranges formula .
We consider the following difference table in which the central ordinate is taken for
convenience as corresponding to x = .
x y Δ
The differences used in this formula lie on the line shown in the table.
The formula is, therefore, of the form.
= + + + + + ⋯ … … … . . (1)
Where , , ………….. have to be determined, the on the left side can be expressed
in terms of , Δ and higher order differences of as follows.
= = (1 + )
( ) ( )( ) ( )( )( )
= + ∆ + ∆ + ∆ + ∆ +⋯…
! ! !
Similarly the right side of (1) can also expressed in terms of ,∆ and higher order
differences.
Now ∆ =∆
Central Difference 25
=∆ (1 + ∆)
=∆ (1 − ∆ + ∆ − ∆ + ⋯ … … )
∴∆ =∆ −∆ +∆ −∆ + ⋯ … … … … … ….
∴∆ =∆ −∆ +∆ −∆ + ⋯ … … … … … ….
∆ =∆
=∆ (1 + ∆)
=∆ (1 − 2∆ + 3∆ − 4∆ + ⋯ … … )
=∆ − 2∆ + 3∆ − 4∆ + ⋯ ……
Hence (1) give the identity
( − 1) ( − 1)( − 2) ( − 1)( − 2)( − 3)
+ ∆ + ∆ + ∆ + ∆
2! 3! 4!
+ ⋯ … … … ….
= + ∆ + (∆ −∆ +∆ −∆ + ⋯ … … ) + (∆ −∆ +
∆ −∆ + ⋯ … … ) + (∆ − 2∆ + 3∆ − 4∆ + ⋯ …) + ⋯ … (2)
Equating the coefficients of
∆ ,∆ ,∆ ……………… ℎ (2),
=
( − 1)
=
2!
( )( )
- + =
!
( )( ) ( )
∴ = +
( ) ( )
=
!
( ) ( )( )
Similarly = !
etc.
Hence (1) becomes
( − 1) ( + 1) ( − 1)
= + ∆ + ∆ + ∆
2! 3!
( + 1) ( − 1)( − 2)
+ ∆ + ⋯………
4!
Which is Gauss’s forward formula.
EX 1. Use Gauss’s forward formula to find f(x) when x=3.6 from the data below
X 2.5 3.0 3.5 4.0 4.5
Solution:
We know the gauss’s forward formula is,
Central Difference 26
( ) ( ) ( ) ( ) ( )( )
= + ∆ + ∆ + ∆ + ∆ +
! ! !
⋯ … … … …) (1)
Here we take = 3.5 , x=3.6, h=0.5
. .
P= = = 0.2
.
The difference table is as follows
X Y ∆ ∆ ∆ ∆
2.5 24.145
-2.012
-1.818 -.47
-1.581 .344
-1.000
4.5 17.644
X Y ∆ ∆ ∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆
∆
The differences used in this formula lie on the line shown in the table. The formula is,
therefore of the form
= + ′∆ + ′∆ + ′∆ + ′∆ + ⋯ … … … … … … . . (1)
Where ′ , ′ , ′ , ′ , … … … … … . . ℎ .
on the left side of (1) can be expressed in terms of ,∆ ,and higher order differences
of as follows
= = (1 + )
( ) ( )( ) ( )( )( )
= + ∆ + !
∆ + !
∆ + !
∆ + ⋯ … … … ….
Similarly the right side of (1) can also expressed in terms of , ∆ and higher order
differences.
Now ∆ =∆
=∆(1 + ∆)
=∆(1-∆+∆ − ∆ + ⋯ … … … ..)
∴∆ =∆ -∆ +∆ −∆ + ⋯ … … … … … … … … ..
∴∆ = ∆ -∆ +∆ −∆ + ⋯ … … … … … … … … ..
∴∆ =∆
=∆ (1 + ∆)
=∆ (1-2∆+3∆ − 4∆ + ⋯ … … … ..)
∴∆ = ∆ -2∆ +3∆ − 4∆ + ⋯ … … … … … … … … ..
Central Difference 28
∴∆ = ∆ -2∆ +3∆ − 4∆ + ⋯ … … … … … … … … ..
Here (1) Gives the identity
( − 1) ( − 1)( − 2) ( − 1)( − 2)( − 3)
+ ∆ + ∆ + ∆ + ∆
2! 3! 4!
+ ⋯ … ..
= + ′ (∆ −∆ +∆ −∆ + ⋯……) + ′ (∆ −∆ +∆ −
′ (∆ ′
⋯… ……) + − 2∆ + 3∆ − ⋯ …) + (∆ −∆ +∆ − ⋯ ….)…
… …(2)
Equating the coefficient of
∆ ,∆ ,∆ ……………… ℎ (2),
′
=
′ ′
( − 1)
− + =
2!
′ ( ) ′ ( )
∴ = + = +
!
( )
=
!
′ ( ) ( ) ′ ( )( ) ( )
Similarly = And = etc.
! !
Hence (1) becomes,
( + 1) ( + 1) ( − 1)
= + ∆ + ∆ + ∆
2! 3!
( + 2)( + 1) ( − 1)
+ ∆ + ⋯………
4!
Which is Gauss’s backward formula.
Ex 3. Interpolate by means of Gauss’s backward formula the population for the year 1936,
Given the following table.
Year: 1901 1911 1921 1931 1941 1951
Population:(thousands) 12 15 20 27 39 52
x Y ∆ ∆ ∆ ∆ ∆
1901 12
1911 15 2
5 0
1921 20 2 3
7 3 -10
1931 27 5 -7
12 -4
1941 39 1
13
1951 52
Therefore = 27, ∆ = 7, ∆ =5
∆ = 3, ∆ = −7, ∆ = −10
Stirling’s Formula:
We know the Gauss’s forward formula is
( − 1) ( + 1) ( − 1)
= + ∆ + ∆ + ∆
2! 3!
( + 1) ( − 1)( − 2)
+ ∆ + ⋯ … … … … … ….
4!
………………(1)
And the Gauss’s backward formula is,
Central Difference 30
( + 1) ( + 1) ( − 1)
= + ∆ + ∆ + ∆
2! 3!
( + 2)( + 1) ( − 1)
+ ∆ + ⋯ … … … … … ….
4!
………………………………………………………(2)
Now taking the mean of (1) and (2) we obtain
∆ +∆ ( − 1) ∆ +∆ ( − 1)
= + + ∆ + + ∆
2 2! 3! 2 4!
+⋯
Which is called the Stirling’s formula.
Ex 5. Use Stirling’s formula to find (35) where (20) = 512, (30) = 439, (40) =
346, (50)=243
Solution:We know the Stirling’s formula is
∆ +∆ ( − 1) ∆ +∆ ( − 1)
= + + ∆ + + ∆
2 2! 3! 2 4!
+⋯
……………………………………………………(1)
The difference table is as follows.
X Y ∆ ∆ ∆
20 512
-73
30 439 -20
-93 10
40 346 -10
-103
50 243
x y ∆ ∆ ∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
∆ ∆
Ex. The following table gives seadings of the temperature (0 ) secorded of given time (t).
2 3 4 5 6
( − 1) ∆ +∆ ( − 1)( − )
= + ∆ + + ∆
2! 2 3!
( + 1) ( − 1)( − 2) ∆ +∆
+ + ⋯ … … ..
4! 2
2 61.87
-7.79
3 54.08 0.74
-7.05 -0.07
-6.38 -0.06
5 40.65 0.61
-5.77
6 34.88
Numerical Differentiation
Defn: The process of calculating the derivatives of a function by means of the set of given
values of the function is called numerical differentiation.
Differentiation formula by using Newton’s forward interpolation formula:
Consider Newton’s forward difference formula
( ) ( )( ) ( )( )( )
( )= + ∆ + ∆ + ∆ + ∆
! ! !
+………………………… (1)
Where x = + ℎ
p=
=
Now differentiating (1) w. r. to x we get
( )= .
= .
= (∆ + !
∆ + !
∆ + !
∆
+......................) (2)
Again differentiating (2) w.r.to x we get,
"
= (∆ + ∆ + ∆ ........). . . . . . . . . (3)
! !
Formula (2) and (3) can be used for computing the value of and for non-tabular
values of x. The formula takes a simpler form by using x=
we obtain,
p=0 , Hence from (2), we get
[ ] = [∆ + ∆ + ∆ + ∆ +.........]
! ! !
,[ ] = [∆ − ∆ + ∆ − ∆ +......] . . . . . . . (4)
Again from (3) we obtain,
"
= [∆ + ∆ + ∆ +......]
! !
Ex. Find the 1st and 2nd derivatives of the function tabulated below at the point x=3.
x 3.0 3.2 3.4 3.6 3.8 4.0
3.0 -14.00
3.968
4.736 .048
5.552 .048 0
6.416 .048
7.328
4.0 14.00
We know the differentiation formulas by using the Newton’s forward formula are
= [∆ − ∆ + ∆ − ∆ +......] . . . . . . . . (1)
"
= [∆ −∆ + ∆ −.........] . . . . . . . . (2)
Here, = 3.0, ℎ = .2, = −14.00
∆ = 3.968, ∆ = .768, ∆ = .048, ∆ = 0
Hence from (1) we get,
1 1 1
[ ] . = 3.968 − (. 768) + (. 048)
.2 2 3
=18
And from (2) we get,
1
[ "] . = [. 786 − .048 + 0 ]
(. 2)
=18
Ex. Find the 1st and 2 nd derivatives of the function tabulated below at the point x=1.1
Soln: Since the derivatives are required at x=1.1, which is near the beginning of the table,
we shall use Newton’s Forward formula.
The difference formula is as below
Numerical Differentiation 36
x y ∆ ∆ ∆ ∆
1.0 0
.1280
.4160 .0480
.7520 .0480
1.1360 .0480
1.5680
2.0 4.00
=0.660
= [∇ + + ∇ + + + ∇ +( + + + )∇ +....] .
. . . (2)
Again differentiating (2) w. r. to x
"( )= ∇ + ( + 1)∇ +( + + ∇ +........] . . . . . . . (3)
Formula (2) and (3) can be used for computing the value of and respectively for
non-tabular value of x.
For tabular value of x, the formula takes a simpler form for by using x= i.e. k=0.
Then (2) and (3) becomes
( )= [∇ + ∇ + ∇ + ∇ +........] . . . . . . (4)
"( )= [∇ +∇ + ∇ +........] . . . . . . . (5)
(4 ) and (5) gives 1st and 2 nd derivative.
x y=f(x) ∇ ∇ ∇ ∇
1.4 4.0552
.8918
1.0966 .0441
Numerical Differentiation 38
1.3395 .0535
1.6359
2.2 9.0250
x 0 1 2 3 4
0 6.9897
.4139
1 7.4036 -.0366
.3779 .0047
.3466 .0076
3 8.1281 -.0237
.3224
4 8.4510
Here =2, ℎ = 1
= 7.7815, ∆ = .3466, ∆ = .3779,
∆ = −.0313, ∆ = .0076, ∆ = .0047, ∆ = .0025
We know that
∆ ∆ ∆ ∆
( )= [ − !
+........]
1 . 3779 + .3466 1 . 0047 + .0076
(2) = [ − ]
1 2 6 2
= .361225
"(
And )= [∆ − ∆ +........]
" (2)
1 1
= [−.0313 − (. 0025)]
1 2
= -.03151
Ex: Given the data
x 0 1 2 4
f(x) 5 14 41 98
Numerical Differentiation 40
( )( )( ) ( )( )( )
=( )( )( )
(5) +
( )( )( )
(14)
( )( )( ) ( )( )( )
+( (41) + (98)
)( )( ) ( )( )( )
= ( 5) + (14)
−5 +4 −3 +2
+ (41) + (98)
−4 24
=(− + − + ) + − 28 + − +
− + − 41 + +5
∴ ( )=− + − +5
( )= + −
(. 9) = (.9) + (. 9 ) −
=18.26125
0 4
Numerical Differentiation 41
11
2 26 7
32 1
3 58 11 0
54 1
4 112 16 0
118 1
7 466 22
228
9 922
Numerical Integration
*A General Quadrature Formula for Equidistance Ordinates.
Let a set of data points ( x0 , y0 ) , ( x1 , y1 ) , ( x2 , y2 ) , …………. ( xn , yn ) of a function = ( )
be given, where f(x) is not known explicitly, it is required to compute the value of the
definite integral
b
I ydx (1)
a
Let the interval [a,b] be divided into n equal subintervals each length h such that
a x0 x1 x2 ..... xn b . Clearly, xn x0 nh . Hence (1) becomes
xn
I ydx
x0
*Trapezoidal Rule.
Let a set of data points ( x0 , y0 ) , ( x1 , y1 ) , ( x2 , y2 ) , …………. ( xn , yn ) of a function = ( )
be given, where f(x) is not known explicitly, it is required to compute the value of the
definite integral
b
I ydx (1)
a
Let the interval [a,b] be divided into n equal subintervals each length h such that
a x0 x1 x2 ..... xn b . Clearly, xn x0 nh . Hence (1) becomes
Numerical Integration 43
xn
I ydx
x0
y y0
h y0 1
2
y y
h 0 1
2
x2
y1 y2
Similarly y dx h 2
x1
x3
y2 y3
y dx h 2
x2
………………
xn
yn 1 yn
y dx h 2
x n 1
xn
h
y dx 2 y0 2( y1 y2 ....... yn 1 ) yn
x0
5.2
Ex. Calculate the value of the integral ln x dx by Trapezoidal rule.
4
Soln. Divide the interval [4, 5.2] into six equal parts. So that h=(5.2-4)/6=0.2 and the
value of ln x for each point of sub division are given below:
n x y=ln x
0 4.0 1.3862944
1 4.2 1.4350845
2 4.4 1.4816045
3 4.6 1.5260563
4 4.8 1.5686159
5 5.0 1.6094379
6 5.2 1.6486586
We have from the trapezoidal rule
x6
h
y dx 2 y0 2( y1 y2 y3 y4 y5 ) y6
x0
5.2
0.2 1.3862944 2(1.4350845 1.4816045
ln xdx
4
2 1.5260563 1.5686159 1.6094379) 1.6486586
0.1(18.276551)
1.8276551
Ex. A curve is drawn to pass through the points given by the following table:
x 1 1.5 2 2.5 3 3.5 4
y 2 2.4 2.7 2.8 3 2.6 2.1
Find the area bounded by the curve, the x-axis and the lines x=1, x=4
Soln. In order to find the required area we shall compute the value of the integral
4
I y dx
1
Here n=6, therefore h=(4-1)/6=0.5
We have from the trapezoidal rule
x6
h
y dx 2 y0 2( y1 y2 y3 y4 y5 ) y6
x0
Numerical Integration 45
5 .2
0. 5
y dx 2 2(2.4 2.7 2.8 3 2.6) 2.1
4
2
7.775
Putting n=2 in (2) and neglecting 3rd and higher order differences, we get
x2
1 2
y dx 2h y0 y0 6 y0
x0
Numerical Integration 46
1
2h y0 ( y1 y0 ) ( y2 2 y1 y0 )
6
h
y0 4 y1 y2
3
x4
h
Similarly y dx 3 y2 4 y3 y4
x2
x6
h
y dx 3 y4 4 y5 y6
x4
………………………..
xn
h
y dx 3 yn 2 4 yn 1 yn
x n2
xn
h y0 4( y1 y3 y5 ....... yn 1 )
y dx 3 2( y2 y4 y6 ..... yn 2 ) yn
x0
Which is known as Simpson’s 1/3 Rule, or simply Simpson’s rule. It should be noted that
this rule requires the division of the whole range into an even number of subintervals of
width h.
5 .2
Ex. Calculate the value of the integral ln x dx by Simpson’s 1/3 Rule.
4
Soln. Divide the interval [4, 5.2] into six equal parts. So that h=(5.2-4)/6=0.2 and the
value of ln x for each point of sub division are given below:
n x y=ln x
0 4.0 1.3862944
1 4.2 1.4350845
2 4.4 1.4816045
3 4.6 1.5260563
4 4.8 1.5686159
5 5.0 1.6094379
6 5.2 1.6486586
We have from Simpson’s 1/3 rule
Numerical Integration 47
x6
h
y dx 3 y0 4( y1 y3 y5 ) 2( y2 y4 ) y6
x0
5.2
ln xdx
4
1
dx
Ex. Find 1 x2 by using Simpson’s 1/3 Rule. Hence obtain the approximate value of
0
.
Soln. Divide the the range of integration [0, 1] into 6 equal parts. So that h=(1-0)/6=1/6.
1
the value of y for each point of sub division are given below:
1 x2
n x y
0 0 1
1 1/6 0.9729729
2 2/6 0.9
3 3/6 0.8
4 4/6 0.6923076
5 5/6 0.5901639
6 1 0.5
By Simpson’s 1/3 Rule we get
x6
h
y dx 3 y0 4( y1 y3 y5 ) 2( y2 y4 ) y6
x0
1
dx
2
01 x
Therefore / 4 0.7853979
4(0.7853979) 3.1415916
0.7
Ex. Evaluate x1 / 2e x dx by using Simpson’s 1/3 Rule.
0.5
Soln. Divide the range of integration [0.5, 0.7] into 4 equal parts. So that h=(0.7-
0.5)/4=.05. the value of y x1 / 2e x for each point of sub division are given below:
n x y
0 0.50 0.4288818
1 0.55 0.4278774
2 0.60 0.4251076
3 0.65 0.4208867
4 0.70 0.4154730
By Simpson’s 1/3 Rule we get
x4
h
y dx 3 y0 4( y1 y3 ) 2( y2 ) y6
x0
1
x1/2 e x dx
0
n x y
0 0.2 3.02950
1 0.3 2.84935 2.84935
2 0.4 2.79753 2.79753
3 0.5 2.82130 2.82130
4 0.6 2.89759 2.89759
5 0.7 3.01464 3.01464
6 0.8 3.16604 3.16604
Numerical Integration 49
n
p ( p 1) 2 p( p 1)( p 2) 3
I h y0 py0 y0 y0 ............... dp
0
2 6
Which gives on simplification
n2 n3 n 2 2 y0 n 4 3 y0
I h ny0 y0 n3 n 2 ............... .
2 3 2 2 4 6
……………………………………………(2)
Putting n=3 in (2) and neglecting 4th and higher order differences, we get
x3
3 3 2 1 3
y dx 3h y0 2 y0 4 y0 8 y0
x0
3 3 1
3h y0 ( y1 y0 ) ( y2 2 y1 y0 ) ( y3 3 y2 3 y1 y0 )
2 4 8
x3
3h
y dx y0 3 y1 3 y2 y3
x0
8
x6
3h
Similarly y dx y3 3 y 4 3 y5 y 6
x3
8
x9
3h
y dx y6 3 y7 3 y8 y9
x6
8
………………………..
xn
3h
y dx 8 yn 3 3 yn 2 3 yn 1 yn
x n 3
xn
3h y0 3( y1 y2 y4 y5 ....... yn 2 yn 1 )
y dx 8 2( y3 6 ..... yn 3 ) yn
x0
5.2
Ex. Calculate the value of the integral ln x dx by Simpson’s 3/8 Rule.
4
Soln. Divide the interval [4, 5.2] into six equal parts. So that h=(5.2-4)/6=0.2 and the
value of ln x for each point of sub division are given below:
n x y=ln x
0 4.0 1.3862944
1 4.2 1.4350845
2 4.4 1.4816045
Numerical Integration 51
3 4.6 1.5260563
4 4.8 1.5686159
5 5.0 1.6094379
6 5.2 1.6486586
1.3862944
3 0.2
3(1.4350845 1.4816045 1.5686159 1.6094179)
8
2(1.5260563) 1.6486586
0.6
( 24.371294)
8
1.827847
1
2
Ex. Calculate the value of the integral e x dx by Simpson’s 3/8 Rule.
0
Soln. Divide the interval [0, 1] into 10 equal parts. So that h=(1-0)/10=0.1 the value of
2
e x for each point of sub division are given below:
n x y= e x
2
0 0.0 1.00000
1 0.1 0.99005
2 0.2 0.96079
3 0.3 0.91393
4 0.4 0.85214
5 0.5 0.77880
6 0.6 0.69768
7 0.7 0.61263
8 0.8 0.52729
9 0.9 0.44486
10 1.0 0.36788
Numerical Integration 52
1.00000
3 0. 1
3(0.99005 0.96079 0.85214 0.77880 0.61263 0.52729)
8
2(0.91393 0.69768 0.44486) 0.36788
0.3
1 3(4.7222) 2(2.05647) 0.36788
8
0.73677825
System of Linear Equation 53
= = = = 1.5
.
Iteration 3 : = = = 1.25
.
= = = 2.25
Thus the approximate solution is x = 1.25 & y = 2.25
System of Linear Equation 54
3rd iteration:
1 1
= (85 − 6 + ) = {85 − (6 × 3.57) + 1.93} = 2.43
27 27
= (72 − 6 − 2 ) = {72 − (6 × 2.43) − (2 × 1.93)} = 3.57
= (110 − − ) = (110 − 3.57 − 2.43) =1.93
Thus the approximate result is x = 2.43, y = 3.57 & z = 1.93
+( ) + … … … … . +( ) = (5)
st nd
The 1 unknown can be eliminated from the 2 equation by substituting equation (5) from
(2)
− + … … … … . . +( − ) = −
⇒ + ………………+ =
Repeating the process for the remaining equation, the result become in the following
modified system.
+ + + … … …… … … .+ = (6)
+ + …………… …. + = (7)
+ + ……………….+ = (8)
…………….. ……… ……………………….
……………………………………………….
+ + ……… …… ….+ = (9)
nd
Now repeat the above process in order to eliminate the 2 unknown from equation (8)
through (9), we get
+ + + ……………..+ =
+ + ………………+ =
+ ………………+ =
+ ………………+ =
Where the double prime indicates that the eliminates have been changed or modified twice
.The procedure can be continued using the remaining pivot equations, we get
+ + + ……………..+ = (10)
+ + ………………+ = (11)
+ ………………+ = (12)
……………………………………
………………………………………
( ) ( )
= (13)
( )
From (13), we get = ( ) (14)
Remaining x’s can be represented by the following formula
( ) ( )
∑
= ( ) (15)
[where i = n-1 ,n-2 ,………., 3 , 2 , 1 ]
1 1 1 6
~ 0 1 2 4 [R = R − R ] , [R = R − R ]
0 1 3 −5
1 1 1 6
~ 0 1 2 4 [R = R − R ]
0 0 1 −9
1 1 0 15
~ 0 1 0 22 [R = R − R ] , [R = R − 2R ]
0 0 1 −9
1 0 0 −7
~ 0 1 0 22 [R = R − R ]
0 0 1 −9
Thus the solutions are x = −7
y = 22
z = −9
Curve Fitting 58
Curve Fitting
Suppose we have m observations (x1, y1), (x2, y2). . . . . .(xm, ym) of two variables and
and it is requested to fit a curse of the type
y = a + bx + cx 2 + . . . . . . . . + kxn …………(1)
Now we have to determine the constants a, b . . . . . k such that it represents the curve of
best fit of that degree. In case m=n, we get in general a unique set of values satisfying the
given systems of equations. But if m>n, then by substituting the different values of x and y
in equation (1) we get m equations and we want to find only n constants. Hence there may
be no such solution to satisfy all m equations. So we try to obtain those values of a, b . . . .
k which may give the best fit i.e. which may satisfy all the equations as nearly as possible.
In such a case the principle of least squares asserts a suitable method.
Putting x1, x2 . . . . . . . xm for x in equation (1), we have
Y1 = a + bx1 + cx12 + . . . . . . . + kx1n
Y2 = a + bx2 + cx22 + . . . . . . . + kx2n
. . . . . . . .. .. . . .. . . .. . . .. . . . ….
Ym = a + bx m + cxm2 + . . . . . . . + kxmn
The quantities Y1, Y2 . . . . . . . . Ym are the expected values of y corresponding to x = x1,
x = x2 . . . . . . . x = xm respectively. The values y1, y2, . . . . .ym are the observed values of y
corresponding to the given values x1, x2, . . . . . . xm of x. In general the expected values are
different from the observed values.
Let Rr = yr – Yr. For different values of r these differences are called residuals.
The quantity R12 + R22 + . . . . . + Rm2 provides a measure of the ‘goodness of fit’ of
the curse to the given data.
If it is small, the fit is good, if is large the fit is bad.
Now set
U = ∑ i2
= ∑( yr – Yr)2
= ∑(yr – a – bxr – cxr2 - . . . . . . . .)2
By this principle of least square the constants a, b, c . . . . . k are chosen in such a
manner that sum of square of residuals in minimum. For maximum or minimum of U, we
must have
=0= = =. . . . . . . . .=
After simplifying these relations, we have
∑y = ma + b∑x + . . . . . . . + k∑x n
∑xy = a∑x + b∑x2 . . . . . . . + k∑xn+1
∑x2y = a∑x2 + b∑x3 . . . . . . . + k∑xn+2
. . . . . . .. . . . . . . . . . . . . . . . . . . . … . . .
∑xny = a∑xn + b∑xn+1 . . . . . . . + k∑x2n
These equations are (n+1) in number and can be solved as simultaneous equations to give
the values of the constants a, b . . . . . k. These equations are called normal equations.
Curve Fitting 59
If we calculate the second order partial derivatives and the values a, b . . . . . k are put in
these derivatives. They give a positive value of the function.
So U is minimum.
Particular case.
If n = 1, then the curve to be fitted is a straight line y = a + bx and the normal equations
are
∑y = ma + b∑x
∑xy = a∑x + b∑x2
If n = 2, then the curve to be fitted is a second degree parabola y = a + bx + cx2 and the
normal equations are
∑y = ma + b∑x + c∑x2
∑xy = a∑x + b∑x2 + c∑x3
∑x2y = a∑x2 + b∑x3 + k∑x4
Ex. Fit a straight line to the following data regarding x as the independent variable:
x: 0 1 2 3 4
y: 1 1.8 3.3 4.5 6.3
Solution. Let the straight line to be fitted to the given data be
y = a + bx. Then the normal equations are
∑y = ma + b∑x
∑xy = a∑x + b∑x2
Now
x y xy x2
0 1 0 0
1 1.8 1.8 1
2 3.3 6.6 4
3 4.5 13.5 9
4 6.3 25.2 16
Total 10 16.9 47.1 30
16.9 = 5a + 10b
And 47.1 = 10a + 30b
Solving the above equations, we obtain a = 0.72, b = 1.33.
Hence the fitted line is
y = 0.72 + 1.33x (answer)
Curve Fitting 60
Ex. The weights of a calf taken at weekly intervals are given below. Fit straight line using
the method of least squares and calculate the rate of growth per week.
Age(x): 1 2 3 4 5 6 7 8 9 10
Weight
52.2 58.7 65.0 70.2 75.4 81.1 87.2 95.5 102.2 108.4
(y):
Solution: Here x and y denote the variables age and weight respectively.
Let the least square line is = + . Then the normal equations are
∑ = + ∑
∑ = ∑ + ∑ 2
Now
Curve Fitting 61
x y x2 xy
1 52.2 1 52.2
2 58.7 4 117.4
3 65.0 9 195.0
4 70.2 16 280.8
5 75.4 25 377.0
6 81.1 36 486.6
7 87.2 49 610.4
8 95.5 64 764.0
9 102.2 81 919.8
10 108.4 100 1084.0
55 795.9 385 4887.2
= 6.18
∴ the rate of growth per week is 6.18 units. (Answer)
Ex. Fit an exponential curve of the form = to the following data:
x: 1 2 3 4 5 6 7 8
y: 1.0 1.2 1.8 2.5 3.6 4.7 6.6 9.1
Solution. Here =
⟹ = + .
Let
=
=
=
∴ = +
The normal equations are
∑ = + ∑
∑ = ∑ + ∑ 2
Curve Fitting 62
x y Y = lny xY x2
1 1.0 0.0000 0.0000 1
2 1.2 0.0792 0.1548 4
3 1.8 0.2553 0.7659 9
4 2.5 0.3979 1.5916 16
5 3.6 0.5563 2.7815 25
6 4.7 0.6721 4.0326 36
7 6.6 0.8195 5.7365 49
8 9.1 0.9590 7.6720 64
36 30.5 3.7393 22.7385 204
Now
∴ From normal equations
3.7393 = 8A + 36B
22.7385 = 36A + 204B
Solving these, we get
= 1.8336, = 0.1406
∴ = ℯ = ℯ1.8336 = 0.68
= ℯ = ℯ0.1406 = 1.38
∴ The required curve is
=
= 0.68 × 1.38