Professional Documents
Culture Documents
Parte II
xi x0 x1 …. xn
yi y0 y1 …. yn
One approach:
Use polynomial interpolation to obtain fn(x) to interpolate the data
then use Newton’s method or other to find a solution to x
f n ( x ) yk
Inverse Interpolation
Inverse interpolation: xi x0 x1 …. xn
1. Exchange the roles
yi y0 y1 …. yn
of x and y.
2. Perform polynomial
Interpolation on the yi y0 y1 …. yn
new table.
xi x0 x1 …. xn
3. Evaluate
x f n ( yk )
Inverse Interpolation
x
y
x y
Inverse Interpolation
Example
x 1 2 3
Problem : y 3.2 2.0 1.6
BE CAREFUL
10th Order Polynomial Interpolation
2
0.5
true function
-0.5
-5 -4 -3 -2 -1 0 1 2 3 4 5
Spline Interpolation
Why Spline Interpolation?
9
Why Splines ?
17th Order
Polynomial
Original
Function
5th Order
Polynomial
9th Order
Polynomial
f ( x) f ( x0 ) m0 ( x x0 ) x0 x x1
f ( x) f ( x1 ) m1 ( x x1 ) x1 x x2
f ( x) f ( xn1 ) mn1 ( x xn1 ) xn1 x xn
f ( xi 1 ) f ( xi )
mi
xi 1 xi
Linear spline - Example
Fit the following data with first order splines.
Evaluate the function at x = 5.
2.5 1
x f(x) m 0.6
7 4.5
3.0 2.5 f (5) f (4.5) m(5 4.5)
4.5 1.0 1.0 0.6 0.5
7.0 2.5
9.0 0.5 1.3
Linear Spline
• The main disadvantage of linear spline is that they are
not smooth. The data points where 2 splines meets called
(a knot), the changes abruptly.
ai xi 1 bi xi 1 ci f i ( xi 1 ) i 2, 3, 4,..., n
2
• The first and last functions must pass through the end
points (2).
a1 x0 b1 x0 c1 f ( x0 )
2
an xn bn xn cn f ( xn )
2
Quadric Splines
• The first derivatives at the interior knots must be
equal (n-1).
f i ( x) 2ai x bi
'
2ai 1 xi 1 bi 1 2ai xi 1 bi
Solutions:
There are 3 intervals (n=3), 9 unknowns.
Quadric Splines - Example
1. Equal interior points:
For first interior point (4.5, 1.0)
The 1st equation:
x12a2 x1b2 c2 f ( x1 )
(4.5) 2 a2 4.5b2 c2 f (4.5) 20.25a2 4.5b2 c2 1.0
Quadric Splines - Example
x22 a3 x2b3 c3 f ( x2 )
x a1 x0 b1 c1 f ( x0 )
2
0 9a1 3b1 c1 2.5
For the end point (9, 0.5)
x a x3b3 c3 f ( x3 )
2
3 1 81a3 9b3 c3 0.5
Quadric Splines - Example
Equal derivatives at the interior knots.
For first interior point (4.5, 1.0)
2 x1 a1 b1 2 x1 a2 b2 9a1 b1 9a2 b2
For second interior point (7.0, 2.5)
2 x2 a2 b2 2 x3 a3 b3 14a2 b2 14a3 b3
Second derivative at the first point is 0
f '' ( x0 ) a1 0
Quadric Splines - Example
4.5 1 0 0 0 0 0 0 b1 1
0 0 c
20.25 4.5 1 0 0 0 1 1
0 0 49 7 1 0 0 0 a2 2.5
0 0 0 0 0 49 7 1 b2 2.5
3 1 0 0 0 0 0
0 c2 2.5
0 0 0 0 0 81 9 1 a3 0.5
1 0 9 1 0 0 0 0 b3 0
0 0 14 1 0 14 1 0 c3 0
Quadric Splines - Example
Solving these 8 equations with 8 unknowns
a1 0, b1 1, c1 5.5
a2 0.64, b2 6.76, c2 18.46
a3 1.6, b3 24.6, c3 91.3
f i ( x) ai x3 bi x 2 ci x di
For n+1 data points:
• i = (0, 1, 2, …n),
• n intervals,
• 4n unknown constants (a’s, b’s ,c’s and d’s)
Cubic Splines
• The function values must be equal at the interior knots
(2n-2).
• The first and last functions must pass through the end
points (2).
• The first derivatives at the interior knots must be equal
(n-1).
• The second derivatives at the interior knots must be equal
(n-1).
• The second derivatives at the end knots are zero (2), (the 2nd
derivative function becomes a straight line at the end points)