Page 170 - Applied Numerical Methods Using MATLAB
P. 170
PROBLEMS 159
(d) From the third-degree Lagrange polynomial matching the four points
(x 0 ,f 0 ), (x 1 ,f 1 ), (x 2 ,f 2 ),and (x 3 ,f 3 ) with x 0 =−3,x 1 =−2,x 2 =
−1, and x 3 = 0, find the coefficients of Lagrange coefficient polyno-
mials L 3,0 (x), L 3,1 (x), L 3,2 (x),and L 3,3 (x). You had better make use
of the routine “lagranp()” for this job.
3.2 Error Analysis of Interpolation Polynomial
Consider the error between a true (unknown) function f(x) and the interpo-
lation polynomial P N (x) of degree N for some (N + 1) points of y = f(x),
that is,
{(x 0 ,y 0 ), (x 1 ,y 1 ), ...,(x N ,y N )}
where f(x) is up to (N + 1)th-order differentiable. Noting that the error is
also a function of x and becomes zero at the (N + 1) points, we can write
it as
e(x) = f(x) − P N (x) = (x − x 0 )(x − x 1 ) ·· · (x − x N )g(x) (P3.2.1)
Technically, we define an auxiliary function w(t) with respect to t as
w(t) = f(t) − P N (t) − (t − x 0 )(t − x 1 ) ·· · (t − x N )g(x) (P3.2.2)
Then, this function has the value of zero at the (N + 2) points t = x 0 ,x 1 ,.. . ,
x N ,x and the 1/2/ ··· /(N + 1)th-order derivative has (N + 1)/N/ ·· · /1
zeros, respectively. For t = t 0 such that w (N+1) (t 0 ) = 0, we have
w (N+1) (t 0 ) = f (N+1) (t 0 ) − 0 − (N + 1)!g(x) = 0;
1 (N+1)
g(x) = f (t 0 ) (P3.2.3)
(N + 1)!
Based on this, show that the error function can be rewritten as
1 (N+1)
e(x) = f(x) − P N (x) = (x − x 0 )(x − x 1 ) ·· · (x − x N ) f (t 0 )
(N + 1)!
(P3.2.4)
3.3 The Approximation of a Cosine Function
In the way suggested below, find an approximate polynomial of degree 4
for
y = f(x) = cos x (P3.3.1)
(a) Find the Lagrange/Newton polynomial of degree 4 matching the fol-
lowing five points and plot the resulting polynomial together with the
true function cos x over [−π, +π].