LECTURE 3 LAGRANGE INTERPOLATION

LECTURE 3 LAGRANGE INTERPOLATION ? Fit N + 1 points with an Nth degree polynomial

CE30125 - Lecture 3

f2

f0 f1

f3

f4

g(x) f(x)

fN

x0 x1 x2 x3 x4 ... xN

? fx = exact function of which only N + 1 discrete values are known and used to establish an interpolating or approximating function gx

? gx = approximating or interpolating function. This function will pass through all specified N + 1 interpolation points (also referred to as data points or nodes).

p. 3.1

CE30125 - Lecture 3

? The interpolation points or nodes are given as:

xo fxo fo x1 fx1 f1 x2 fx2 f2

:

xN fxN fN

? There exists only one Nth degree polynomial that passes through a given set of N + 1 points. It's form is (expressed as a power series):

gx = ao + a1x + a2x2 + a3x3 + + aNxN

where ai = unknown coefficients, i = 0 N (N + 1 coefficients).

? No matter how we derive the Nth degree polynomial, ? Fitting power series ? Lagrange interpolating functions ? Newton forward or backward interpolation

The resulting polynomial will always be the same!

p. 3.2

Power Series Fitting to Define Lagrange Interpolation

CE30125 - Lecture 3

? gx must match fx at the selected data points

gxo = fo

gx1 = f1

:

gxN = fN

ao + a1xo + a2xo2 + + aNxoN = fo ao + a1x1 + a2x12 + + aNx1N = f1

:

ao + a1xN + a2xN2 + + aNxNN = fN

? Solve set of simultaneous equations

1 xo xo2 xoN ao

fo

1 x1 x12 x1N a1 = f1

:

:

1 xN xN2 xNN aN

fN

? It is relatively computationally costly to solve the coefficients of the interpolating function gx (i.e. you need to program a solution to these equations).

p. 3.3

CE30125 - Lecture 3

Lagrange Interpolation Using Basis Functions

? We note that in general gxi = fi

? Let

N

gx = fi Vix

i=0

where Vix = polynomial of degree N associated with each node i such that

Vi

xj

0 1

ij i = j

? For example if we have 5 interpolation points (or nodes)

gx3 = foVox3 + f1V1x3 + f2V2x3 + f3V3x3 + f4V4x3

Using the definition for Vixj : V0x3 = 0 ; V1x3 = 0 ; V2x3 = 0 ; V3x3 = 1 ; V4x3 = 0 ,we have:

gx3 = f3

p. 3.4

? How do we construct Vix ? ? Degree N ? Roots at xo x1 x2 xi ? 1 xi + 1 xN (at all nodes except xi ) ? Vixi = 1

CE30125 - Lecture 3

? Let Wix = x ? xox ? x1x ? x2x ? xi ? 1x ? xi + 1x ? xN ? The function Wi is such that we do have the required roots, i.e. it equals zero at nodes xo x1 x2 ... , xN except at node xi ? Degree of Wix is N ? However Wix in the form presented will not equal to unity at xi

? We normalize Wix and define the Lagrange basis functions Vix

Vix = ---x---i-x--?---?-x---x-o---o----x---xi---?--?---x-x--1-1------x--x-i---??-----xx---22--------------xx---i-?--?---x-x--i--i?--?--1-1------x--x---?i---?-x---x-i--+i---+-1---1----------x---x--?--i--?x----N-x---N----

p. 3.5

CE30125 - Lecture 3

? Now we have Vix such that Vixi equals:

Vixi = ---x---i-x--?-i---?x---o-x---o---x---i--x-?-i---?-x--1--x---1---x---i-x--?-i---?x---2-x---2----------x---i-x-?--i---?x---i-x-?--i--1?----1---1----x---i-x--?-i---?x---i-x--+-i--1-+---1----------x---i-x--?-i---?x---N-x---N----

Vixi = 1

? We also satisfy Vixj = 0 for i j e.g. V1x2 = ---x--x-2--1--?--?--x--x-o--o-----1---1------x--x-2--1-?--?---x--x-2--2-------x--x-1--2--?--?--x--x-3--3------------x--x-1--2--?--?--x--x-N--N---- = 0

? The general form of the interpolating function gx with the specified form of Vix is:

N

gx = fiVix

i=0

? The sum of polynomials of degree N is also polynomial of degree N ? gx is equivalent to fitting the power series and computing coefficients ao aN .

p. 3.6

CE30125 - Lecture 3

Lagrange Linear Interpolation Using Basis Functions

? Linear Lagrange N = 1 is the simplest form of Lagrange Interpolation

1

gx = fiVix

i=0

gx = foVox + f1V1x

where

Vox = ---x-x--o--?--?---x-x--1-1--- = ---x-x--1-1---?-?---x-x--o---

and

V1x = ---x-x--1--?--?---x-x--o-o---

1.0 V0 (x) x0

V1(x)

(x) x1

p. 3.7

Example

? Given the following data:

xo = 2

fo = 1.5

x1 = 5

f1 = 4.0

Find the linear interpolating function gx

? Lagrange basis functions are:

Vox

=

-5----?-----x3

and

V1x

=

-x----?----2-3

? Interpolating function g(x) is:

gx = 1.5Vox + 4.0V1x

CE30125 - Lecture 3

p. 3.8

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download