MACM - Module II (Part-II)
MACM - Module II (Part-II)
Module II
Part-II
LECTURE: 23 : Introduction to Operators for Numerical methods (15), Finite Dierence Operators (35)
LECTURE: 24 : Relations between the operators (40), Interpolation (10)
LECTURE: 25 : Newton's Forward Interpolation(50)
LECTURE: 26 : Newton's Backward Interpolation (50)
LECTURE: 27 : Lagrange's Interpolation (50)
LECTURE: 28 : Practical Applications on Interpolation
*************************************************************************
LECTURE: 23
Introduction to Operators for Numerical methods
Finite Dierence Operators
The nite dierence operators can be classied into three types:
=yi+2 − 2yi+1 + yi .
xi yi ∆yi ∆2 y i ∆3 y i ∆4 y i
x0 y0
∆y0
x1 y1 ∆2 y0
∆y1 ∆ 3 y0
x2 y2 ∆2 y1 ∆4 y 0
∆y2 ∆ 3 y1
x3 y3 ∆2 y2
∆y3
x4 y4
1
The back dierence operator ∇
∇yi =∇f (xi ) = f (xi ) − f (xi − h) = f (xi ) − f (xi−1 ) = yi − yi−1 , i = 0, 1, 2, · · ·
=∇yi − ∇yi−1
xi yi ∇yi ∇2 y i ∇3 y i ∇4 y i
x0 y0
∇y1
x1 y1 ∇2 y2
∇y2 ∆ 3 y3
x2 y2 ∇2 y3 ∇4 y 4
∇y3 ∇ 3 y4
x3 y3 ∇2 y4
∇y4
x4 y4
δ 2 yi =δ(yi+ 21 − yi− 21 )
=δyi+ 12 − δyi− 21
=yi+1 − yi − yi + yi−1
xi yi δyi δ 2 yi δ 3 yi δ 4 yi
x0 y0
δy1/2
x1 y1 δ 2 y1
δy3/2 δ 3 y3/2
x2 y2 δ 2 y2 δ 4 y2
δy5/2 δ 3 y5/2
x3 y3 δ 2 y3
δy7/2
x4 y4
2
Solution:
1)
2)
3)
x2 (x + h)2
2
x
∆ = −
cos2x cos2(x + h) cos2x
[(x + h)2 − x2 ]cos2x + x2 [cos(2x) − cos2(x + h)]
=
cos2(x + h)cos2x
[(2hx + h ]cos2x + 2x2 sin(h)sin(2x + h)
2
= .
cos2(x + h)cos2x
4)
Example: 2
Evaluate i) ∆2 5x+12
x2 +5x+16 (ii) ∆2 (abx ) (iii) ∆n (ex ) interval of dierencing being unity.
i)
2 5x + 12 2 5x + 12 2 2 3 2 3
∆ =∆ =∆ + =∆ ∆ +∆
x2 + 5x + 16 (x + 2)(x + 3) x+2 x+3 x+2 x+3
1 1 1 1
=∆ 2 − +3 −
x+3 x+2 x+4 x+3
1 1
= − 2∆ − 3∆
(x + 2)(x + 3) (x + 3)(x + 4)
1 1 1 1
=−2 − −3 −
(x + 3)(x + 4) (x + 2)(x + 3) (x + 4)(x + 5) (x + 3)(x + 4)
4 6
= +
(x + 2)(x + 3)(x + 4) (x + 3)(x + 4)(x + 5)
2(5x + 16)
=
(x + 2)(x + 3)(x + 4)(x + 5)
3
ii) ∆2 (abx )
iii) ∆n (ex )
∆(ex ) =(ex+1 − ex )− = ex (e − 1)
=(e − 1)2 ex
Problems:
1. (i) Evaluate∆(x+ cosx)
(ii) ∆tan−1 n−1
n
(iii) ∆ 1
x(x+4)(x+6)
(iv) ∆ 2 1
x2 +5x+6
2. Evaluate
(i) ∆(e3x log(2x))
(ii) ∆( 2x! )
x
(iii) ∆n (ax )
3. If f (x) = eax+b , show that its leading dierences from geometric progression.
4. Prove that (i) y3 = y2 + ∆y1 + ∆2 y0 + ∆3 y0 (ii) ∇2 y8 = y8 − 2y7 + y6 (iii)δ 2 y6 = y6 − 2y5 + y4 .
5. Evaluate (i) ∆2 [(1 − x)(1 − 2x)(1 − 3x) (ii) ∆1 0[(1 − x)(1 − 2x2 )(1 − 3x3 )(1 − 4x4 )] if the interval of dierencing
is 2.
LECTURE 24
Dierence Operators:
(a) Shift Operator (E)
Ef (x) =f (x + h),
E 2 f (x) =f (x + 2h),
E 3 f (x) =f (x + 3h)
..
.
E n f (x) =f (x + nh)
4
(b) Inverse Shift Operator (E −1 )
Eyx =yx+h ,
E −1 yx =yx−h
E −1 f (x) =f (x − h),
E −2 f (x) =f (x − 2h)
..
.
E −n f (x) =f (x − nh)
(i)∆ =E − 1 orE = 1 + ∆
(ii)∇ =1 − E −1
1 1
(iii)δ =E 2 − E − 2
1 1 1
(iv)µ = (E 2 + E − 2 )
2
1
(v)∆ =E∇ = ∇E = δE 2
(vi)E =ehD
In terms of E ∆ ∇ δ hD
E - −1 1 2
p
∆+1 (1 + ∇) 1+ 2δ + δ 1 + δ 2 /4 ehD
E-1 -
p
∆ (1 + ∇)−1 − 1 1 2
2 δ + δ 1 + δ /4
2 ehD − 1
-
p
∇ 1 − E −1 (1 + ∆)−1 − 1 − 21 δ 2 + δ 1 + δ 2 /4 1 − ehD
-
1 1 1
δ E2 ∆(1 + ∆)− 2 ∇(1 − ∇)− 2 2sinh(hD/2)
1
− 12 − 21 − 12
1
p
µ 2 (E
2 +E ) (1 + ∆/2)(1 + ∆) (1 + ∇/2)(1 + ∇) (1 + δ 2 /4) cosh(hD/2)
hD logE log(1 + ∆) log(1 − ∇)−1 2sinh−1 (∇/2) -
Example:1
Prove that ex = ∆2 x
E e − Eex
∆2 e x the interval dierencing being h.
Solution:
∆2 x
e =∆2 E −1 ex = ∆2 ex−h = ∆2 ex e−h = e−h ∆2 ex
E
Eex
RHS =e−h ∆2 ex 2 x = e−h Eex = e−h ex+h = ex .
∆ e
Example:2
Prove with the usual notations, that
(1) hD = log(1 + ∆) = −log(1 − ∇) = sinh−µδ
5
(2) (E 2 + E − 2 (1 + ∆) 2 = 2 + ∆
1 1 1
(3) δ = 21 δ 2 + δ 1 + δ 2 /4
p
(4) ∆3 y2 = ∇3 y5
Solution:
(1) We know that
ehD =E = 1 + ∆
∴ hD =log(1 + ∆)
=logE = −log(E −1 )
= − log(1 − ∇)
we know that
1 1 1
µ = (E 2 + E − 2 )
2
1 1
δ =E 2 − E − 2
1 1 1 1 1
µδ = (E 2 + E − 2 )(E 2 − E − 2 )
2
1
= (E − E −1 )
2
1
= (ehD − e−hD )
2
=sinh(hD)
hD =sinh−1 (µδ)
(2)
1 1 1 1 1 1
(E 2 + E − 2 )(1∆ ) 2 =(E 2 + E − 2 )E 2
=E + 1
=1 + ∆ + 1
=2 + ∆
(3)
1 2 1 1
q
p 1 1 1 1 1
δ + δ (1 + δ 2 /4 = (E 2 − E − 2 )2 + (E 2 − E − 2 ) (1 + (E 2 − E − 2 )2 /4)
2 2
1 1 1 p
= (E + E −1 − 2) + (E 2 + E − 2 ) (E + E −1 + 2/4)
2
1 1 1 1 1 1
= (E + E −1 − 2) + (E 2 − E − 2 )(E 2 + E − 2 )
2 2
1 1
= [(E + E −1 − 2) + (E − E −1 )] = (2E − 2) = E − 1 = ∆.
2 2
6
(4)
∆3 y2 =(E − 1)3 y2
∇3 y5 =(1 − E −1 )3 y5
∆3 y2 =∇3 y5
Problems:
1. Evaluate taking h as the interval of dierencing
i) ∆2
E sinx
ii) ∆2 4
E x ,h =1
∆2 sin(x+h)
iii) ∆2
E sin(x + h) + Esin(x+h)
ii) µ2 = 1 + δ4
2
iii) δ(E 2 + E − 2 ) = ∆E −1 + ∆
1 1
iv) ∇ = ∆E −1 = E −1 ∆ = 1 − E −1
4. Show that
i) µδ = 12 (∆ + ∇)
ii) 1 + δ 2 /2 =
p
(1 + δ 2 µ2 )
iii) ∆ + ∇ = ∆
∇ − ∇
∆
iv) ∇2 = h2 D2 − h3 D3 + 12
7 4 4
h D − ···
5. prove that
i) ∆r = ∆r fk−r
ii) ∆fk2 = (fk + fk+1 )∆fk
iii) ∆ = 12 δ 2 + δ (1 + δ 2 /4)
p
iv) E 2 = (1 + δ 2 /4) 2 + /2
1 1
7
LECTURE 25 & 26
Newton's formulas using Forward, Backward
Consider, we have the following data base: where xi = x0 + ih, h = xn −x0
n
x x0 x1 ··· xn
y y0 y1 ··· yn
Our aim is to nd f (xp ), where 0 < p < 1, xp = x0 + ph If xp close to the beginning of the database
(x0 < xp < x1 ), then we use Newton Forward formula , which takes the form:
p(p − 1) 2
f (xp ) = y0 + p∆y0 + ∆ y0 + · · ·
2!
While, if xp close to the end of the data base, (xn−1 < xp < xn ), then we use Newton Backward
p(p + 1) 2
f (xp ) = yn + p∇yn + ∇ yn + · · ·
2!
where xp = xn + ph,
If xp close to the center of the database, xi then we use Newton center formula, which takes the form:
(p3 − p) 2 (q 3 − q) 2
f (xp ) = pyi+1 + δ yi+1 + qyi + δ yi
6 6
where xp = xi + ph, p + q = 1.
Example:1
Consider the following data base
x 4 6 8 10
f(x) 1 3 8 20
Find the approximate value for each of the following:
i) f (4.5)
ii) f (9)
iii) f (6.4)
Solution:
i) f (4.5)
Since 4.5 close to the beginning of the data base, we use the forward Newton formula. Let xp = 4.5 ,
therefore
xp − x0 0.5
p= = = 0.25.
h 2
p(p − 1) 2
f (xp ) =y + p = y0 + p∆y0 + ∆ y0
2!
∆y0 =y1 − y0 = 2
8
n x y ∆y ∆2 y
0 x0 = 4 y0 = 1
∆y0 = 2
1 x1 = 6 y1 = 3 ∆2 y0 = 3
∆y1 = 5
2 x2 = 8 y2 = 8 ∆2 y1 = 7
∆y2 = 12
3 x3 = 10 y3 = 20
Thus,
p(p − 1) 2
f (xp ) =yp = y0 + p∆y0 + ∆ y0
2!
3
f (4.5) =1 + 0.25(2) + (0.25)(1 − 0.25)
2!
39
= = 1.2188
32
ii) f (9)
Since 9 close to the beginning of the data base (x3 = 10), we use the backward Newton formula. Let xp =
9 , therefore p = xp −xn
h = 9−10
2 = − 12 .
p(p + 1) 2
f (xp ) =yp = yn + p∇yn + ∇ yn
2!
∇y3 =y3 − y0 = 20 − 8 = 12
iii) f (6.4)
9
Since 6.4 close to the beginning of the data base (x1 and x2 ), we use the backward Newton formula. Let
xp = 4.5 , therefore p =
xp −xn 6.4−6
h = 2 = 0.2, q = 1 − p = 0.8
p(p + 1) 2
f (xp ) =py2 + pδyn + δ yn
2!
δy3 =y3 − y0 = 20 − 8 = 12
Problems:
1. The tabel given the distances in natural miles of the visible horizon for given heights in feet above the
earth's surface:
x = height : 100 150 200 250 300 350 400
M arks : 30 − 40 40 − 50 50 − 60 60 − 70 70 − 80
N oof Students : 31 42 51 35 31
x:0 1 2 3
y:1 2 1 10
10
LECTURE 27:
Interpolation with unequal intervals
Lagrange's Interpolation Formula:
If y = f (x) takes the value y0 , y1 , · · · yn corresponding to x = x1 , x2 , · · · xn , then
(x − x1 )(x − x2 ) · · · (x − xn ) (x − x0 )(x − x2 ) · · · (x − xn )
f (x) = y0 + y1
(x0 − x1 )(x0 − x2 ) · · · (x0 − xn ) (x1 − x0 )(x1 − x2 ) · · · (x1 − xn )
(x − x0 )(x − x1 ) · · · (x − xn−1 )
+ ··· yn (1)
(xn − x0 )(xn − x1 ) · · · (xn − xn−1 )
Let y = f (x) be a function which takes the value (x0 , y0 ), (x1 , y1 ), (x2 , y2 ) · · · (xn , yn ). Since there are n + 1
pairs of values of x and y , we can present f (x) by a polynomial of s of degree n. Let this polynomial be of the
form
putting x = x0 , y = y0 , we get
similarly putting x = x1 , y = y1
we have
y1
a1 = ,
(x1 − x1 )(x1 − x2 ) · · · (x1 − xn )
a0 , a1 , · · · an
from the I, II have submitted. Substituting these values in the above equation, we get (1).
Example: 1
x 5 7 11 13 17
f(x) 150 392 1492 2366 5202
Evaluate f (9) using Lagrange's Interpolation.
Solution: Here x0 = 5; x1 = 7; x2 = 11; x3 = 13; x4 = 17.
y0 = 150; y1 = 392; y2 = 1492; y3 = 2366; y4 = 5202.
putting x = 9, we get
11
(9 − 7)(9 − 11)(9 − 13)(9 − 17) (9 − 5)(9 − 11)(9 − 13)(9 − 17)
f (9) = × 150 + × 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) (9 − 5)(9 − 7)(9 − 13)(9 − 17)
+ × 1452 + × 2366
(11 − 6)(11 − 7)(11 − 13)(11 − 17) (13 − 5)(13 − 11)(13 − 5)(13 − 17)
(9 − 5)(9 − 7)(9 − 11)(9 − 17)
+ × 5202
(17 − 5)(17 − 7)(17 − 11)(13 − 17)
50 3136 3872 578
= + + + = 810.
3 15 3 5
Example: 2 Find the polynomial f (x) by using Lagrange's formula hence nd f (3) for the following data
x 0 1 2 5
f(x) 2 3 12 147
Solution: Here x0 = 0; x1 = 1; x2 = 2; x3 = 5;
y0 = 2; y1 = 3; y2 = 12; y3 = 147;
putting x = 9, we get
(x − x1 )(x − x2 ) · · · (x − xn ) (x − x1 )(x − x2 ) · · · (x − xn )
f (x) = y0 + y1
(x0 − x1 )(x0 − x2 ) · · · (x0 − xn ) (x1 − x1 )(x1 − x2 ) · · · (x1 − xn )
(x − x1 )(x − x2 ) · · · (x − xn )
+ ··· yn
(xn − x1 )(xn − x2 ) · · · (xn − xn−1 )
(x − 1)(x − 2)(x − 5) (x − 0)(x − 2)(x − 5)
f (9) = × (2) + × (3)
(0 − 1)(0 − 2)(0 − 5) (1 − 0)(1 − 2)(1 − 5)
(x − 0)(x − 1)(x − 5) (x − 0)(x − 1)(x − 2)
+ × (12) + × (147).
(2 − 0)(2 − 1)(2 − 5) (5 − 0)(5 − 1)(5 − 2)
Hence,
f (x) = x3 + x2 − x + 2, f (3) = 35.
Thus
3x2 + x + 1 2.5(x − 2)(x − 3) − 15(x − 1)(x − 3) + 15.5(x − 1)(x − 2)
=
(x − 1)(x − 2)(x − 3) (x − 1)(x − 2)(x − 3)
2.5 15 15.5
= − + .
(x − 1) (x − 2) (x − 3)
Example: 4 Find the distance moved by a particle and its acceleration at the end of 4 seconds, if the time
verses velocity data as follows.
12
x 0 1 4 4
f(x) 21 15 12 10
Solution: Lagrange's Formula:
(t − t1 )(t − t2 )(t − t3 ) (t − t0 )(t − t2 )(t − t3 )
v= v0 + v1
(t0 − t1 )(t0 − t2 )(t0 − t3 ) (t1 − t0 )(t1 − t2 )(t1 − t3 )
(t − t0 )(t − t1 )(t − t3 ) (t − t0 )(t − t1 )(t − t2 )
+ v2 + v3
(t2 − t0 )(t2 − t1 )(t2 − t3 ) (t3 − t0 )(t3 − t1 )(t3 − t2 )
(t − 1)(t − 3)(t − 4) t(t − 3)(t − 4) t(t − 1)(t − 4)
= 21 + 15 + 12
(−1)(−2)(−4) (1)(−2)(−3) (3)(2)(−1)
t(t − 1)(t − 3)
+ 10
(4)(3)(−1)
=2.5(t − 2)(t − 3) − 15(t − 1)(t − 3) + 15.5(t − 1)(t − 2)
Thus
1
v= (−5t3 + 38t2 − 105t + 252).
12
Since
Z 4 Z 4
1
Distance moved = vdt = (−5t3 − 105t + 252)dt
0 0 12
4
1 −5t4 38t3 105t2
= + − + 252t
12 4 3 2
0
1 2432
= − 320 + − 840 + 1008
12 3
=54.9
dv 1
Also acceleration = = (−15t2 + 76t − 105 + 0)
dt 2
d dv 1
Acceleration = ( ) = (−15(16) + 76(4) − 105) = −3.4
dt dt 12
Problems:
1. Use the Lagrange's interpolation formula to nd the value of y when x = 10, if the following x and y are
given
x: 5 6 9 11
y: 12 13 14 16
2. Given log10 654 = 2.8156, log10 658 = 2.8182, log10 661 = 2.8202. Use the Lagrange's formula and nd the
value of log10 656
3. The following are the measurements T made on a curve recorded by oscilography representing a change of
current I due to a change in the conditions of an electric current.
13
4. Using Lagrange's interpolation calculate the prot in the year 2000 from the following data:
5. Use the Lagrange's interpolation formula to nd the value of f (x), given
x: 0 2 3 6
6. If y(1) = −3, y(3) = 9, y(4) = 30, y(6) = 132, nd the Lagrange's interpolation polynomial that takes the
same value as y at the given points.
7. Given f (0) = 18, f (1) = 9, f (3) = 0, f (5) = −248, f (6) = 0, f (9) = 13104, nd f (x).
8. Find the missing term in the following table using interpolation
x: 1 2 4 5 6
y: 14 15 5 ... 9.
14