Interpolation and Polynomial Approximation



Interpolation and Polynomial Approximation

3.1 Interpolation and the Lagrange Polynomial

3.1.1 Lagrangian Form

Consider a polynomial of degree (n ( 1):

P(x) = a1x n-1 + a2x n-2 +... + an-1x + an

where the ai are constants. The polynomial can be written in Lagrangian form:

P(x) = c1(x ( (2) (x ( (3)... (x ( (n) + c2(x ( (1) (x ( (3)... (x ( (n) + ...

ci(x ( (1) (x ( (2) ... (x ( (i-1) (x ( (i+1) ... (x ( (n) + ...

cn(x ( (1) (x ( (2)... (x ( (n-1)

where (i, i = 1, 2, ..., n are arbitrary scalars, while the constants ci are related to the constants ai.

Example 3.1-1 _____________________________________________________

Write the polynomial P(x) = x 2 ( 4x + 3 in the Lagrangian form.

Solution

The Lagrangian form for P(x) = x 2 ( 4x + 3 is

P(x) = c1(x ( (2) (x ( (3) + c2(x ( (1) (x ( (3) + c3(x ( (1) (x ( (2)

where (i, i = 1, 2, 3 are arbitrary scalars. Let (1 = 1, (2 = 2, (3 = 3, then

P(x) = c1(x ( 2) (x ( 3) + c2(x ( 1) (x ( 3) + c3(x ( 1) (x ( 2)

The constants c1 can be evaluated from the above relation by substituting x = (1 = 1

P(x = 1) = 1 ( 4 + 3 = c1(1 ( 2) (1 ( 3) ( c1 = 0

For x = (2 = 2

P(x = 2) = 4 ( 8 + 3 = c2(2 ( 1) (2 ( 3) ( c2 = 1

For x = (3 = 3

P(x = 3) = 9 ( 12 + 3 = c3(3 ( 1) (3 ( 2) ( c3 = 0

The Lagrangian form for the polynomial is

P(x) = (x ( 1)(x ( 3)

Let (1 = ( 2, (2 = ( 1, (3 = 2, then

P(x) = c1(x + 1) (x ( 2) + c2(x + 2) (x ( 2) + c3(x + 2) (x + 1)

The constants ci can be evaluated to obtain: c1 = 3.7500, c2 = -2.6667, and c3 = -0.0833. The Lagrangian form for the polynomial is

P(x) = 3.7500 (x + 1) (x ( 2) ( 2.6667 (x + 2) (x ( 2) ( 0.0833 (x + 2) (x + 1)

A short form notation for P(x) is

P(x) = [pic][pic]

where [pic] denotes product of all terms (x ( (k), for k varying from 1 to n except i. Let x = (i then

P((i) = ci((i ( (1) ((i ( (2) ... ((i ( (i-1) ((i ( (i+1) ... ((i ( (n)

The constant ci can be expressed as

ci = [pic]

3.1.2 Polynomial Approximation

Consider a function f(x) that passes through the two distinct points (x0, f(x0)) and (x1, f(x1)) as shown in Figure 3.1-1. The first order polynomial that approximates the function between these two points can be expressed as

P(x) = a + bx

where a and b are constants. P(x) can also be written in Lagrangian form as

P(x) = c0(x ( x1) + c1(x ( x0)

[pic]

Figure 3.1-1 First and second order polynomial approximation.

where

ci = [pic]

or

c0 = [pic] = [pic], and c1 = [pic] = [pic]

The approximating polynomial is finally

P(x) = [pic] f(x0) + [pic] f(x1)

The first order polynomial basis function L0(x) is defined as

L0(x) = [pic] = [pic]

Similarly, the first order polynomial basis function L1(x) is defined as

L1(x) = [pic] = [pic]

In terms of the basis function, P(x) can be written as

P(x) = L0(x) f(x0) + L1(x) f(x1)

If a second order polynomial is used to approximate the function using three points (x0, f(x0)), (x1, f(x1)), and (x2, f(x2)) then

P(x) = [pic] f(x0) + [pic] f(x1) + [pic] f(x2)

P(x) can also be written in terms of the second order polynomial basis function L2,k(x)

P(x) = L2,0(x) f(x0) + L2,1(x)f(x1) + L2,2(x)f(x2)

where L2,0(x) = [pic] = [pic]

In general: L2,k(xk) = 1 at node k, L2,k(xi) = 0 at other nodes.

We now seek a polynomial P(x) of degree n that interpolates a given function f(x) between the node xi of the grid for which there are n+1 nodes x0, x1, (, xn and

P(xk) = f(xk) for each k = 1, 2, (, n

The polynomial is given by

P(x) = Ln,0(x) f(x0) + Ln,1(x) f(x1) + ( + Ln,n(x)f(xn) = [pic] f(xk)

where Ln,k(x) = [pic]; Ln,k(xi) = 0 and Ln,k(xk) = 1

Polynomial approximation constitutes the foundation upon which we shall build the various numerical methods. The approximation P(x) to f(x) is known as a Lagrange interpolation polynomial, and the function Ln,k(x) is called a Lagrange basis polynomial.

Example 3.1-2 _____________________________________________________

Find the Lagrange interpolation polynomial that takes the values prescribed below

|xk |0 |1 |2 |4 |

|f(xk) |1 |1 |2 |5 |

Solution

P(x) = [pic] f(xk)

P(x) = [pic](1) + [pic](1)

+ [pic](2) + [pic](5)

When working with grids having large numbers of intervals one typically assigns a set of low degree (n = 1, 2, or 3) basis functions to each adjacent set of n+1 = 2, 3, or 4 nodes.

Example 3.1-3 _____________________________________________________

Use global interpolation by one polynomial and piecewise polynomial interpolation with quadratic for the following nodes.

|xk |0 |1 |2 |4 |5 |

|f(xk) |0 |16 |48 |88 |0 |

Solution

Global interpolation by one polynomial: P(x) = [pic] f(xk)

P(x) = [pic](0) + [pic](16)

+ [pic](48) + [pic](88) + 0

Piecewise polynomial interpolation with quadratic

P(x) = [pic](0) + [pic](16) + [pic](48); 0 ( x ( 2

P(x) = [pic](48) + [pic] (88) + [pic](0); 2 ( x ( 5

The error En(x) associated with the interpolation of f(x) by Pn(x) over the interval [x0, xn] can be estimated as

En(x) = f(x) ( Pn(x) = [pic][pic](()

where ( is some number lying in the open interval (x0, xn) and

Wn(x) = (x ( x0)(x ( x1) ( (x ( xn)

When the spacial increments are uniform

xk+1 ( xk = h, k = 0, 1, 2, (, n-1

Let x = x0 + (h, since

x1 = x0 + h ( x ( x1 = (( ( 1)h

xn = x0 + nh ( x ( xn = (( ( n)h

Wn(x) = (x ( x0)(x ( x1) ( (x ( xn) = ((h)[(( ( 1)h] ([(( ( n)h]

The error associated with interpolation is then

En(x) = [pic][pic](() = [pic]((h)[(( ( 1)h] ([(( ( n)h] [pic](()

The only variable in the above expression is h the spacing of the nodes, therefore

En(x) = Chn+1, x0 < ( < xn

where C is a coefficient independent of h.

We can therefore write En(x) = O(hn+1) meaning that the ratio En(x)/ hn+1 is bounded by a constant as h ( 0. As the increment h decreases, so also will the interpolation error En.

Example 3.1-4 _____________________________________________________

For the function f(x) = ln(x + 1), construct interpolation polynomials of degree one and two to approximate f(0.45) from the given nodes. Find the error bound and the actual error.

|xk |0 |0.6 |0.9 |

|ln(x + 1) |1 |0.47000 |0.64185 |

Solution

First degree polynomial

P1(x) = [pic](0) + [pic](0.47) = 0.78334x

P1(0.45) = 0.3525

Error bound: En(x) = [pic](x ( x0)(x ( x1) ( (x ( xn) [pic](()

E1(x) = |[pic](x ( x0)(x ( x1)|

f(x) = ln(x + 1) ( f’(x) = [pic] ( f”(x) = ([pic] f””(x) = [pic]

E1(x) = |[pic][pic](0.45 ( 0)(0.45 ( 0.6)| = 3.375(10-2

Actual error = |ln(1 + 0.45) ( P1(0.45)| = 1.906(10-2

Second degree polynomial

P2(x) = [pic](0) + [pic](0.47)

+ [pic](0.64185)

P2(0.45) = 0.36829

Error bound: E2(x) = |[pic](x ( x0)(x ( x1)(x ( x2)|

E2(x) = |[pic][pic](0.45 ( 0)(0.45 ( 0.6)(0.45 ( 0.9)| = 1.0125(10-2

Actual error = |ln(1 + 0.45) ( P2(0.45)| = 3.2729(10-3

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

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

Google Online Preview   Download