Professional Documents
Culture Documents
Lagrange Method of Interpolation - More Examples Industrial Engineering
Lagrange Method of Interpolation - More Examples Industrial Engineering
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
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
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
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 )
f2(x)
(x0, y0)
x
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
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)
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 x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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
Figure 7 Plot of the cam profile as defined by a 6th order interpolating polynomial (using
Lagrangian method of interpolation).