lagrange-newton interpolation yashoverdhan

69
Interpolation The word interpolation denotes the method The word interpolation denotes the method of computing the value of the function f( ) for an gi en al e of hen y = f(x) for any given val ue of x when (x 0 , y 0 ), (x 1 , y 1 ),…(x n , y n ) are given. Note: Since in most of the cases the exact form of the function is not known. In such cases the function f(x) is replaced b y a simpler function or polynomials ϕ(x) which has the same values as f(x) have for the same values as f(x) have for x 0 , x 1 , x 2 ….,x n . Compiled & Prepared by: YASHOVERDHAN VYAS; Sir Padampat Singhania University, Udaipur; [email protected]

Upload: yashoverdhan-vyas

Post on 17-Jul-2016

29 views

Category:

Documents


1 download

DESCRIPTION

Numerical Analysis involves the methods of interpolation with unequal intervals given by Lagrange and Newton.

TRANSCRIPT

Page 1: Lagrange-Newton Interpolation Yashoverdhan

Interpolation The word interpolation denotes the methodThe word interpolation denotes the method of computing the value of the function

f( ) for an gi en al e of heny = f(x) for any given value of x when (x0, y0), (x1, y1),…(xn, yn) are given. Note: Since in most of the cases the exact form of the function is not known. In such cases the function f(x) is replaced by a simpler ( ) p y pfunction or polynomials ϕ(x) which has the same values as f(x) have forthe same values as f(x) have for x0, x1, x2….,xn. Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 2: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 3: Lagrange-Newton Interpolation Yashoverdhan

Interpolation with unequal intervalsInterpolation with unequal intervalsIf x0, x1,…,xn are unequally spaced then, , , q y pwe use the following two interpolation formulae :formulae :

1. Lagrange’s Interpolation formula 2 N t ’ Di id d diff f l 2. Newton’s Divided difference formula.One advantage of these formulas is that they can also be used in case of equal intervals but the formulae for equal intervals qcannot be used in case of unequal intervals. Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 4: Lagrange-Newton Interpolation Yashoverdhan

