Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Chapter 05.

04
Lagrange Method of Interpolation More Examples
Industrial Engineering
Example 1
The geometry of a cam is given in Figure 1. A curve needs to be fit through the seven points
given in Table 1 to fabricate the cam.

4 3
5 2
6
y 1
7 x

Figure 1 Schematic of cam profile.

Table 1 Geometry of the cam.


Point x in. y in.
1 2.20 0.00
2 1.28 0.88
3 0.66 1.14
4 0.00 1.20
5 0.60 1.04
6 1.04 0.60
7 1.20 0.00

If the cam follows a straight line profile from x 1.28 to x 0.66 , what is the value of y at
x 1.10 using a first order Lagrange polynomial?

05.04.1
05.04.2 Chapter 05.04

Solution
For first order Lagrange polynomial interpolation (also called linear interpolation), the value
of y is given by
1
y ( x) Li ( x) y ( xi )
i 0

L0 ( x) y ( x0 ) L1 ( x) y ( x1 )

(x1, y1)

f1(x)

(x0, y0)
x

Figure 2 Linear interpolation.

Since we want to find the value of y at x 1.10 , using the two points x0 1.28 and
x1 0.66 , then
x0 1.28, y x 0 0.88
x1 0.66, y x1 1.14
gives
1 x xj
L0 ( x)
j 0 x0 x j
j 0

x x1

x0 x1
1 x xj
L1 ( x)
j 0 x1 x j
j 1

x x0

x1 x0
Hence
Lagrange Method of Interpolation-More Examples: Industrial Engineering 05.04.3

x x1 x x0
y ( x) y ( x0 ) y ( x1 )
x 0 x1 x1 x0
x 0.66 x 1.28
(0.88) (1.14), 0.66 x 1.28
1.28 0.66 0.66 1.28
1.10 0.66 1.10 1.28
y (1.10) (0.88) (1.14)
1.28 0.66 0.66 1.28
0.70968(0.88) 0.29032(1.14)
0.95548 in.
You can see that L0 ( x) 0.70968 and L1 ( x) 0.29032 are like weightages given to the
values of y at x 1.28 and x 0.66 to calculate the value of y at x 1.10 .

Example 2
The geometry of a cam is given in Figure 3. A curve needs to be fit through the seven points
given in Table 2 to fabricate the cam.

4 3
5 2
6
y 1
7 x

Figure 3 Schematic of cam profile.

Table 2 Geometry of the cam.


Point x in. y in.
1 2.20 0.00
2 1.28 0.88
3 0.66 1.14
4 0.00 1.20
5 0.60 1.04
6 1.04 0.60
7 1.20 0.00
If the cam follows a quadratic profile from x 2.20 to x 1.28 to x 0.66 , what is the
value of y at x 1.10 using a second order Lagrange polynomial? Find the absolute relative
approximate error for the second order polynomial approximation.
05.04.4 Chapter 05.04

Solution
For second order Lagrange polynomial interpolation (also called quadratic interpolation), the
value of y given by
2
y ( x) Li ( x) y ( xi )
i 0

L0 ( x) y ( x 0 ) L1 ( x) y ( x1 ) L2 ( x) y ( x 2 )

(x1, y1) (x2, y2)

f2(x)

(x0, y0)
x

Figure 4 Quadratic interpolation.

Since we want to find the value of y at x 1.10 , using the three points x0 2.20 ,
x1 1.28 , x 2 0.66 , then
x0 2.20, y x0 0.00
x1 1.28, y x1 0.88
x 2 0.66, y x 2 1.14
gives
2 x xj
L0 ( x)
j 0 x 0 x j
j 0

x x1 x x 2

x 0 x1 x0 x 2
2 x xj
L1 ( x)
j 0 x1 x j
j 1

x x0 x x 2

x1 x0 x1 x 2
Lagrange Method of Interpolation-More Examples: Industrial Engineering 05.04.5

2 x xj
L2 ( x )
j 0 x2 x j
j2

x x0 x x1

