CE30125 - Lecture 3 p. 3.1 LECTURE 3 LAGRANGE INTERPOLATION • Fit points with an degree polynomial • = exact function of which only discrete values are known and used to estab- lish an interpolating or approximating function • = approximating or interpolating function. This function will pass through all specified interpolation points (also referred to as data points or nodes). N 1 + N th f 1 x 0 g(x) f(x) f 0 f 2 f 3 f 4 f N x 1 x 2 x 3 x 4 x N ... fx N 1 + gx gx N 1 +
23
Embed
LECTURE 3 LAGRANGE INTERPOLATION 3 LAGRANGE INTERPOLATION • Fit points with an degree polynomial ... basic premise of interpolation is satisfied, namely that . Thus: x 0 V 0 (x)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CE30125 - Lecture 3
p. 3.1
LECTURE 3
LAGRANGE INTERPOLATION
• Fit points with an degree polynomial
• = exact function of which only discrete values are known and used to estab-lish an interpolating or approximating function
• = approximating or interpolating function. This function will pass through allspecified interpolation points (also referred to as data points or nodes).
N 1+ Nth
f1
x0
g(x)f(x)
f0
f2
f3 f4fN
x1 x2 x3 x4 xN...
f x N 1+g x
g x N 1+
CE30125 - Lecture 3
p. 3.2
• The interpolation points or nodes are given as:
:
• There exists only one degree polynomial that passes through a given set of points. It’s form is (expressed as a power series):
where = unknown coefficients, ( coefficients).
• No matter how we derive the degree polynomial,
• Fitting power series
• Lagrange interpolating functions
• Newton forward or backward interpolation
The resulting polynomial will always be the same!
xo f xo fo
x1 f x1 f1
x2 f x2 f2
xN f xN fN
Nth
N 1+
g x ao a1x a2x2 a3x3 aNxN+ + + + +=
ai i 0 N= N 1+
Nth
CE30125 - Lecture 3
p. 3.3
Power Series Fitting to Define Lagrange Interpolation
• must match at the selected data points
: :
• Solve set of simultaneous equations
• It is relatively computationally costly to solve the coefficients of the interpolating func-tion (i.e. you need to program a solution to these equations).
g x f x
g xo fo = ao a1xo a2xo2 aNxo
N+ + + + fo=
g x1 f1 = ao a1x1 a2x12
+ + aNx1N
+ + f1=
g xN fN = ao a1xN+ a2xN2 aNxN
N+ + + fN=
1 xo xo2 xo
N
1 x1 x12 x1
N
1 xN xN2 xN
N
ao
a1
:
aN
fo
f1
:
fN
=
g x
CE30125 - Lecture 3
p. 3.4
Lagrange Interpolation Using Basis Functions
• We note that in general
• Let
where = polynomial of degree associated with each node such that
• For example if we have 5 interpolation points (or nodes)
• The function is such that we do have the required roots, i.e. it equals zero at nodes except at node
• Degree of is
• However in the form presented will not equal to unity at
• We normalize and define the Lagrange basis functions
Vi x
N
xo x1 x2 xi 1– xi 1+ xN xi
Vi xi 1=
Wi x x xo– x x1– x x2– x xi 1–– x xi 1+– x xN– =
Wi
xo x1 x2 ... , xN xi
Wi x N
Wi x xi
Wi x Vi x
Vi x x xo– x x1– x x2– x xi 1–– x xi 1+– x xN–
xi xo– xi x1– xi x2– xi xi 1–– xi xi 1+– xi xN– --------------------------------------------------------------------------------------------------------------------------------------------------------=
CE30125 - Lecture 3
p. 3.6
• Now we have such that equals:
• We also satisfy
e.g.
• The general form of the interpolating function with the specified form of is:
• The sum of polynomials of degree is also polynomial of degree
• is equivalent to fitting the power series and computing coefficients .
Vi x Vi xi
Vi xi xi xo– xi x1– xi x2– xi xi 1–– 1 xi xi 1+– xi xN–
xi xo– xi x1– xi x2– xi xi 1–– xi xi 1+– xi xN– ------------------------------------------------------------------------------------------------------------------------------------------------------------=
• We estimate the fourth derivative of f(x) using the analytical function itself
• Therefore
• Exact error is computed as:
Therefore error estimate is excellent
• Typically we would also have to estimate using a Finite Difference (F.D.)
approximation (a discrete differentiation formula).
f x xln=
f1
x x1–
=
f2
x x2–
–=
f3
x 2x3–
=
f4
x 6x4–
–=
f4
0.6 46.29–=
e 0.60 0.00079–=
E x 0.60 g 0.60 –ln 0.00085–= =
fN 1+
xm
CE30125 - Lecture 3
p. 3.21
SUMMARY OF LECTURES 2 AND 3
• Linear interpolation passes a straight line through 2 data points.
• Power series data points degree polynomial find coefficients bysolving a matrix
• Lagrange Interpolation passes an degree polynomial through data points Use specialized nodal functions to make finding easier.
where
= the interpolating function approximating f(x)
fi = the value of the function at the data (or interpolation) point i
= the Lagrange basis function
• Each Lagrange polynomial or basis function is set up such that it equals unity at thedata point with which it is associated, zero at all other data points and nonzero in-between.
N 1+ Nth
Nth
N 1+g x
g x fiVi x i 0=
N
=
g x
Vi x
CE30125 - Lecture 3
p. 3.22
• For example when N 2 = 3 data points
V0 V1 V2
0 1 2
g x foVo x f1V1 x f2V2 x + +=
f0
f1
f2 g(x)
CE30125 - Lecture 3
p. 3.23
• Linear interpolation is the same as Lagrange Interpolation with
• Error estimates can be derived but depend on knowing (or at some point inthe interval).
where
derivative of w.r.t. evaluated at
N 1=
fN 1+
xm
e x L x f N 1+ = xo xN
fN 1+ N 1
th+= f x
L x x xo– x x1– x xN–
N 1+ !--------------------------------------------------------------- an N 1