i) Lagranges formula for unequali) Lagranges formula for unequal intervals: If f( ) t k th lIf y = f(x) takes the values y0, y1, y2,….,yn corresponding to x = x0, x1, x2,…,xn then

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 5: Lagrange-Newton Interpolation Yashoverdhan

)x(f)xx)...(xx()xx()x(f 0n21 −−−

= )x(f)xx)...(xx()xx(

)x(f 0n02010 −−−

)xx) (xx()xx()xx( −−−−)x(f

)xx)...(xx()xx()xx()xx)...(xx()xx()xx(

1n1312101

n320

−−−−+

0 1 3 n2

(x x ) (x x ) (x x )...(x x ) f (x )(x x ) (x x ) (x x ) (x x )

− − − −+

2 0 2 1 2 3 2 n(x x ) (x x ) (x x )...(x x )....

− − − −+

)x(f)xx) (xx()xx()xx(

)xx)...(xx()xx()xx(n

1210

1n210 −

−−−−−−−−

+ )xx)...(xx()xx()xx( 1nn2n1n0n −

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 6: Lagrange-Newton Interpolation Yashoverdhan

is known as the Lagrange's interpolationis known as the Lagrange's interpolation formula. Ex.1. Find u5 by Lagrange’s Method if

1 19 49 181 u0 =1, u3 = 19, u4 = 49, u6 = 181.Solution:

x 0 3 4 6u 1 19 49 181

Solution:

At x = 5, u is given by u 1 19 49 181

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 7: Lagrange-Newton Interpolation Yashoverdhan

(5 3) (5-4)(5-6)u ( 1)−=u ( 1)

(0-3)(0-4)(0-6)=

(5 0)(5 4)(5 6)(5-0)(5-4)(5-6) (19) (3 0)(3 4)(3 6)

+− − −

( )( )( )

(5-0)(5-3)(5-6) ( 49)+ ( 49) (4 0)(4 3)(4 6)

+− − −

(5-0)(5-3)(5-4)(5-0)(5-3)(5-4) (181)(6 0)(6 3)(6 4)

+− − −

101=Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 8: Lagrange-Newton Interpolation Yashoverdhan

Example-2 Prove that Lagrange’s formula for polynomial approximation Pn (x) of (n+1) pointspoints (xi, yi = f(xi)) i = 0, 1, 2, …, n can be expressed in the form:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 9: Lagrange-Newton Interpolation Yashoverdhan

2

2

( ) 1( ) 1

L L nn

n

P x x x xf 2

0 0 0 02

( ) 10( ) 1 =

L L

L L

n

nf x x x xf x x x x1 1 1 1 0( ) 1 =L L

L L L L L L L

f x x x x

2( ) 1 L L nn n n nf x x x x

And also verify this result for n = 2. Apartial solution of Ex 2 is as follows :A partial solution of Ex-2 is as follows : Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 10: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 11: Lagrange-Newton Interpolation Yashoverdhan

Ex 3 If y(1) = 3 y(3) = 9 y(4) =30Ex.3. If y(1) = -3, y(3) = 9, y(4) =30, y(6) = 132 then find the Lagranges i l i l i l h k hinterpolating polynomial that takes the same values as y at the given points.y g pGiven:

x 1 3 4 6x 1 3 4 6y -3 9 30 132

Solution:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 12: Lagrange-Newton Interpolation Yashoverdhan

(x 3) (x 4) (x 6)f ( ) ( 3)− − −( ) ( ) ( )f (x) . ( 3)(1 3)(1 4)(1 6)

= −− − −

( 1)( 4)( 6) (x 1)(x 4)(x 6) .9(3 1)(3 4)(3 6)

− − −+

− − −

(3 1)(3 4)(3 6)(x 1)(x 3)(x 6) .30− − −

+ .30(4 1)(4 3)(4 6)

+− − −

(x 1)(x 3)(x 4)− − − (x 1)(x 3)(x 4) .132(6 1)(6 3)(6 4)

+− − −

3 2 = x3 - 3x2 + 5x - 6 Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 13: Lagrange-Newton Interpolation Yashoverdhan

Try thisTry this Q.1 Using Lagranges interpolation formula find a polynomial which passes through the points (0, -12), (1, 0) (3, 6). g p ( , ), ( , ) ( , )(4, 12) Answer: x3 7x2 +18x 12Answer: x - 7x +18x - 12

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 14: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 15: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 16: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 17: Lagrange-Newton Interpolation Yashoverdhan

To calculate the error from (7), the function y(x) and its (n+1) thderivative must be known. The point of interpolation x’ is used in place of x to determine the error at x’.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 18: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 19: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 20: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 21: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 22: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 23: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 24: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 25: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 26: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 27: Lagrange-Newton Interpolation Yashoverdhan

21

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 28: Lagrange-Newton Interpolation Yashoverdhan

× 2× 2

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 29: Lagrange-Newton Interpolation Yashoverdhan

× 5× 5

× 7

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 30: Lagrange-Newton Interpolation Yashoverdhan

ii) i i iff (∆ )ii) Divided differences (∆d)1 0y yf ( ) [ ]−

∆ ∆ 1 0d 0 d 0 0 1

1 0

y yf (x ) y [x , x ]x x

∆ = ∆ = =−

2 1d 1 2 1

y yy [x ,x ]x x

−∆ = =

2 1x x

n n 1y yy [x x ]−−∆ = =d n 1 n 1 n

n n 1

y [x ,x ]x x− −

∆ = =−

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 31: Lagrange-Newton Interpolation Yashoverdhan

S d Di id d DiffSecond Divided Difference2 2 d 1 d 0y yf (x ) y ∆ − ∆

∆ ∆ d 1 d 0d 0 d 0

2 0

f (x ) yx x

∆ = ∆ =−

][]x,x[]x,x[ 0112 −

]x,x,x[xx

],[],[210

02

0112 =−

=

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 32: Lagrange-Newton Interpolation Yashoverdhan

ly 2 d 2 d 1d 1

y y|| y ∆ − ∆∆ =

3 1

3 2 2 1

x x[x ,x ] [x , x ]

−−3 2 2 1

3 1

[x ,x ] [x , x ]x x

=−

1 2 3[x , x , x ]=i il l 3 b d fi d∆similarly 3

d 0y ,.... can be defined∆

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 33: Lagrange-Newton Interpolation Yashoverdhan

Divided Difference Table x y ∆d y ∆d

2y ∆d3y ∆d

4yx0 y00 y0

∆dy0

x y ∆ 2y

1 0

1 0

y yx x

−=

−d 1 d 0y y∆ − ∆

=x1 y1 ∆d y0

∆dy1 ∆d3y0

∆ 2 ∆ 4

2 1

2 1

y yx x

−=

2 0x x=

d 2 d 1y y∆ − ∆

2 2d 1 d 0

3 0

y yx x

∆ − ∆=

−x2 y2 ∆d

2y1 ∆d4y0

∆dy2 ∆d3y1

3 2

3 2

y yx x

−=

d 2 d 1

3 1

y yx x

=−

y y∆ ∆

2 2d 2 d 1

4 1

y yx x

∆ − ∆=

x3 y3 ∆d2y2

∆dy34 3

4 3

y yx x

−=

d 3 d 2

4 2

y yx x

∆ − ∆=

x4 y4

4 3

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 34: Lagrange-Newton Interpolation Yashoverdhan

In general m 1 m 1

m d k 1 d ky yy− −

+∆ −∆∆ d d

d kk m k

yx x+

∆ =−k m k+

Provided all the involvedProvided all the involved quantities exist. Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 35: Lagrange-Newton Interpolation Yashoverdhan

Newton's divided difference interpolation formulainterpolation formula

0 0 d 0y f(x) y (x x ) y= = + − ∆ 0 0 d 0

20 1 d 0(x x ) (x x ) y+ − − ∆

30 1 2 d 0(x x ) (x x )(x x ) y+ − − − ∆

n0 1 n 1 d 0... (x x ) (x x ) ...(x x ) y−+ + − − − ∆

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 36: Lagrange-Newton Interpolation Yashoverdhan

Ex.1 Given the valuesEx.1 Given the values x : 5 7 11 13 17f( ) 150 392 1452 2366 5202f(x) : 150 392 1452 2366 5202

Evaluate f(9) usingEvaluate f(9) using (i) Lagrange's formula (ii) N ' di id d diff f l(ii) Newton's divided difference formula.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 37: Lagrange-Newton Interpolation Yashoverdhan

i) Lagranges formulai) Lagranges formulaf (9)

(9 7) (9 11) (9 13) (9 17) (150)(5 7) (5 11) (5 13) (5 17)

− − − −=

− − − −(5 7) (5 11) (5 13) (5 17)− − − −(9 5) (9 11) (9 13) (9 17) (392)− − − −

+ (392)(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)(11 5) (11 7) (11 13) (11 17)

− − − −+

− − − −(11 5) (11 7) (11 13) (11 17)Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 38: Lagrange-Newton Interpolation Yashoverdhan

(9 5) (9 7) (9 11) (9 17)(9 5) (9 7) (9 11) (9 17) (2366)(13 5)(13 7)(13 11)(13 17)

− − − −+

− − − −( ) ( )( )( )(9 5) (9 7) (9 11) (9 13) (5202)− − − −

+ ( )(17 5)(17 7)(17 11)(17 13)− − − −

∴ f (9) = 810 ∴ f (9) 810

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 39: Lagrange-Newton Interpolation Yashoverdhan

ii) Newton Divided Difference formula)x y ∆d ∆d

2 ∆d3 ∆d

4

