0% found this document useful (0 votes)
433 views23 pages

Chapter 3, Interpolation and Extrapolation

The document discusses polynomial interpolation and extrapolation methods, including Lagrange interpolation, which finds a polynomial that passes through given data points exactly. It also covers numerical issues like ill-conditioning that can arise when directly solving the Vandermonde matrix equation for interpolation. Neville's algorithm provides a numerically stable way to evaluate Lagrange's interpolation formula without directly inverting the matrix.

Uploaded by

Konark Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
433 views23 pages

Chapter 3, Interpolation and Extrapolation

The document discusses polynomial interpolation and extrapolation methods, including Lagrange interpolation, which finds a polynomial that passes through given data points exactly. It also covers numerical issues like ill-conditioning that can arise when directly solving the Vandermonde matrix equation for interpolation. Neville's algorithm provides a numerically stable way to evaluate Lagrange's interpolation formula without directly inverting the matrix.

Uploaded by

Konark Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter 3, Interpolation and

Extrapolation
Interpolation & Extrapolation

(xi,yi)

Find an analytic function f(x)


that passes through given N
points exactly.
Polynomial Interpolation
• Use polynomial of degree N-1 to fit exactly
with N data points (xi,yi), i =1, 2, …, N.
N 1
f ( x)  c0  c1 x  c2 x 
2
 cN 1 x

• The coefficient ci is determined by a


system of linear equations
Vandermonde Matrix Equation

1 x1 x2
1 xN 1
1
  c0   y1 
 2 N 1    
1 x2 x2 x2  c1 y
 2
    
 N 1     
1 xN xN  cN 1   yN 
2
x N

• But it is not advisable to solve this system


numerically because of ill-conditioning.
Condition Number
• cond(A) = ||A|| · ||A-1||

• For singular matrix, cond(A) = ∞


• A linear system is ill-conditioned if cond(A)
is very large.

• Norm || . ||: a function that satisfies (1) f(A)


≥ 0, (2) f(A+B) ≤ f(A) + f(B), (3) f(A) = ||
f(A).
Norms
• Vector p-norm

 
1/ p
x p
 | x1 |  | x2 | 
p p
| xN | p

• Matrix norm
|| Ax ||
A  sup
x  0 || x ||

sup: supremum
Commonly Used Norms
• Vector norm
N N
|| x ||1   | x j |, || x ||2   j
x 2

j 1 j 1

|| x ||  max | x j |
j

• Matrix norm
N
|| A ||1  max  | aij |, || A ||2   Where μ is the maximum
j
i 1 eigenvalue of matrix ATA.
N
|| A ||  max  | aij |
i
j 1
Lagrange’s Formula
• It can be verified that the solution to the
Vandermonde equation is given by the
N
formula below:
N  ( x  x j )
f ( x)   li ( x) yi , li ( x)  N
j  i , j 1

i 1
 ( xi  x j )
j  i , j 1

• li(x) has the property li(xi)=1; li(xk)=0, k≠i.


Joseph-Louis Lagrange (1736-1813)

Italian-French mathematician
associated with many classic
mathematics and physics –
Lagrange multipliers in
minimization of a function,
Lagrange’s interpolation
formula, Lagrange’s theorem in
group theory and number
theory, and the Lagrangian
(L=T-V) in mechanics and
Euler-Lagrange equations.
Neville’s Algorithm
• Evaluate Lagrange’s interpolation formula
f(x) at x, given the data points (xi,yi).
• Interpolation tableau P
x1: y1 = P1
P12
x2: y2 = P2 P123
P23 P1234
x3: y3 = P3 P234 Pi,i+1,i+2,…,i+n is a polynomial of
P34 degree n in x that passes
through the points (xi,yi),
x4: y4 = P4 (xi+1,yi+1), …, (xi+n,yi+n) exactly.
Determine P12 from P1 & P2
• Given the value P1 and P2 at x=x1 and x2,
we find linear interpolation
P12(x) = λ(x) P1+[1-λ(x)] P2
Since P12(x1) = P1 and P12(x2) = P2, we
must have
λ(x1) = 1, λ(x2) = 0
so
λ(x) = λ12= (x-x2)/(x1-x2)
Determine P123 from P12 & P23
• We write
P123(x) = λ(x) P12(x) + [1-λ(x)] P23(x)
P123(x2) = P2 already for any choice of λ(x). We
require that P123(x1)=P12(x1) =P1 and
P123(x3)=P23(x3) =P3, thus λ(x1) = 1, λ(x3) = 0
Or
x  x3
 ( x)  13 
