



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




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).
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
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
x^3 3
∣∣ ∣∣ ∣
1
− 1
x^2 2
∣∣ ∣∣ ∣
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
)
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 =
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.