x 2 x0 x 2 x1
Hence
x x1 x x 2 x x0 x x 2 x x0 x x1
y ( x) y ( x0 ) y ( x1 ) y ( x 2 ),
x0 x1 x0 x 2 x1 x 0 x1 x 2 x 2 x0 x 2 x1
x0 x x 2
(1.10 1.28)(1.10 0.66) (1.10 2.20)(1.10 0.66)
y (1.10) (0.00) (0.88)
(2.20 1.28)(2.20 0.66) (1.28 2.20)(1.28 0.66)
(1.10 2.20)(1.10 1.28)
(1.14)
(0.66 2.20)(0.66 1.28)
(0.055901)(0.00) (0.84853)(0.88) (0.20737)(1.14)
0.98311 in.
The absolute relative approximate error a obtained between the results from the first and
second order polynomial is
0.98311 0.95548
a 100
0.98311
2.8100%

Example 3
The geometry of a cam is given in Figure 5. A curve needs to be fit through the seven points
given in Table 3 to fabricate the cam.

4 3
5 2
6
y 1
7 x

Figure 5 Schematic of cam profile.


05.04.6 Chapter 05.04

Table 3 Geometry of the cam.


Point x in. y in.
1 2.20 0.00
2 1.28 0.88
3 0.66 1.14
4 0.00 1.20
5 0.60 1.04
6 1.04 0.60
7 1.20 0.00

Find the cam profile using all seven points in Table 3 and a sixth order Lagrange polynomial.

Solution
For the sixth order polynomial, we choose the value of y given by
6
y ( x) Li ( x) y ( xi )
i 0

L0 ( x) y ( x0 ) L1 ( x) y ( x1 ) L2 ( x) y ( x 2 ) L3 ( x) y ( x3 )
L4 ( x) y ( x 4 ) L5 ( x) y ( x5 ) L6 ( x) y ( x 6 )

(x1, y1)

(x3, y3)
(x5, y5)
(x2, y2)

(x0, y0)
f6(x) (x6, y6)
(x4, y4)

Figure 6 6th order polynomial interpolation.

Using the seven points,


x0 2.20, y x0 0.00
x1 1.28, y x1 0.88
x 2 0.66, y x 2 1.14
Lagrange Method of Interpolation-More Examples: Industrial Engineering 05.04.7

x3 0.00, y x3 1.20
x4 .60, y x 4 1.04
x5 1.04, y x5 0.60
x6 1.20, y x6 0.00
gives
6 x xj
L0 ( x)
j 0 x0 x j
j 0

x x1 x x 2 x x3 x x 4 x x5 x x 6

x0 x1 x 0 x 2 x 0 x3 x0 x 4 x0 x5 x0 x 6
6 x xj
L1 ( x)
j 0 x1 x j
j 1

x x0 x x 2 x x3 x x 4 x x5 x x 6

x1 x0 x1 x 2 x1 x3 x1 x 4 x1 x5 x1 x 6
6 x xj
L2 ( x )
j 0 x 2 x j
j2

x x0 x x1 x x3 x x 4 x x5 x x6

x 2 x0 x 2 x1 x 2 x3 x 2 x 4 x 2 x5 x 2 x6
6 x xj
L3 ( x)
j 0 x3 x j
j 3

x x 0 x x1 x x 2 x x 4 x x5 x x6

x3 x 0 x3 x1 x3 x 2 x3 x 4 x3 x5 x3 x6
6 x xj
L4 ( x )
j 0 x 4 x j
j4

x x0 x x1 x x 2 x x3 x x5 x x6

x 4 x0 x 4 x1 x 4 x 2 x 4 x3 x 4 x5 x 4 x6
6 x xj
L5 ( x)
j 0 x5 x j
j 5

x x 0 x x1 x x 2 x x3 x x 4 x x6

x5 x 0 x5 x1 x5 x 2 x5 x3 x5 x 4 x5 x 6
6 x xj
L6 ( x)
j 0 x 6 x j
j 6
05.04.8 Chapter 05.04

x x0 x x1 x x 2 x x3 x x 4 x x5

x6 x0 x 6 x1 x6 x 2 x6 x3 x 6 x 4 x 6 x5