x1  x3
Recursion Relation for P
• Given two m-point interpolated value P
constructed from point i,i+1,i+2,…,i+m-1,
and i+1,i+2,…,i+m, the next level m+1
point interpolation from i to i+m is a convex
combination:
Pi (i 1)(i  2)...(i  m )   ( x) Pi (i 1)...(i  m 1)  1   ( x)  P(i 1)(i  2)...(i  m )
x  xi  m
where  ( x)  (i )(i  m ) 
xi  xi  m
Use Small Difference C & D
P1 C1,1 = P12-P1 ( xi  x)(Cm,i 1  Dm,i )
Cm1,i 
P12 xi  xi  m1
D1,1 C2,1=P123-P12
P123
P2
D2,1
C1,2 C3,1=P1234-P123
P23
D1,2 P1234
C2,2
P3 P234 D3,1=P1234-P234

C1,3
P34 D2,2=P234-P34

D1,3 ( xi  m1  x)(Cm,i 1  Dm,i )


Dm1,i 
P4 xi  xi  m1
Deriving the Relation among C & D
PA
D1=PA –P0
C2=P-PA

P0
P =λ PA + (1-λ)PB
C1=PB –P0 D2=P-PB
PB

C2  P  PA  P  P0  (PA  P0 ) D2  (C1  D1 )
 PA  (1   )PB  P0  (PA  P0 )
 (1   )(C1  D1 )
• Evaluate f(3) given 4-points (0,1), (1,2),
(2,3),(4,0).
C0,1=1 Cm1,i  (1  (i )(i  m 1) )(Cm,i 1  Dm,i )
x1=0, y1=1 =P1
C1,1 = 3 x  xi  m1
D0,1=1 (i )(i  m1) 
xi  xi  m1
C2,1= 0
C0,2=2 D1,1= 2

x2=1, y2=2 =P2


C1,2= 2 D2,1= 0 C3,1= - 5/4
D0,2=2
P1234= 11/4
C0,3=3 D1,2= 1 C2,2= -5/3
D3,1= 5/12
x3=2, y3=3 =P3
C1,3= -3/2
D0,3=3 D2,2=5/6

C0,4=0 D1,3 = 3/2 Dm1,i  (i )(i  m 1) (Cm,i 1  Dm,i )


x4=4, y4=0 =P4
D0,4=0
polint( ) Program
polint(), continued
Piecewise Linear Interpolation
x  x2
P12 ( x)   ( x) y1  1   ( x)  y2 ,  ( x) 
y x1  x2

P23(x)

P12(x) (x2,y2) (x3,y3) P34(x)

(x1,y1) (x4,y4) P45(x)

(x5,y5)

x
Piecewise Polynomial Interpolation

y
Discontinuous derivatives
across segment

P1234(x)
P1234(x)
(x2,y2) (x3,y3) P2345(x)

(x1,y1) (x4,y4) P2345(x)

(x5,y5)

x
Cubic Spline
• Given N points (xi,yi), i=1,2,…,N, for each
interval between points i to i+1, fit to cubic
polynomials such that Pi(xi)=yi and
Pi(xi+1)=yi+1.
• Make 1st and 2nd derivatives continuous
across intervals, i.e., Pi(n)(xi+1) = P(n)i+1(xi+1),
n = 1 and 2.
• Fix boundary condition to P’’(x1 or N)=0, or
P’(x1 or N ) = const, to completely specify.
Reading
• NR, Chapter 3

• See also J. Stoer and R. Bulirsch,


“Introduction to Numerical Analysis,”
Chapter 2. Other chapters are also
excellent, but rather mathematical,
references for other topics.
Problems for Lecture 3 (Interpolation)

1. Use Neville’s algorithm to find the interpolation value at


x = 0, for a cubic polynomial interpolation with 4 points
(x,y) = (-1,1.25), (1,2), (2,3), (4,0). Also write out the
Lagrange’s formula and compute f(0).

2. Given the same 4 points as above, determine the cubic


splines with natural boundary condition (second
derivatives equal to 0 at the boundary). Give the cubic
polynomials in each of the three intervals. Use the
method outlined in NR page 113 to 116, or a direct fit to
cubic polynomials with proper conditions.

You might also like