1. St. John's University of Tanzania
MAT210 NUMERICAL ANALYSIS
2013/14 Semester II
INTERPOLATION
Splines
Kaw, Chapter 5.05
2. MAT210 2013/14 Sem II 2 of 20
● Direct, Newton Divided Difference &
Lagrangian Interpolation
●
Two approaches for finding the same nth order
polynomial fit for all points in an data set
● Is splines just another way to do the same
●
NO!
● It is Piecewise polynomial interpolation
● Each piece can be linear, quadratic or cubic
Introduction
4. MAT210 2013/14 Sem II 4 of 20
By observing
● This function has distinct regions
●
The interval from x ≈ -1 to -0.5
● The interval from x ≈ -0.5 to -0.1
● The interval from x ≈ -0.1 to +0.1
● The interval from x ≈ 0.1 to 0.5
● The interval from x ≈ 0.5 to 1
Though there is some symmetry...
● It would be better to fit different functions
to different intervals
5. MAT210 2013/14 Sem II 5 of 20
Piecewise Polynomials
Rather than interpolating n+1 points with a
single polynomial of degree n, put different
polynomials on each interval
S(x)=
{
s0
(x) , x∈[x0
,x1)
s1
(x) , x∈[x1,
x2)
⋮
sn−1
(x) , x∈[xn−1
, xn]}where the sj are polynomials of (usually) small degree
6. MAT210 2013/14 Sem II 6 of 20
Interpretation
● Piecewise linear = connect the dots
●
Piecewise quadratic
= parabolas between the dots
● But wait
●
Two points uniquely define a line
– linear is understandable
●
Three points are needed for a parabola
– How is the other degree of freedom set?
7. MAT210 2013/14 Sem II 7 of 20
Splines
● In the connect the dots linear case,
the curve is not “smooth”
●
Add “smoothness” into the requirement
● Draftsmen achieved this smoothness with
splines - a flexible strip of metal or wood
8. MAT210 2013/14 Sem II 8 of 20
Splines
● In the connect the dots linear case,
the curve is not “smooth”
●
Add “smoothness” into the requirement
● Draftsmen achieved this smoothness with
splines - a flexible strip of metal or wood
●
Mathematicians achieve it by matching
derivatives at the end points of the intervals
11. MAT210 2013/14 Sem II 11 of 20
v(16) … Again
The linear case is unchanged
No surprise there
12. MAT210 2013/14 Sem II 12 of 20
Quadratic Splines
● Now things get interesting
● How to find all the coefficients?
●
3n coefficients, n equations, n continuity at
end points, whence the other n?
13. MAT210 2013/14 Sem II 13 of 20
2n from continuity
Each curve must pass through both endpoints
14. MAT210 2013/14 Sem II 14 of 20
n-1 from smoothness
a1
x
2
+b1
x+c1
⇒2a1
x+b1
a2
x2
+b2
x+c2
⇒2a2
x+b2
Must match at n-1 interior points
2 a1
xi
+b1
=2a2
xi
+b2
∀ i ∈ [1 ,n−1]
15. MAT210 2013/14 Sem II 15 of 20
One more assumption
● This is 3n unknowns and 3n -1 equations
●
Need to set one more condition
● Generally set the first spline to be linear
● a1 = 0
●
Now use any technique to solve
simultaneous linear equations
20. MAT210 2013/14 Sem II 20 of 20
Going Deeper
● The overall curve is smooth and the
accuracy can be quite good
●
Cubic is better, more common
– See that next time
● What about finding the distance traveled?
●
From 11 to 14s?
● From 11 to 16s?
● From 0 to 30s?