Docsity

Lagrange Interpolation and Error Formula, Exams of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Final Exam, Math 471
11 December, 2008
Name: Solutions
1. (10 points): Let f: [a, b]→Rand let {x0, x1,...,xn}be a set of n+ 1 distinct
interpolation points in [a, b]. Let us assume that n > 0. The Lagrange interpolating
polynomial for fof degree nis defined as
pn(x) =
n
X
k=0
Lk(x)f(xk)
(a) Define Lk(x). (b) Prove that Lk(xj) = δjk.(c) Suppose f∈C(n+1) [a, b]. State
the Lagrange interpolation error formula, i.e., the formula for f(x)−pn(x).
Solution: (a)
Lk(x) =
n
Y
i=0
i6=k
x−xi
xk−xi
.
(b) Suppose j6=k. Then
Lk(xj) =
n
Y
i=0
i6=k
xj−xi
xk−xi
= 0,
because xj−xi= 0 when j=i. Also
Lk(xk) =
n
Y
i=0
i6=k
xk−xi
xk−xi
=
n
Y
i=0
i6=k
1 = 1,
which proves the result.
(c) The error formula is the following: for any x∈[a, b],
f(x)−pn(x) = f(n+1)(ξ)
(n+ 1)! πn+1(x),
for some ξ=ξ(x)∈(a, b), where
πn+1(x) = (x−x0)···(x−xn).
1
pf3
pf4
pf5

Partial preview of the text

Download Lagrange Interpolation and Error Formula and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Final Exam, Math 471

11 December, 2008

Name: Solutions

  1. (10 points): Let f : [a, b] → R and let {x 0 , x 1 ,... , xn} be a set of n + 1 distinct interpolation points in [a, b]. Let us assume that n > 0. The Lagrange interpolating polynomial for f of degree n is defined as

pn(x) =

∑^ n

k=

Lk(x)f (xk)

(a) Define Lk(x). (b) Prove that Lk(xj ) = δjk. (c) Suppose f ∈ C(n+1)[a, b]. State the Lagrange interpolation error formula, i.e., the formula for f (x) − pn(x).

Solution: (a)

Lk(x) =

∏^ n i= i 6 =k

x − xi xk − xi

(b) Suppose j 6 = k. Then

Lk(xj ) =

∏^ n i i=0 6 =k

xj − xi xk − xi

because xj − xi = 0 when j = i. Also

Lk(xk) =

∏^ n i= i 6 =k

xk − xi xk − xi

∏^ n i= i 6 =k

which proves the result.

(c) The error formula is the following: for any x ∈ [a, b],

f (x) − pn(x) =

f (n+1)(ξ) (n + 1)!

πn+1(x),

for some ξ = ξ(x) ∈ (a, b), where

πn+1(x) = (x − x 0 ) · · · (x − xn).

  1. (10 points): (a) Construct the Lagrange interpolating polynomial of degree 1, denoted by p 1 , for the function f (x) = (x − a)^3 using the interpolation points x 0 = 0 and x 1 = a. (b) Confirm the Lagrange interpolation error formula showing that ξ = (x + a)/3.

Solution: (a) We need the polynomials L 0 (x) and L 1 (x):

L 0 (x) =

x − x 1 x 0 − x 1

x − a 0 − a

a − x a

; L 1 (x) =

x − x 0 x 1 − x 0

x − 0 a − 0

x a

Hence, p 1 (x) =

a − x a

f (0) +

x a

f (a) =

a − x a

(−a^3 ) = a^2 (x − a).

(b) The error formula reads

f (x) − p 1 (x) =

f ′′(ξ) 2

x(x − a),

for some ξ ∈ (0, a). f ′(x) = 3(x − a) and f ′′(x) = 6(x − a), whence

(x − a)^3 − a^2 (x − a) =

6(ξ − a) 2

x(x − a).

Simplifying, (x − a)

{ (x − a)^2 − a^2

} = 3(ξ − a)x(x − a). or, equivalently, (x − a)x(x − 2 a) = 3(ξ − a)x(x − a). We assume x 6 = 0 and x 6 = a; otherwise the error formula is trivially satisfied. Canceling the non-zero factors x and x − a yields

3(ξ − a) = (x − 2 a),

