Professional Documents
Culture Documents
Interpolation Method
Interpolation Method
Interpolation Method
❑ Topics:
❑ Examples
❑ Orthogonal Polynomials
❑ Parametric interpolation
Interpolation
Basic interpolation problem: for given data
(t1 , y1 ), (t2 , y2 ), . . . (tm , ym ) with t1 < t2 < · · · < tm
determine function f : R ! R such that
f (ti ) = yi , i = 1, . . . , m
f is interpolating function, or interpolant, for given data
Additional data might be prescribed, such as slope of
interpolant at given points
Additional constraints might be imposed, such as
smoothness, monotonicity, or convexity of interpolant
f could be function of more than one variable, but we will
Note: consider
We might only one-dimensional
look case
at multi-dimensional
case, even though the text
Michael does
T. Heath not.
Scientific Computing 3 / 56
Piecewise Polynomial Interpolation Existence and Uniqueness
Interpolation vs Approximation
Issues in Interpolation
Choosing Interpolant
h 0.02
x cos x
0.00 1.00000
0.02 0.99980
0.04 0.99920
0.06 0.99820
0.08 0.99680
Interpolation Motivation
Polynomial Interpolation Choosing Interpolant
Piecewise Polynomial Interpolation Existence and Uniqueness
Basis Functions
Family of functions for interpolating given data points is
spanned by set of basis functions 1 (t), . . . , n (t)
Interpolating function f is chosen as linear combination of
basis functions,
n
X
f (t) = xj j (t)
j=1
Polynomial Interpolation
< interactive
(i.e., in infinite example
precision >
arithmetic)
Monomial Basis
Monomial basis functions
j (t) = tj 1
, j = 1, . . . , n
❑ Choices:
❑ A: points are given to you
❑ B: you choose the points
xj fj
0.6 1.2
0.8 2.0
1.0 2.4
Polynomial
❑ Q: What is f(x=0.75) ? interpolation error for
f (x) p(x) =
Polynomial Interpolation
xj fj
0.6 1.2
0.8 2.0
1.0 2.4
Polynomial
❑ Q: What is f(x=0.75) ? interpolation error for
❑ Lagrange Polynomials
n
X
p(t) = fj lj (t)
j=1
lj (t) = 1 t = tj
lj (ti ) = 0 t = ti , i 6= j
lj (t) 2 lPn 1 (t)
P lj (t) = 1 t = tj
• Construct p(t) = j f j l j (t).
lj (ti ) = 0 t = ti , i 6= j
• lj (t) given by above.
lj (t) 2 lPn 1 (t)
• Error formula f (t) p(t) given as before.
• Can choose tj ’s to minimize error polynomial qn (t).
1
lj (t) = (t t1 )(t t2 ) · · · (t tj 1 )(t tj+1 ) · · · (t tn )
C
• lj (t) is a polynomial of degree n 1
C = (tj t1 )(tj t2 ) · · · (tj tj 1 )(tj tj+1 ) · · · (tj tn )
• It is zero at t =
✓ ti , i 6=
◆ j.
✓ ◆ ✓ ◆✓ ◆ ✓
t t1 t t2 t tj 1 t tj+1 t t
l (t) =
• Choosej C so that · · · ···
tj itt1is 1 at
tj t t=
2
tj . tj tj 1 tj tj+1 tj t
n
• Error formula f (t) p(t) given as before.
Constructing
• Can choose tj ’sHigh-Order
to minimizePolynomial Interpolants
error polynomial qn (t).
n
X
p(t) = fj lj (t)
j=1
lj (t) = 1 t = tj
lj (ti ) = 0 t = ti , i 6= j
lj (t) 2 lPn 1 (t)
• Error formula f (t) p(t) given as before.
Constructing
• Can choose tj ’s High-Order
to minimize Polynomial Interpolants
error polynomial qn (t).
n
X
p(t) = fj lj (t)
j=1
lj (t) = 1 t = tj
lj (ti ) = 0 t = ti , i 6= j
lj (t) 2 lPn 1 (t)
Constructing High-Order Polynomial Interpolants
• Set
fn+1 pn (tn+1 )
C = ,
qn (tn+1 )
Lagrange Interpolation
For given set of data points (ti , yi ), i = 1, . . . , n, Lagrange
basis functions are defined by
n
Y n
Y
`j (t) = (t tk ) / (tj tk ), j = 1, . . . , n
k=1,k6=j k=1,k6=j
t(t 1) (t + 2)(t 1)
p2 (t) = 27 + ( 1)
( 2)( 2 1) (2)( 1)
f (n) (✓)
f (t) pn 1 (t) = (t t1 )(t t2 ) · · · (t tn )
n!
where ✓ is some (unknown) point in interval [t1 , tn ]
M hn
max |f (t) pn 1 (t)|
t2[t1 ,tn ] 4n
Convergence
❑ Can map back and forth between stable nodal bases and
Legendre or bubble function modal bases, with minimal
information loss.
Unstable and Stable Interpolating Basis Sets
:= xn + cn 1 xn 1
+ . . . + c0
N=4
N=7
φ2 φ4
N=8
Uniform Gauss-Lobatto-Legendre
Here, we see the max qn+1 for uniform
(red) and Chebyshev points.
ei := p(t̃i ) f (t̃i )
maxi |ei |
emax :=
maxi |fi |
max |p f |
⇡ .
max |f |
(Remember, it’s an experiment.)
• Preceding description is for one trial.
• Repeat for increasing n and plot emax (n) on a log-log or semilog plot.
• Compare with other methods and with theory:
– methods – identify best method for given function / requirements
– theory – verify that experiment is correctly implemented
• Repeat with a di↵erent function.
Summary of Key Theoretical Results
00 00
– Here, qn (✓) := (✓ t1 )(✓ t2 ) · · · (✓ tn ).
– The first result also holds true for extrapolation, i.e., t62[a, b].
• Tests:
– et
– ecos t
– sin t on [0, ⇡]
– sin t on [0, ⇡2 ]
– sin 15t on [0, 2⇡]
– ecos 11t on [0, 2⇡]
1
– Runge function: 1+25t2
on [0, 1]
1
– Runge function: 1+25t2
on [ 1, 1]
p
– Semi-circle: 1 t2 on [ 1, 1]
– Polynomial: tn
– Extrapolation
– Other
interp_test.m interp_test_runge.m
• Methods:
– piecewise linear
– polynomial on uniform points
– polynomial on Chebyshev points
– natural cubic spline
• Tests:
– et
– ecos t
– sin t on [0, ⇡]
– sin t on [0, ⇡2 ]
– sin 15t on [0, 2⇡]
– ecos 11t on [0, 2⇡]
1
– Runge function: 1+25t2
on [0, 1]
1
– Runge function: 1+25t2
on [ 1, 1]
p
– Semi-circle: 1 t2 on [ 1, 1]
– Polynomial: tn
– Extrapolation
– Other
interp_test.m interp_test_runge.m
Interpolation Piecewise Polynomial Interpolation
Polynomial Interpolation Hermite Cubic Interpolation
Piecewise Polynomial Interpolation Cubic Spline Interpolation
• Interval Ij = [xj 1 , xj ], j = 1, . . . , n
pj (x) = aj + bj x + cj x2 + dj x3
• 4n unknowns
pj (xj 1 ) = fj 1 , j = 1, . . . , n
pj (xj ) = fj , j = 1, . . . , n
p1 (t) = ↵1 + ↵2 t + ↵3 t2 + ↵4 t3
2 3
p2 (t) = 1 + 2t + 3t + 4t
Interpolatory
8 Unknowns
p1 (t1 ) = y1
p1 (t) = ↵1 + ↵2 t + ↵3 t)2 =
p1 (t +↵y24 t
3
2
p2 (t) = + 2t +p (t3 t)2 + 4t
3
2 2 = y2
1
8 Equations p2 (t3 ) = y3
p002 (t) = 1 + 2 t + 3 t2 + 4 t3
Continuity of Derivatives
p2 (t3 ) Continuity
= 0 of Derivatives
p01 (t2 ) = p02 (t2 ) p01 (t
(Natural 0
2 ) = p2 (t2 )
Spline)
p001 (t2 ) = p002 (t2 ) p001 (t2 ) = p002 (t2 )
8 Equations
❑ Example 1: a circle.
Parametric Interpolation: Example 2
❑ Suppose we want to
approximate a cursive letter.
• An approximate arclength is
❑ An approximate arclength is:
i
X
si = dsj , dsi := ||xi xi 1 ||2
j=0
Pseudo-Arclength-Based Index-Based
Multidimensional Interpolation
n X
X n
= li(s) fij lj (t)
i=0 j=0
2D Example: n=2
Consider 1D Interpolation
n
X
f˜(s) = lj (s) fj
j=1
n
X
f˜(s) = lj (s) fj
j=1
n
X
f˜i = lij fj , lij := lj (si)
j=1
f̃ = L f
n X
X n
= li(s) fij lj (t)
i=1 j=1
n X
X n
f˜pq := f˜(sp, tq ) := lpi fij lqj
i=1 j=1
n X
X n
T
:= lpi fij ljq
i=1 j=1
Two-DimensionalF̃Case (say,
= LF LT n x n à m x m)
1
Aside: GLL Points and Legendre Polynomials