Interpolation, Smoothing, Extrapolation: What Is A Good Estimate For y For X 4.5, or X 15 ?
Interpolation, Smoothing, Extrapolation: What Is A Good Estimate For y For X 4.5, or X 15 ?
Interpolation, Smoothing, Extrapolation: What Is A Good Estimate For y For X 4.5, or X 15 ?
(yb ya )
y = ya + (x xa ) b
(xb xa )
i = 0,1,, n xi x j i
*
* Example: 10th order polynomial
Lagrange=0.
*
Do I=0,10
term=1.
Do k=0,10
If (k.ne.I) then
term=term*(x-x0(k))/(x0(I)-x0(k))
Endif
Enddo
Lagrange=Lagrange+Y0(I)*term
Enddo
(x x )
i
F(x) = f (x) p(x) ( f (x ) p(x )) i=0
n
(x x )
i=0
i
but x is arbitrary, so
f (n +1) ( ) n
e(x ) =
(n + 1)! i = 0
(x xi ) for some between x, x0 , x1 ,, xn
(x x ) i
(b a)11
e(x ) i=0
< for interpolation
(n + 1)! 11!
2. S(xk ) = yk k = 0,1,, n
Linear Spline:
yk +1 yk
Sk (x) = yk + (x xk )
xk +1 xk
Quadratic Spline:
zk +1 zk
Sk (x) = yk + zk (x xk ) + (x xk )2
2(xk +1 xk )
z0 has to be fixed, for example from requiring Sk (a) = z0 = 0.
then,
y yk
zk +1 = zk + 2 k +1
xk +1 xk
2. S(xk ) = yk k = 0,1,, n
Cubic spline
Quadratic spline
5
f(x)-S(x) max f ( 4 ) (x) h 4 where h = max k xk +1 xk
384 a x b
Proof of 2.
Start with algebraic identity F 2 S 2 = (F S)2 2S(S F)
Let F = f (x), S = S (x)
then
b b b b
[ f (x) ]2
dx [ S (x) ]2
dx = [ f (x) S (x) ]2
dx 2 S (x)[ S (x) f (x)]dx
a a a a
b
[ f (x) S(x)] dx 0
2
a
b n 1 xk+1
b
n 1 xk+1
a S(x)( S(x) f (x))dx = S (x) ( S (x) f (x)) xk S (x) ( S (x) f (x))dx
xk+1
k=0 xk
k
k=0
k
k=0
b b
[ f (x)] dx [ S(x)] dx 0
2 2
a a
And set wi = 1 i
x y
0 1
0.5 0.368
1. 0.135
2. 0.018
2. For the same data, find the natural cubic spline coefficients.
Plot the data, the lagrange polynomial and the cubic spline
interpolations.
3. Smooth the data in the table with the function f(x)=Aexp(-bx).
What did you get for A,b ?