Upload
john-ham
View
147
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Lecture slides based on Autar Kaw's Numerical Methods text, Chapter 5.05, found at http://nm.mathforcollege.com
Citation preview
St. John's University of Tanzania
MAT210 NUMERICAL ANALYSIS2013/14 Semester II
INTERPOLATIONSplines
Kaw, Chapter 5.05
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
MAT210 2013/14 Sem II 3 of 20
How do we avoid this?
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
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
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?
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
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
MAT210 2013/14 Sem II 9 of 20
Linear Splines
MAT210 2013/14 Sem II 10 of 20
Linear Splines
Slope between points
MAT210 2013/14 Sem II 11 of 20
v(16) … Again
The linear case is unchanged
No surprise there
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?
MAT210 2013/14 Sem II 13 of 20
2n from continuity
Each curve must pass through both endpoints
MAT210 2013/14 Sem II 14 of 20
n-1 from smoothness
a1x2+b1 x+c1⇒2 a1 x+b1
a2 x2+b2 x+c2⇒2 a2 x+b2
Must match at n-1 interior points
2 a1 xi+b1=2 a2 xi+b2∀ i ∈ [1 ,n−1]
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
MAT210 2013/14 Sem II 16 of 20
Revisiting the Rocket
MAT210 2013/14 Sem II 17 of 20
The continuous derivatives
The draftsman is bending his spline!
MAT210 2013/14 Sem II 18 of 20
The Final Matrix
MAT210 2013/14 Sem II 19 of 20
The Solution
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?