0% found this document useful (0 votes)
507 views6 pages

15 Lagrange DividedDiff

The document discusses Lagrange interpolation and Newton's divided difference interpolation formulas for fitting polynomials to datasets with unequally spaced x-values. It provides the formulas for Lagrange and divided difference interpolation. Examples are given to demonstrate calculating interpolated y-values and constructing the divided difference table. The key steps of the Lagrange interpolation formula algorithm are also outlined.

Uploaded by

AbhishekJain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
507 views6 pages

15 Lagrange DividedDiff

The document discusses Lagrange interpolation and Newton's divided difference interpolation formulas for fitting polynomials to datasets with unequally spaced x-values. It provides the formulas for Lagrange and divided difference interpolation. Examples are given to demonstrate calculating interpolated y-values and constructing the divided difference table. The key steps of the Lagrange interpolation formula algorithm are also outlined.

Uploaded by

AbhishekJain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Interpolation with unequal intervals

Newton
backward
and
forward
interpolation is applicable only when x0,
x1,,xn are equally spaced.
Now we use two interpolation formulae
for unequally spaced values of x.

f ( x) =

(x x1 ) (x x 2 )...(x x n )
f (x 0 )
(x 0 x1 ) (x 0 x 2 )...(x 0 x n )

(x x 0 ) (x x 2 ) (x x 3 )...(x x n )
f ( x1 )
(x1 x 0 ) (x1 x 2 ) (x1 x 3 )...( x1 x n )

(x x 0 ) (x x1 ) (x x3 )...(x x n )
f (x 2 )
(x 2 x 0 ) (x 2 x1 ) (x 2 x3 )...(x 2 x n )

i) Lagranges formula for unequal


intervals:
If y = f(x) takes the values
y0, y1, y2,.,yn corresponding to
x = x0, x1, x2,,xn then

is known as the Lagrange's interpolation


formula.

Ex.1. Find u5 by Lagranges Method if


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

+....
+

( x x 0 ) (x x1 ) ( x x 2 )...(x x n 1 )
f (x n )
(x n x 0 ) ( x n x1 ) ( x n x 2 )...(x n x n 1 )

(5 3) (5-4)(5-6)
( 1)
(0-3)(0-4)(0-6)
(5-0)(5-4)(5-6)
+
(19)
(3 0)(3 4)(3 6)
(5-0)(5-3)(5-6)
+
( 49)
(4 0)(4 3)(4 6)
(5-0)(5-3)(5-4)
+
(181)
(6 0)(6 3)(6 4)
= 101

u=

0
1

3
19

4
49

6
181

At x = 5, u is given by

Ex.2. If y(1) = -3, y(3) = 9, y(4) =30,


y(6) = 132 then find the Lagranges
interpolating polynomial that takes the
same values as y at the given points.
Given:
x
y

1
-3

3
9

4
30

6
132

Solution:

f (x) =

(x 3) (x 4) (x 6)
. (3)
(1 3)(1 4)(1 6)
(x 1)(x 4)(x 6)
+
.9
(3 1)(3 4)(3 6)
(x 1)(x 3)(x 6)
+
.30
(4 1)(4 3)(4 6)
(x 1)(x 3)(x 4)
+
.132
(6 1)(6 3)(6 4)
= x3 - 3x2 + 5x - 6

ii) Divided differences (d)


y y
d f (x 0 ) = d y0 = 1 0 = [x 0 , x1 ]
x1 x 0
y y
d y1 = 2 1 = [x 2 , x1 ]
x 2 x1
y y
d yn 1 = n n 1 = [x n 1 , x n ]
x n x n 1

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

Second Divided Difference


y d y0
d 2f (x 0 ) = d 2 y0 = d 1
x 2 x0
=

[ x 2 , x 1 ] [ x1 , x 0 ]
= [ x 0 , x1 , x 2 ]
x2 x0

Divided Difference Table

y d y1
|| d y1 = d 2
x3 x1
ly

[x3 , x 2 ] [x 2 , x1 ]
x3 x1

= [x1 , x 2 , x3 ]
similarly d3 y0 ,.... can be defined