5 1505 150121

7 392 247 392 24265 1

11 1452 32 0457 1

13 2366 42709

17 5202Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 40: Lagrange-Newton Interpolation Yashoverdhan

f(9) 1 0 121 (9 )f(9) = 150 + 121 (9 - 5) + 24 (9 - 5) (9 - 7) ( ) ( ) + 1(9 - 5) (9 - 7) (9 - 11) = 810 Ex 2 Using i) Lagrange’s interpolationEx.2. Using i) Lagrange s interpolation and ii) divided difference formula. Find h l f h 10the value of y when x = 10.

x : 5 6 9 11x : 5 6 9 11y : 12 13 14 16

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 41: Lagrange-Newton Interpolation Yashoverdhan

Lagranges formula: (10 6) (10 9) (10 11)y f (10) 12

(5 6) (5 9) (5 11)− − −

= = ×− − −

(5 6) (5 9) (5 11)− − −(10 5)(10 9)(10 11) 13− − −

+ × 13(6 5)(6 9)(6 11)

+ ×− − −

(10 5)(10 6)(10 11) (10 5)(10 6)(10 11) 14(9 5)(9 6)(9 11)

− − −+ ×

− − −

( )( )( )(10 5)(10 6)(10 9) 16(11 5)(11 6)(11 9)

− − −+ ×

(11 5)(11 6)(11 9)− − −Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 42: Lagrange-Newton Interpolation Yashoverdhan

Divided difference

d d d

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 43: Lagrange-Newton Interpolation Yashoverdhan

f (10)1⎛ ⎞112 (10 5) (10 5)(10 6).6

⎛ ⎞= + − + − − −⎜ ⎟⎝ ⎠

1(10 5)(10 6)(10 9)

⎝ ⎠⎛ ⎞+ − − − ⎜ ⎟(10 5)(10 6)(10 9)

20+ ⎜ ⎟

⎝ ⎠44 344

=

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 44: Lagrange-Newton Interpolation Yashoverdhan

Ex 3 Find the interpolating polynomialEx.3. Find the interpolating polynomial using Newton divided difference formula for the following data:

x 0 1 2 5x 0 1 2 5y 2 3 12 147

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 45: Lagrange-Newton Interpolation Yashoverdhan

x y ∆d ∆d2 ∆d

3

0 21

1 3 49 19 1

2 12 94545

5 147

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 46: Lagrange-Newton Interpolation Yashoverdhan

f(x)=2+(x-0)(1)+(x-0)(x-1)(4)f(x) 2 (x 0)(1) (x 0) (x 1) (4) + (x - 0) (x - 1) (x - 2) 1

3 2 = x3 + x2-x + 2

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 47: Lagrange-Newton Interpolation Yashoverdhan

Ex.4. Find f(4) given f(0) = -4, f(2) = 2, f(3) =14 and f(6) = 158

The divided difference table is The divided difference table is x y ∆d ∆d

2 ∆d3

0 -43

2 2 312 1

3 14 948

6 158Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 48: Lagrange-Newton Interpolation Yashoverdhan

∴ f(4)= -4 + (4 ) (3)+ (4) (2) (3)

+(4) (2) (1) (1) = 40 +(4) (2) (1) (1) = 40

Ex.5. Fit an interpolating polynomial forEx.5. Fit an interpolating polynomial for u4 = 48, u5 = 100, u6 = 180 , u8 = 448, u10 =900 and u11 = 1210

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 49: Lagrange-Newton Interpolation Yashoverdhan

x y ∆d ∆d2 ∆d

3 ∆d4

4 4852

5 100 1480 1

6 180 18 0134 1

8 448 23 0226 1226 1

10 900 28310310

11 1210Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 50: Lagrange-Newton Interpolation Yashoverdhan

By applying Newton’s Divided diff f l tdifference formulae, we get

