WEEK 11 CME323 NUMERIC ANALYSIS Lect. Yasin ORTAKCI yasinortakci@karabuk.edu.tr
2 INTERPOLATION Introduction A census of the population of the United States is taken every 10 years. The following table lists the population, in thousands of people, from 1950 to 2000, and the data are also represented in the figure. In reviewing these data, we might ask whether they could be used to provide a reasonable estimate of the population, say, in 1975 or even in the year 2020. Predictions of this type can be obtained by using a function that fits the given data. This process is called interpolation and is the subject of this chapter.
3 (Weierstrass Approximation Theorem) One of the most useful and well-known classes of functions mapping the set of real numbers into itself is the algebraic polynomials, the set of functions of the form P n (x) a n x n + a n 1 x n 1 + + a 1 x + a 0, where n is a nonnegative integer and a 0,..., a n are real constants. Suppose that f is defined and continuous on [a, b]. For each ε > 0, there exists a polynomial P(x), with the property that f (x) P(x) < ε, for all x in [a, b]. (Lagrange, Hermit, Chebische, Lagurre.)
4 Lagrange Interpolating Polynomials The problem of determining a polynomial of degree one that passes through the distinct points (x0, y0) and (x1, y1) is the same as approximating a function f for which f (x0) y0 and f (x1) y1 by means of a first-degree polynomial interpolating, or agreeing with, the values of f at the given points. Using this polynomial for approximation within the interval given by the endpoints is called polynomial interpolation. Define the functions L 0 (x) x x 1 x 0 x 1 L 1 (x) x x 0 x 1 x 0 The linear Lagrange interpolating polynomial through (x0, y0) and (x1, y1) is P(x) L 0 (x) f(x 0 ) + L 1 (x)f(x 1 ) x x 1 x 0 x 1 f(x 0 ) + x x 0 x 1 x 0 f(x 1 ) Note that L 0 (x 0 ) 1, L 0 (x 1 ) 0, L 1 (x 0 ) 0, and L 1 (x 1 ) 1, which implies that P(x 0 ) 1 f (x 0 ) + 0 f (x 1 ) f (x 0 ) y 0 and P(x 1 ) 0 f (x 0 ) + 1 f (x 1 ) f (x 1 ) y 1.
5 So P is the unique polynomial of degree at most one that passes through (x0, y0) and (x1, y1). Example 1 Determine the linear Lagrange interpolating polynomial that passes through the points (2, 4) and (5, 1). Solution In this case we have L 0 x 5 5 x 2 5 3 and L 1 x 2 3 so P(x) 5 x 3 4 + x 2 3 1 6 x n. degree Lagrange polinomial L n,k (x x 0)(x x 1 ).. (x x k 1 )(x x k+1 ).. (x x n ) (x k x 0 )(x k x 1 ).. (x k x k 1 )(x k x k+1 ).. (x k x n ) n L n,k (x x i) (x k x i ) i0 i k nth Lagrange interpolating polynomial P(x) L n,0 f(x 0 ) + L n,1 f(x 1 ) + + L n,n f(x n ) n P(x) L n,k f(x k ) k0
6 Theorem: If x 0, x 1,, x n (n + 1) are (n + 1)distinct numbers and f is a function whose values are given at these numbers, then a unique polynomial P(x) of degree at most n exists with f(x k ) P(x k ) for each k 0,1,2,, n Ex: Use the numbers (called nodes) x0 2, x1 2.75, and x2 4 to find the second Lagrange interpolating polynomial for f (x) 1/x. (f (3) 1/3) Solution: L 0 (x x 1)(x x 2 ) (x 2.75)(x 4) (x 0 x 1 )(x 0 x 2 ) (2 2.75)(2 4) 2 3 L 1 (x x 0)(x x 2 ) (x 1 x 0 )(x 1 x 2 ) (x 2)(x 4) (2.75 2)(2.75 4) 16 15 L 2 (x x 0)(x x 1 ) (x 2)(x 2.75) (x 2 x 0 )(x 2 x 1 ) (4 2)(4 2.75) 2 5 f(x) 1 so f(x x 0) 1, f(x 2 1) 1 ve f(x 2.75 2) 1 4 (x 2.75)(x 4) (x 2)(x 4) (x 2)(x 2.75)
7 P(x) 2 3 (x 2.75)(x 4) 1 2 16 15 (x 2)(x 4) 1 2.75 + 2 5 (x 2)(x 2.75) 1 4 P(x) 1 3 (x 2.75)(x 4) 64 55 1 (x 2)(x 4) + (x 2)(x 2.75) 10 Approximate Value: P(3) 29 88 0.32954 Real Value: f(3) 1 3 0.33333 f(3) P(3)'dir. EXAMPLE: Fit the curve of the following (x,y) value pairs using Lagrange intepolation method. Find the value of curve (y) at point x 5.5 and x 2. x 0 1 3 5 y -16-3 -17 41 SOLUTION: Number of the points given is four, so the degree of Lagrange polinomial is three. Apply the general formula by finding L 0, L 1, L 2, L 3. P(x) L 0 (x). y 0 + L 1 (x). y 1 + L 2 (x). y 2 + L 3 (x). y 3 L 0 (x x 1)(x x 2 )(x x 3 ) (x 1)(x 3)(x 5) (x 0 x 1 )(x 0 x 2 )(x 0 x 3 ) (0 1)(0 3)(0 5) x3 9x 2 + 23x 15 ( 15) L 1 (x x 0)(x x 2 )(x x 3 ) (x 1 x 0 )(x 1 x 2 )(x 1 x 3 ) (x 0)(x 3)(x 5) (1 0)(1 3)(1 5) x3 8x 2 + 15 8
8 L 2 (x x 0)(x x 1 )(x x 3 ) (x 0)(x 1)(x 5) (x 2 x 0 )(x 2 x 1 )(x 2 x 3 ) (3 0)(3 1)(3 5) x3 + 6x 2 5 12 L 3 (x x 0)(x x 1 )(x x 2 ) (x 0)(x 1)(x 3) (x 3 x 0 )(x 3 x 1 )(x 3 x 2 ) (5 0)(5 1)(5 3) x3 4x 2 + 3x 40 P(x) 16L 0 3L 1 17L 2 + 41L 3 P(x) 376x3 2304x 2 + 3313x + 1595 120 bulunur. The values of P( 2) and P(5.5) are found and list in the following table. x -2 0 1 3 5 5.5 y -176-16 -3-17 41 84.375 The curve was fit by available values are below:
9 Algorithm INPUT the number of sample points (n + 1), the entries (x k, f(x k )) 0 k n, x value to interpolate OUTPUT the approximate solution (y P(x)) of given x value. Step 1 For k 0,..., n n L n,k (x) (x x i) Step 2 n i0 i k (x k x i ) P(x) L n,k f(x k ) k0 Step 3 OUTPUT (P(x)); STOP. Kaynakça Richard L. Burden, Richard L. Burden (2009). Numerical Analysis Brooks/Cole Cengage Learning, Boston. Doç. Dr. İbrahim UZUN, (2004), "Numarik Analiz Beta Yayıncılık.