from which we see that ξ = (x + a)/3.

  1. (10 points): The Newton-Cotes formula with n = 3 on the interval [− 1 , 1] is ∫ (^1)

− 1

f (x) dx ≈ w 0 f (−1) + w 1 f (− 1 /3) + w 2 f (1/3) + w 3 f (1).

Using the fact that this formula is to be exact for all polynomials of degree 3 show that

2 w 0 + 2w 1 = 2 ,

2 w 0 +

w 2 =

and hence find the values of the weights w 0 , w 1 , w 2 , and w 3.

Solution: First we note that w 0 = w 3 and w 1 = w 2. Let f (x) = a 3 x^3 + a 2 x^2 + a 1 x + a 0. Then

I(f ) =

∫ (^1)

− 1

f (x) dx = a 3

x^4 4

∣∣ ∣∣ ∣

1

− 1

  • a 2

x^3 3

∣∣ ∣∣ ∣

1

− 1

  • a 1

x^2 2

∣∣ ∣∣ ∣

1

− 1

  • a 0 x|^1 − 1

= 0 a 3 +

a 2 + 0a 1 + 2a 0.

The Newton-Cotes formula gives

A 3 (f ) = w 0 (−a 3 + a 2 − a 1 + a 0 ) + w 1

( −

a 3 +

a 2 −

a 1 + a 0

)

+w 2

a 3 +

a 2 +

a 1 + a 0

)

  • w 3 (a 3 + a 2 + a 1 + a 0 ).

Setting I(f ) = A 3 (f ) and equating coefficients of a 3 , a 2 , a 1 , and a 0 , we have the following 4 equations:

a 3 : 0 = −w 0 −

w 1 +

w 2 + w3 = 0,

a 2 :

= w 0 +

w 1 +

w 2 + w 3 = 2w 0 +

w 2 ,

a 1 : 0 = −w 0 −

w 1 +

w 2 + w 3 = 0, a 0 : 2 = w 0 + w 1 + w 2 + w 3 = 2w 0 + 2w 1 = 2w 0 + 2w 2.

The first and third equations give no information. Solving the second and fourth equations, however, yields 2 3

= 2 − 2 w 2 +

w 2 or w 2 =

Hence, w 0 = 14. All the coefficients are

w 0 = w 3 =

and w 1 = w 2 =

  1. (10 points): Taylor’s second-order method is defined via

yn+1 = yn + hΦ(xn, yn; h), y 0 = y(x 0 ), where Φ(xn, yn; h) = f (xn, yn) +

h 2

f ′(xn, yn).

(a) Calculate an explicit formula for Φ when y′(x) = f (x, y) = (x + 1)y. (b) Calculate y 1 and y 2 , whenever x 0 = 0 and y 0 = y(0) = 1.

Solution: (a) We need

f ′(x, y) =

∂f ∂x

(x, y) +

∂f ∂y

(x, y)f (x, y)

= y + (x + 1)^2 y =

( 1 + (x + 1)^2

) y. Thus

Φ(x, y; h) = f (x, y) +

h 2

f ′(x, y)

= (x + 1)y +

h 2

( 1 + (x + 1)^2

) y =

[ x + 1 +

h 2

( 1 + (x + 1)^2

)] y.

(b) We have

yn+1 = yn + hΦ(xn, yn; h) = yn + h

[ xn + 1 +

h 2

( 1 + (xn + 1)^2

)] yn

{ 1 + h

[ xn + 1 +

h 2

( 1 + (xn + 1)^2

)]} yn

Thus,

y 1 =

{ 1 + h

[ x 0 + 1 +

h 2

( 1 + (x 0 + 1)^2

)]} y 0

{ 1 + h

[ 0 + 1 +

h 2

( 1 + (0 + 1)^2

)]} 1

= 1 + h

[ 1 +

h 2

] = 1 + h [1 + h] = 1 + h + h^2.

Likewise, noting that x 1 = h,

y 2 =

{ 1 + h

[ x 1 + 1 +

h 2

( 1 + (x 1 + 1)^2

)]} y 1

{ 1 + h

[ h + 1 +

h 2

( 1 + (h + 1)^2

)]} ( 1 + h + h^2

) .

Simplification isn’t necessary. The important point is knowing how to use the formula.