48 + ( 4) 52 + ( 4) ( 5) 14∴ y = 48 + (x -4) 52 + (x-4) (x-5) 14 + (x 4) (x 5) (x 6) = x3 x2 + (x-4) (x-5) (x -6) = x - x

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 51: Lagrange-Newton Interpolation Yashoverdhan

E l 6 Gi th f ll i t blExample 6. Given the following table, find f(x) as a polynomial in powers of ( 5)(x – 5)

0 2 3 4 7 9x: 0 2 3 4 7 9f(x): 4 26 58 112 466 922. Sol. The divided difference table is:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 52: Lagrange-Newton Interpolation Yashoverdhan

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 53: Lagrange-Newton Interpolation Yashoverdhan

By Newton’s divided difference formulaBy Newton’s divided difference formula, we get gf(x) = 4 + (x – 0)(11) + (x – 0)(x – 2)7 + ( 0)( 2)( 3) 1(x – 0)(x – 2)(x – 3) 1= x3 + 2x2 + 3x + 4 x 2x 3x 4In order to express it in power of (x – 5), we use synthetic division, as:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 54: Lagrange-Newton Interpolation Yashoverdhan

∴ 2x2 + x3 + 3x + 4

= (x – 5)3 + 17(x – 5)2 + 98 (x – 5) + 194. Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 55: Lagrange-Newton Interpolation Yashoverdhan

Example 7. Calculate the approximateExample 7. Calculate the approximate

value of mode of a certain frequency

Curve y = f (x). The values of frequency

density f(x) for x = 8.9, 9.0 and 9.3 are

respectively equal to 0 30 0 35 and 0 25respectively equal to 0.30, 0.35 and 0.25.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 56: Lagrange-Newton Interpolation Yashoverdhan

The divided difference table for given f d i i f llfrequency density is as follows:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 57: Lagrange-Newton Interpolation Yashoverdhan

Applying Newton’s divided difference formulaApplying Newton s divided difference formula100 f(x)

50 3500⎛ ⎞= 30 + (x – 8.9)× 509

+ (x – 8.9) (x – 9) 350036

⎛ ⎞−⎜ ⎟⎝ ⎠

= – 97. 222x2 + 1745.833x – 1759.7217 ∴ f(x) = – 0 9722x2 + 17 45833x – 17 597217∴ f(x) 0.9722x2 + 17.45833x 17.597217f ' (x) = – 1.9444x + 17.45833 Putting f ' (x) 0 we getPutting f ' (x) = 0, we get

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 58: Lagrange-Newton Interpolation Yashoverdhan

17.45833x = 17.45833 8.97881.9444

=

Also, f '' (x) = – 1.9444 i.e., (–) ve ∴ f(x) is maximum at x = 8.9788( ) Hence mode is 8 9788Hence, mode is 8.9788.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 59: Lagrange-Newton Interpolation Yashoverdhan

Example 7. Apply the Newton divided difference formula for inverse interpolation to find the real root of ( ) 0=f x , where ( )f

3( ) 2 5= − −f x x x by considering the values of ( )f x at x = 1.9, 2, 2.1, 2.2.

Solution: The values of f(x) at ( )x = 1.9, 2, 2.1, 2.2 are

1 941 1 000 0 061 1 248 respectively– 1.941, – 1.000, 0.061, 1.248, respectively.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 60: Lagrange-Newton Interpolation Yashoverdhan

To find the root we change some notations To find the root, we change some notations as follows: x: – 1.941 – 1.000 0.061 1.248 ux: 1.9 2.0 2.1 2.2 So we have to find ux at x = 0. The divided difference table is:

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 61: Lagrange-Newton Interpolation Yashoverdhan

x ux ∆dux ∆d2ux ∆d

3ux x ux ∆dux ∆d ux ∆d ux

-1.941 1.9 0.1062699

1 000 2 0 0 0060035-1.000 2.0 -0.0060035 0.0942507 0.0004869

0.061 2.1 -0.0044505 0.0842459

1.248 2.21.248 2.2 Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 62: Lagrange-Newton Interpolation Yashoverdhan

