Professional Documents
Culture Documents
Interpolation
Dr. Gokul K. C.
Department of Mathematics,
School of Science,
Kathmandu University, Nepal
Email: gokul.kc@ku.edu.np
1 / 30
Curve fitting and Interpolation
Given the set of tabular values (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), · · · , (xn , yn ) satisfying
the relation y = f (x) where the explicit nature of f (x) is not known, it is
required to find a simpler function, say φ(x).
Curve fitting is the process of approximating φ(x) that approximately fits
the data points, while, Interpolation is the process of approximating φ(x)
such that f (x) and φ(x) agree at the set of tabulated points.
The curve is not necessarily passing through data points in curve fitting,
however, the curve must pass though every data points in interpolation.
2 / 30
Least square curve fitting procedure
Let the fitted curve is given by Y = f (x). At x = xi , the given ordinate is yi
and the corresponding functional value of the fitted curve is f (xi ). If ei is
the error of approximation at x = xi , then we have, ei = yi − f (xi ).
If we write
S = [y1 − f (x1 )]2 + [y2 − f (x2 )]2 + · · · + [ym − f (xm )]2 = e12 + e22 + e32 + · · · + em2
4 / 30
Fitting qudratic polynomial
5 / 30
Interpolation
Finite Differences
Let y0 and y1 be two data points and y1 − y0 be difference such that:
First forward difference: ∆y0 = y1 − y0
First backward difference: ∇y1 = y1 − y0
First central difference: δy1/2 = y1 − y0
6 / 30
Forward differences
∆y0 = y1 − y0 , ∆y1 = y2 − y1 , · · · , ∆yn−1 = yn − yn−1 are called first forward
differences.
∆2 y0 = ∆y1 − ∆y0 , ∆2 y1 = ∆y2 − ∆y1 , · · · , ∆2 yn−1 = ∆yn − ∆yn−1 are called
second order differences and so on.
7 / 30
Backward differences
∇y1 = y1 − y0 , ∇y2 = y2 − y1 , · · · , ∇yn = yn − yn−1 are called first forward
differences.
∇2 y2 = ∇y2 − ∇y1 , ∇2 y3 = ∇y3 − ∇y2 , · · · , ∇2 yn = ∇yn − ∇yn−1 are called
second order differences and so on.
8 / 30
Newton’s backward difference interpolation formula
Given the set of (n + 1) tabular values (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), · · · , (xn , yn ) of
x and y , it is required to find a polynomial yn (x), such that y and yn (x)
agree at the tabulated points. Let the domain values are in equidistant, i.e,
xi = x0 + ih, i = 0, 1, 2, · · · , n.
Let the polynomial yn (x) be written as (Starting from backward points)
yn (x) = a0 +a1 (x −xn )+a2 (x −xn )(x −xn−1 )+a3 (x −xn )(x −xn−1 )(x −xn−2 )+· · ·
+an (x − xn )(x − xn−1 )(x − xn−2 ) · · · (x − x1 )
Substituting the data values (Starting from last data) successively, we get
(xn , yn ) : yn = a0 → a0 = yn
(xn−1 , yn−1 ) : yn−1 = a0 + a1 (xn−1 − xn ) =⇒ yn−1 = yn + a1 (−h)
−yn
=⇒ a1 = yn−1 −h = ∇y h
n
Setting x = xn + ph we have,
x − xn = (xn + ph) − xn = ph
x − xn−1 = (xn + ph) − xn−1 = ph + xn − xn−1 = ph + h = h(p + 1)
x − xn−2 = (xn + ph) − xn−2 = ph + xn − xn−2 = ph + 2h = h(p + 2)
..
.
x − x1 = (xn + ph) − x1 = ph + xn − x1 = ph + xn − x0 + x0 − x1
= ph + nh − h = h(p + n − 1)
Substituting these values, we get
∇2 y n 3
yn (x) = yn + (ph) ∇yh + (ph)[h(p + 1)] 2!h2 + (ph)[h(p + 1)][h(p
n
+ 2)] ∇3!hy3n
n
+ · · · + (ph)[h(p + 1)][h(p + 2)] · · · [h(p + n − 1)] ∇ yn
n!hn
10 / 30
11 / 30
Central difference formulas
= 2.7183 + (−0.4)(0.1394) +
(−0.4)(−1.4)
2 (0.0071) +
(−0.4)(−1.4)(−2.4)
6 (0.0004)
= 2.6644
Now, for x = 1.02, p = 1.02−1 0.05 = 0.4.
Then, yn = 2.77.
14 / 30