x x1 x x 2 x x3 x x 4 x x5 x x6
y ( x) y ( x0 )
x0 x1 x0 x 2 x 0 x3 x0 x 4 x0 x5 x0 x 6
x x0 x x 2 x x3 x x 4 x x5 x x 6
y ( x1 )
x1 x 0 x1 x 2 x1 x3 x1 x 4 x1 x5 x1 x6
x x0 x x1 x x3 x x 4 x x5 x x6
y ( x 2 )
x
2 x 0 2 x x1 2 x x 3 2 x x 4 2 x x 5 2 x x 6

x x0 x x1 x x 2 x x 4 x x5 x x6
y ( x3 )
x3 x0 x3 x1 x3 x 2 x3 x 4 x3 x5 x3 x6
x x0 x x1 x x 2 x x3 x x5 x x6
y ( x 4 )
x 4 x 0 x 4 x1 x 4 x 2 x 4 x3 x 4 x5 x 4 x 6
x x0 x x1 x x 2 x x3 x x 4 x x 6
y ( x5 )
x
5 x 0 5 x x1 5 x x 2 5 x x 3 5 x x 4 5 x x 6

x x0 x x1 x x 2 x x3 x x 4 x x5
y ( x6 )
x6 x0 x 6 x1 x6 x 2 x 6 x 3 x 6 x 4 x 6 x 5

( x 1.28)( x 0.66)( x 0.00)( x 0.60)( x 1.04)( x 1.20)


y ( x) (0.00)
(2.20 1.28)(2.20 0.66)(2.20 0.00)(2.20 0.60)(2.20 1.04)(2.20 1.20)
( x 2.20)( x 0.66)( x 0.00)( x 0.60)( x 1.04)( x 1.20)
(0.88)
(1.28 2.20)(1.28 0.66)(1.28 0.00)(1.28 0.60)(1.28 1.04)(1.28 1.20)
( x 2.20)( x 1.28)( x 0.00)( x 0.60)( x 1.04)( x 1.20)
(1.14)
(0.66 2.20)(0.66 1.28)(0.66 0.00)(0.66 0.60)(0.66 1.04)(0.66 1.20)
( x 2.20)( x 1.28)( x 0.66)( x 0.60)( x 1.04)( x 1.20)
(1.20)
(0.00 2.20)(0.00 1.28)(0.00 0.66)(0.00 0.60)(0.00 1.04)(0.00 1.20)
( x 2.20)( x 1.28)( x 0.66)( x 0.00)( x 1.04)( x 1.20)
(1.04)
(0.60 2.20)(0.60 1.28)(0.60 0.66)(0.60 0.00)(0.60 1.04)(0.60 1.20)
( x 2.20)( x 1.28)( x 0.66)( x 0.00)( x 0.60)( x 1.20)
(0.60)
(1.04 2.20)(1.04 1.28)(1.04 0.66)(1.04 0.00)(1.04 0.60)(1.04 1.20)
( x 2.20)( x 1.28)( x 0.66)( x 0.00)( x 0.60)( x 1.04)
(0.00)
(1.20 2.20)(1.20 1.28)(1.20 0.66)(1.20 0.00)(1.20 0.60)(1.20 1.04)
Lagrange Method of Interpolation-More Examples: Industrial Engineering 05.04.9

x 6 0.02 x 5 4.0784 x 4 2.5406 x 3 1.6220 x 2 1.0873x



8.9744
x 0.64 x 4.4752 x 0.27392 x 3 4.6932 x 2 2.1086 x
6 5 4

2.2023
x 1.3 x 4.0528 x 2.6797 x 3 4.8740 x 2 0.98892 x 1.3917
6 5 4

1.1597
x 1.9 x 2.9128 x 4.4274 x 3 2.2176 x 2 2.3195 x
6 5 4

1.0102
x 2.34 x 1.6192 x 4.3637 x 3 0.33581x 2 1.3382 x
6 5 4

1.5593

y ( x) 1.2 0.25112 x 0.27255 x 2 0.56765 x 3


0.072013 x 4 0.45241x 5 0.17103 x 6 , 1.20 x 2.20

Figure 7 Plot of the cam profile as defined by a 6th order interpolating polynomial (using
Lagrangian method of interpolation).

You might also like