2. Outlines
1 Introduction to Interpolation
2 Lagrange Interpolation
Linear Interpolation
Quadratic Interpolation
Polynomial Interpolation
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 2 / 9
3. Introduction to Interpolation
⇒ Interpolation means to find values of a function f (x) for an x
between different x− values x0, x1, ....., xn at which the values of f (x)
are given. Mathematically
f0 = f (x0), f1 = f (x1), .... fn = f (xn)
⇒ x → Input and f (x) → Output
⇒ Let x0 < x1 < ... < xn and xp be the unknown input for which
f (xp) =??
⇒ When, x0 < xp < xn → Interpolation
⇒ When, xp > xn → Extrapolation
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 3 / 9
4. Lagrange Interpolation
⇒ Given (x0, f0), ...., (xn, fn) with arbitrary spaced xj
⇒ Linear interpolation is interpolation by the straight line through
(x0, f0) and (x1, f1).
⇒ Thus the linear Lagrange polynomial p1 is a sum p1 = L0f0 + L1f1.
L0(x) =
x − x1
x0 − x1
, L1(x) =
x − x0
x1 − x0
p1(x) = L0(x)f0 + L1(x)f1 =
x − x1
x0 − x1
f0 +
x − x0
x1 − x0
f1
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 4 / 9
5. Example
Q Compute ln 9.2, where ln 9.0 = 2.1972 and ln 9.5 = 2.2513 by linear
Lagrange interpolation and determine the error from ln 9.2 = 2.2192
Ans According to question
x0 = 9.0, x1 = 9.5, f0 = ln 9.0, f1 = ln 9.5
We will find the weight L0(x) and L1(x), where
L0(9.2) =
9.2 − 9.5
9.0 − 9.5
= 0.6, L1(9.2) =
9.2 − 9.0
9.5 − 9.0
= 0.4
or
ln 9.2 ≈ L0(9.2)f0 + L1(9.2)f1 = 0.6 × 2.1972 + 0.4 × 2.2513 = 2.2188
The error is = a − ā = 2.2192 − 2.2188 = 0.0004
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 5 / 9
6. Lagrange Quadratic Lagrange Interpolation
⇒ Quadratic interpolation is interpolation of given (x0, f0), (x1, f1),
(x2, f2) by a second degree polynomial which by Lagranges idea is
p2(x) = L0(x)f0 + L1(x)f1 + L2(x)f2
with L0(x0) = 1, L1(x1) = 1, L2(x2) = 1, and L0(x1) = L0(x2) = 0
L0(x) =
l0(x)
l(x0)
=
(x − x1)(x − x2)
(x0 − x1)(x0 − x2)
L1(x) =
l1(x)
l(x1)
=
(x − x0)(x − x2)
(x1 − x0)(x1 − x2)
L2(x) =
l2(x)
l(x2)
=
(x − x0)(x − x1)
(x2 − x0)(x2 − x1)
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 6 / 9
7. Example
Q Compute ln 9.2, where ln 9.0 = 2.1972, ln 9.5 = 2.2513, and
ln 11 = 2.3979 by quadratic Lagrange interpolation and determine the
error from ln 9.2 = 2.2192
Ans According to question
x0 = 9.0, x1 = 9.5, x2 = 11, f0 = ln 9.0, f1 = ln 9.5, f2 = 2.3979
We will find the weight L0(x) and L1(x), and L2(x) where
L0(x) =
(x − 9.5)(x − 11)
(9 − 9.5)(9 − 11)
= x2
−20.5x +104.5 or L0(9.2) = 0.5400
L1(x) =
(x − 9)(x − 11)
(9.5 − 9)(9.5 − 11)
= −
1
0.75
(x2
−20x+99), L1(9.2) = 0.4800
L2(x) =
(x − 9)(x − 9.5)
(11 − 9)(11 − 9.5)
=
1
3
(x2
−18.5x+85.5), L2(9.2) = −0.0200
p2(x) = L0(x)f0 + L1(x)f1 + L2(x)f2
ln 9.2 ≈ 0.5400 × 2.1972 + 0.4800 × 2.2513 − 0.0200 × 2.3979 = 2.2192
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 7 / 9
8. Lagrange Polynomial Interpolation
For general n we obtain
f (x) ≈ pn(x) =
n
X
k=0
Lk(x)fk =
n
X
k=0
lk(x)
lk(xk)
fk
where,
l0(x) = (x − x1)(x − x2)....(x − xn)
lk(x) = (x − x0)(x − x1)....(x − xk−1)....(x − xn) ∀ 0 k n
ln(x) = (x − x0)(x − x1)....(x − xn−1)
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 8 / 9
9. Conclusion
1 Computational complexity is very high in Lagrange interpolation
method.
2 If n + 1 input samples are available it makes the nth order polynomial
for minimizing the estimated error.
3 It can minimize the estimated error with greater extent, when number
of available input-output data samples are very high.
Dr. Varun Kumar (IIIT Surat) Unit 2 / Lecture-1 9 / 9