Applying the Newton-divided difference Applying the Newton divided difference formula, u = 1 9 + (x + 1 941) × 0 1062699ux = 1.9 + (x + 1.941) × 0.1062699 + (x + 1.941)(x + 1)(– 0.0060035) + (x + 1.941)(x + 1)(x – 0.061) × 0.0004869.For x = 0 u0 = 1.9 + 0.2062698 – 0.0116527

– 0 0000576 = 2 0945595 0.0000576 2.0945595∴ The required root is 2.0945595.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 63: Lagrange-Newton Interpolation Yashoverdhan

Try this. Question. Apply the Newton divided

difference formula for inverse interpolationdifference formula for inverse interpolation

to find the real root of ( ) 0=f x , where ( )f

3( ) 3= + −f x x x by considering the values

of ( )f x at x = 1.1, 1.2, 1.3, 1.4.

Ans. 1.2134 approx.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 64: Lagrange-Newton Interpolation Yashoverdhan

Example 8 The following are the mean Example 8. The following are the mean temperatures (°F) on three days, 30 days apart round the periods of summer andapart round the periods of summer and winter. Estimate the approx. dates and values of max and min temperaturevalues of max. and min. temperature.

Summer Winter Day Date Temp. Date Temp.

0 15-Jun. 58.8 16-Dec. 40.730 15-July 63.4 15-Jan. 38.1 60 14-Aug 62 5 14-Feb 39 360 14-Aug. 62.5 14-Feb. 39.3

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 65: Lagrange-Newton Interpolation Yashoverdhan

Solution: The divided difference table forSolution: The divided difference table for summer is:

x f(x) ∆df(x) ∆d2f(x)

0 58.8 4.6

1 63.4 -2.7

0 9 -0.9 2 62.5

Compiled & Prepared by: Y

ASHOVERDHAN VYAS; Sir P

adampat Singhania University

, Udaipur; y

[email protected]

Page 66: Lagrange-Newton Interpolation Yashoverdhan

∴ f(x) = 58 8 + (x 0)(4 6) + (x 0)(x 1)( 2 75) ∴ f(x) 58.8 + (x – 0)(4.6) + (x – 0)(x – 1)(– 2.75) = – 2.75 x2 + 7.35 x + 58.8 F i d i i f f( ) h For maximum and minimum of f(x), we have f ' (x) = 0

5 5 7 35 0 1 342 ⇒ – 5.5 x + 7.35 = 0 ⇒ x = 1.342 Again, f “ (x) = – 5.5 < 0 ∴ f(x) is maximum at x = 1.342 Since unit 1 = 30 days ∴ 1.342 = 30 × 1.342 = 40.26 days ∴ The maximum temperature was on p

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 67: Lagrange-Newton Interpolation Yashoverdhan

15 J + 40 d i 25 J l d 15 June + 40 days, i.e., on 25 July, and the value of the maximum temperature is [f( )] [f( )] 63 711°F i t l [f(x)]max. = [f(x)]1.342 = 63.711 F. approximately. …… N t T th i i t f th l ti Note: Try the remaining part of the solution yourself.

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 68: Lagrange-Newton Interpolation Yashoverdhan

LAGRANGE Interpolation Formula1. Read n, x2. for i =1 to (n) in steps of 1 do ( )3. Read xi, fi end for4 sum ← 04. sum ← 05. for i =1 to (n) in steps of 1 do6. prodfunc ← 17. for j =1 to (n) in steps of 1 do

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]

Page 69: Lagrange-Newton Interpolation Yashoverdhan

8. if ( j ≠ i ) then9. prodfunc ← prodfunc×(x − xj )/ (xi − xj )

endfor10.sum ← sum + (fi × prodfunc)

endforendfor11.Write x, sum12 STOP12.STOP

Compiled & Prepared by: YASHOVERDHAN VYAS; S

ir Padampat S

inghania University, U

daipur; [email protected]