x y d y
x0 y0

d2y
y1 y 0
1 x0

dy0= x
x1 y1
x2 y2
x3 y3

y 2 y1
dy1= x2 x1
y3 y2
dy2= x 3 x2
y4 y3
dy3= x4 x3

d2y0=
d2y=1
d2y=2

d3y

d y1 d y 0
x 2 x0
d y 2 d y1
x 3 x1
dy3 dy2
x4 x2

d4y

d3y0=

d2 y 1 d2 y 0
x3 x0

d3y=1

d2 y 2 d2 y 1
x 4 x1

d4y0

x4 y4

In general
m1
m1

y
dmyk = d k+1 d k
xk+m xk

Provided all the involved


quantities exist.

Ex.1
x:
f(x) :

7
392

11
1452

+(x x0 ) (x x1) d2 y0
+ (x x0 ) (x x1)(x x2 ) d3y0
+... + (x x0 ) (x x1) ...(x xn1) dn y0

i) Lagranges formula
f (9)

Given the values


5
150

Newton's
divided
difference
interpolation formula
y = f(x) = y0 + (x x0 ) d y0

13
2366

17
5202

Evaluate f(9) using


(i) Lagrange's formula
(ii) Newton's divided difference formula.

(9 7) (9 11) (9 13) (9 17)


(150)
(5 7) (5 11) (5 13) (5 17)
(9 5) (9 11) (9 13) (9 17)
(392)
+
(7 5) (7 11) (7 13) (7 17)
(9 5) (9 7) (9 13) (9 17)
(1452)
+
(11 5) (11 7) (11 13) (11 17)

ii) Newton Divided Difference formula

(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
+

x
5

y
150

392

d2

d3 d4

121
24
265
11

1452

1
32

457
13

2366

17

5202

0
1

42
709

f(9) = 150 + 121 (9 - 5)


+ 24 (9 - 5) (9 - 7)
+ 1(9 - 5) (9 - 7) (9 - 11) = 810
Ex.2. Using i) Lagranges interpolation
and ii) divided difference formula. Find
the value of y when x = 10.
x:
y:

5
12

6
13

9
14

11
16

Lagranges formula:
(10 6) (10 9) (10 11)
y = f (10) =
12
(5 6) (5 9) (5 11)
(10 5)(10 9)(10 11)
+
13
(6 5)(6 9)(6 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)

Divided difference

f (10)
d

Ex.3. Find the interpolating polynomial


using Newton divided difference
formula for the following data:
x
0
1
2
5
y
2
3
12
147

1
= 12 + (10 5) + (10 5)(10 6).
6
1
+ (10 5)(10 6)(10 9)
20
44
=
3

x
0

y
2

d2

d3

1
4
9
2

12

147

1
9

45

Ex.4. Find f(4) given f(0) = -4, f(2) =


2, f(3) =14 and f(6) = 158
The divided difference table is

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


+ (x - 0) (x - 1) (x - 2) 1
3
2
=x +x - x +2

x
0

y
-4

14

d2

d3

3
3
12

1
9

48
6

158

x
4

y
48

100

Ex.5. Fit an interpolating polynomial for


u4 = 48, u5 = 100, u6 = 180 ,

180

u8 = 448, u10 =900 and u11 = 1210

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


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

d2

d3

d4

52
14
80

1
18

134
448

23
226

10

0
1

900

0
1

28
310

11

By applying Newtons Divided


difference formulae, we get

y = 48 + (x -4) 52 + (x-4) (x-5) 14


+ (x-4) (x-5) (x -6) = x3- x2

1210

LAGRANGE Interpolation Formula


1.
2.
3.
4.
5.
6.
7.

Read n, x
for i =1 to (n+1) in steps of 1 do
Read xi, fi
end for
sum 0
for i =1 to (n+1) in steps of 1 do
prodfunc 1
for j =1 to (n+1) in steps of 1 do

8.
if ( j i ) then
9. proffunc prodfunc(x xj )/ (xi xj )
endfor
10. sum sum + (fi prodfunc)
endfor
11. Write x, sum
12. STOP

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy