Interpolation and Extrapolation
Mathematics 3BA1
Rozenn Dahyot
Room 128 Lloyd Institute
School of Computer Science and Statistics
Trinity College Dublin, IRELAND
Denitions.
Consider n + 1 data points {(x1 , f1 ), (x2 , f2 ), . . . (xn , fn ), (xn+1 , fn+1 )} generated by
the unknown function f such that fi = f (xi ) ∀i. We want to nd a function P
such that
P(xi ) = fi
∀i ∈ 1..n + 1
We hope that P(x) will be a good approximation to the underlying function f
that generated or describes the data.
If we use P to evaluate f (x) inside the interval formed by x1 ..xn+1 , then
we are doing Interpolation.
https://www.cs.tcd.ie/Rozenn.Dahyot/
[email protected]
Lecture - 4th May 2006
If we evaluate for x outside this interval, then we are performing
Extrapolation.
http://en.wikipedia.org/wiki/Interpolation
Polynomial Interpretation I
Polynomial Interpretation II
We could take the polynomial as
Assuming P is a polynomial of degree n
a0 + a1 x + a2 x2 + · · · + an xn
a0 + a1 x + a2 x2 + · · · + an xn
and plug in our data-values to get
where n is chosen suitably.
fi = a0 + a1 xi + a2 xi2 + · · · + an xin
Theorem:
Given n + 1 data-points, there is a unique polynomial of degree ≤ n that
passes through these points.
∀i ∈ 1..n + 1
which would give us n + 1 equations in n + 1 unknowns (a0 , .., an ) which
we could then solve in the usual fashion.
It is clear that this unique polynomial is the most useful on to nd.
How do we determine the coefcients of this polynomial?
Polynomial Interpretation III
Case
P
Polynomial Interpretation IV
n + 1 = 2.
will be of degree 1, and so we write P in the following form:
Case
P
n + 1 = 3.
will be of degree 2, and so we write P in the following form:
P(x) = C0 + C1 (x − x1 )
We then insert x = x1 to get:
P(x) = C0 + C1 (x − x1 ) + C2 (x − x1 )(x − x2 )
We then insert x = x1 to get
f1 = P(x1 ) = C0 + C1 (x1 − x1 ) = C0
We can then substitute for C0 in P and then evaluate at x2 to get:
f1 = P(x1 ) = C0 + C1 (x1 − x1 ) + C2 (x1 − x1 )(x1 − x2 ) = C0
We can then substitute for C0 in P and then evaluate at x2 to get:
f2 = P(x2 ) = f1 + C1 (x2 − x1 )
which can be manipulated to solve for C1 as follows:
C1 =
f2 − f1
x2 − x1
f2
=
P(x2 )
=
f1 + C1 (x2 − x1 ) + C2 (x2 − x1 )(x2 − x2 )
=
= f1 + C1 (x2 − x1 )
which can be manipulated to solve for C1 as follows
C1 =
f2 − f1
x2 − x1
Polynomial Interpretation V
Polynomial Interpretation VI
Finally we insert x = x3 to get
f3
We notice two things
the derivation of C0 and C1 is the same regardless of n,
=
P ( x3 )
=
C0 + C1 (x3 − x1 ) + C2 (x3 − x1 )(x3 − x2 )
f − f1
(x3 − x1 ) + C2 (x3 − x1 )(x3 − x2 )
f1 + 2
x2 − x1
=
This can be manipulated to solve for C2 as follows:
f − f1
(x3 − x1 )
f3 − f1 − 2
x2 − x1
and the equations get quite complex.
In general, to get an interpolating polynomial of degree n we start with the
form:
n
P(x) = C0 + ∑ Ci (x − x1 )(x − x2 ) · · · (x − xn )
i=1
and use x = xi to solve for the Ci as described above.
Using Talyor's and Rolle's Theorem, it is possible to show that the truncation
error RT is
RT
=
f (x ) − P(x )
=
f (n+1) ( ξ )
(x − x1 )(x − x2 ) · · · (x − xn )
n + 1!
where ξ is somewhere in the interval x1 ..xn+1 .
Note that it is a consequence of this error expression that RT = 0 for x = xi ,
for i = 1..n + 1.
Interpolating known functions I
Interpolating known functions II
Sometime we use interpolation to get a polynomial approximation to known
functions.
◮
Why? Often the polynomial approximation is much easier to compute !
Given f , are we better of using polynomials of higher degree, in order to
get better accuracy ? The answer surprisingly is no.
◮
◮
only use P of low degree for interpolation.
In practise we choose n = 1 (linear interpolation) or n = 2 (quadratic
interpolation) and to repeatedly approximate f over short sections. The
following diagram shows a function f (x) being interpolated in a piecewise
linear fashion by straight-line segments P1(x), P2(x), . . . Pn(x), each of
degree 1.
Runge found that the function
f (x ) =
◮
The consequence of this is that we should
1
1 + 25x2
on the interval [−1, +1] has the surprising property, that as the degree of the
interpolating polynomial rises, so does the error at points in between the
interpolation points. In fact he found that the error tends to innity as
n → ∞.
An even stronger result shows that for any interpolating polynomial P, there
is a function ψ such that ψ(x) = P(x) at the interpolation points, but that the
difference ψ(x) − P(x) gets arbitrarily large at some in-between points.
Applications of interpolation
image processing http://www.cambridgeincolour.com/tutorials/
image-interpolation.htm
special effects: http://en.wikipedia.org/wiki/Bullet_time
P2
P1
P7
P3
P4
P6
P5
Pi(x)
f(x)
© Copyright 2026 Paperzz