5 Ders
5 Ders
where n is a nonnegative integer and a0 , ..., an are real constants. One reason
for their importance is that they uniformly approximate continuous functions.
Suppose that f is defined and continuous on [a, b]. For each ε > 0, there
exists a polynomial P (x), with the property that
1
1.1 Lagrange Interpolating Polynomials
Suppose n = 1 and we have only two points (x0 , f (x0 )) and (x1 , f (x1 )). The
linear Lagrange interpolating polynomial through (x0 , f (x0 )) and (x1 , f (x1 ))
is
(x − x1 ) (x − x0 )
P (x) = L0 (x)f (x0 ) + L1 (x)f (x1 ) = f (x0 ) + f (x1 )
(x0 − x1 ) (x1 − x0 )
which implies that
2
NOTE: We will write Ln,k (x) simply as Lk (x) when there is no confusion
as to its degree.
Example 2:
(i) Use the nodes x0 = 2, x1 = 2.75, and x2 = 4 to find the second Lagrange
interpolating polynomial for f (x) = 1/x.
(ii) Use this polynomial to approximate f (3) = 1/3.
Solution:
(ii)
1 2 35 49
f (3) ≈ P2 (3) = (3) − 3 + ≈ 0.32955
22 88 44
1
((The value of f (x) at x = 3 is 3 ≈ 0.3333)
f (n+1) (ξ(x))
f (x) = P (x) + (x − x0 ) (x − x1 ) ... (x − xn )
(n + 1)!
3
Example: Compute the maximum absolute error for Example 2 for x ∈
[2, 4] .
f 000 (ξ(x)) 1
(x − x0 ) (x − x1 ) (x − x2 ) = − (x − 2) (x − 2.75) (x − 4)
3! (ξ(x))4
1 1 1
where ξ(x) in (2, 4) . The maximum value of (ξ(x))4 = 24 = 16 . Let’s define
35 2 49
g(x) = (x − 2) (x − 2.75) (x − 4) = x3 − x + x − 22
4 2
Since
d 35 2 49 35 49 1
x − x + x − 22 = 3x2 − x +
3
= (3x − 7)(2x − 7)
dx 4 2 2 2 2
f 000 (ξ(x)) 1
(x − x0 ) (x − x1 ) (x − x2 ) = − (x − 2) (x − 2.75) (x − 4)
3! (ξ(x))4
1 9
≤ ≈ 0.0352
16 16
DİVİDED DİFFERENCES
(ALTERNATE ALGEBRAİC FORMULA FOR INTERPOLATION)
x x0 x1 x2 ... xn
f(x) f(x0 ) f(x1 ) f(x2 ) ... f(xn )
4
The points x0 , x1 , ..., xn are assumed to be distinct.
Note that
a0 = Pn (x0 ) = f (x0 ) (2)
Similarly, when Pn (x) is evaluated at x1
so
f (x1 ) − f (x0 )
a1 = (3)
x1 − x0
We now introduce the divided-difference notation. The zeroth divided
difference of the function f with respect to xi , denoted f [xi ], is simply
the value of f at xi :
f [xi ] = f (xi ) (4)
The remaining divided differences are defined recursively; the first divided
difference of f with respect to xi and xi+1 is denoted f [xi , xi+1 ] and defined
as
f [xi+1 ] − f [xi ]
f [xi , xi+1 ] = (5)
xi+1 − xi
The second divided difference, f [xi , xi+1 , xi+2 ] is defined as
Similarly, after the (k − 1)st divided differences, the kth divided difference
relative to xi , xi+1 , xi+2 , ..., xi+k is
5
The process ends with the single nth divided difference,
Pn (x) = f [x0 ]+f [x0 , x1 ](x−x0 )+f [x0 , x1 , x2 ](x−x0 )(x−x1 )+...+f [x0 , x1 , ..., xn ](x−x0 )...(x−xn−1 )
(9)
So Pn (x) can be rewritten in a form called Newton’s Divided-Difference:
n
X
Pn (x) = f [x0 ] + f [x0 , x1 , ..., xk ](x − x0 )...(x − xk−1 ) (10)
k=1
Example 1 For the table write out the Newton-Form of the interpolating poly-
nomial.
x 1 -4 0
f(x) 3 13 -23
f [x0 ] = 3
f [x1 ] = 13
f [x2 ] = −23
f [x1 ] − f [x0 ] 13 − 3
f [x0 , x1 ] = = = −2
x1 − x0 −4 − 1
f [x2 ] − f [x1 ] −23 − 13
f [x1 , x2 ] = = = −9
x2 − x1 0+4
f [x1 , x2 ] − f [x0 , x1 ] −9 + 2
f [x0 , x1 , x2 ] = = =7
x2 − x0 0−1
P2 (x) = 3 − 2 (x − 1) + 7 (x − 1) (x + 4)
6
f [x0 ] = 3
13
f [x1 ] =
4
f [x2 ] = 3
5
f [x3 ] =
3
13
f [x1 ] − f [x0 ] 4 −3 1
f [x0 , x1 ] = = 3 =
x1 − x0 2 −1
2
f [x2 ] − f [x1 ] 3 − 13
4 1
f [x1 , x2 ] = = =
x2 − x1 0 − 32 6
5
f [x3 ] − f [x2 ] 3 −3 2
f [x2 , x3 ] = = =−
x3 − x2 2−0 3
1 1
f [x1 , x2 ] − f [x0 , x1 ] − 1
f [x0 , x1 , x2 ] = = 6 2 =
x2 − x0 0−1 3
f [x2 , x3 ] − f [x1 , x2 ] − 32 − 61 5
f [x1 , x2 , x3 ] = = 3 =−
x3 − x1 2− 2 3
f [x1 , x2 , x3 ] − f [x0 , x1 , x2 ] −5 − 1
f [x0 , x1 , x2 , x3 ] = = 3 3 = −2
x3 − x0 2−1
Thus, we obtain
1 1 3 3
P3 (x) = 3 + (x − 1) + (x − 1) x − − 2 (x − 1) x − x
2 3 2 2