Numerical Analysis Lecture 18 Chapter 5 Interpolation Finite Difference Operators Newton’s Forward Difference Interpolation Formula Newton’s Backward Difference Interpolation Formula Lagrange’s Interpolation Formula Divided Differences Interpolation in Two Dimensions Cubic Spline Interpolation Introduction Finite differences play an important role in numerical techniques, where tabulated values of the functions are available. For instance, consider a function y f ( x). As x takes values x0 , x1 , x2 , , xn , let the corresponding values of y be y0 , y1 , y2 , , yn . That is, for given a table of values, ( xk , yk ), k 0,1, 2, , n; the process of estimating the value of y, for any intermediate value of x, is called interpolation. The method of computing the value of y, for a given value of x, lying outside the table of values of x is known as extrapolation. If the function f (x) is known, the value of y corresponding to any x can be readily computed to the desired accuracy. For interpolation of a tabulated function, the concept of finite differences is important. The knowledge about various finite difference operators and their symbolic relations are very much needed to establish various interpolation formulae. Finite Difference Operators Finite Difference Operators Forward Differences Backward Differences Central Difference Forward Differences For a given table of values ( xk , yk ), k 0,1, 2,..., n with equally spaced abscissas of a function y f ( x), we define the forward difference operator as follows To be explicit, we write y0 y1 y0 y1 y2 y1 yn 1 yn yn 1 These differences are called first differences of the function y and are y denoted by the symbol i Here, is called the first difference operator Similarly, the differences of the first differences are called second differences, defined by y0 y1 y0 , 2 y1 y2 y1 2 Thus, in general yi yi 1 yi 2 Here is called the second difference operator. Thus, continuing, we can define, r-th difference of y, as 2 r 1 r 1 yi yi 1 yi r By defining a difference table as a convenient device for displaying various differences, the above defined differences can be written down systematically by constructing a difference table for values ( xk , yk ), k 0,1,...,6 Forward Difference Table This difference table is called forward difference table or diagonal difference table. Here, each difference is located in its appropriate column, midway between the elements of the previous column. Please note that the subscript remains constant along each diagonal of the table. The first term in the table, that is y0 is called the leading term, while the differences y0 , y0 , y0 ,... 2 3 are called leading differences Example Construct a forward difference table for the following values of x and y: Solution Example Express y0 and y0 in terms of the values of the function y. 2 3 Solution: Noting that each higher order difference is defined in terms of the lower order difference, we have y0 y1 y0 ( y2 y1 ) ( y1 y0 ) 2 y2 2 y1 y0 and 3 y0 2 y1 2 y0 (y2 y1 ) ( y1 y0 ) ( y3 y2 ) ( y2 y1 ) ( y2 y1 ) ( y1 y0 ) y3 3 y2 3 y1 y0 Hence, we observe that the coefficients of the values of y, 2 3 in the expansion of y0 , y0 , are binomial coefficients. Thus, in general, we arrive at the following result: - y0 yn C1 yn1 C2 yn2 n n C3 yn3 n n (1) y0 n Example Show that the value of yn can be expressed in terms of the leading value y0 and the leading differences y0 , y0 , 2 , y0 . n Solution The forward difference table will be y1 y0 y0 or y1 y0 y0 y2 y1 y1 or y2 y1 y1 y3 y2 y2 or y3 y2 y2 Similarly, y1 y0 y0 or y1 y0 y0 2 2 y2 y1 y1 or y2 y1 y1 2 2 Similarly, we can also write y1 y0 y0 or y1 y0 y0 2 2 3 2 2 3 y2 y1 y1 or y2 y1 y1 2 2 3 2 2 3 y2 (y0 y0 ) ( y0 y0 ) 2 2 3 y0 2 y0 y0 2 3 y3 y2 y2 ( y1 y1 ) (y1 y1 ) 2 y0 3y0 3 y0 y0 2 (1 ) y0 3 3 Similarly, we can symbolically write y (1 ) y , 1 0 y2 (1 ) y0 , 2 y3 (1 ) y0 3 ........ yn (1 ) y0 n Hence, we obtain yn y0 C1y0 C2 y0 n n C3 y0 n 3 y0 n n yn Ci y0 n i 0 i 2 Numerical Analysis Lecture 18 Backward Differences For a given table of values ( xk , yk ), k 0,1, 2,..., n of a function y = f (x) with equally spaced abscissas, the first backward differences are usually expressed in terms of the backward difference operator as yi yi yi 1i n, (n 1), y1 y1 y0 OR y2 y2 y1 yn yn yn 1 ,1 The differences of these differences are called second differences and they are denoted by 2 y , 2 y , , 2 y . 2 3 n That is y1 y2 y1 2 y2 y3 y2 2 yn yn yn 1 2 Thus, in general, the second backward differences are yi yi yi 1, i n,(n 1),..., 2 2 while the k-th backward differences are given as k 1 k 1 yi yi yi 1, i n,(n 1),..., k k These backward differences can be systematically arranged for a table of values ( xk , yk ), k 0,1,...,6 Backward Difference Table From this table, it can be observed that the subscript remains constant along every backward diagonal. Example Show that any value of y can be expressed in terms of yn and its backward differences. Solution From yi yi yi 1i n, (n 1), ,1 We get From We get yn1 yn yn yn2 yn1 yn1 yi yi yi 1, i n,(n 1),..., 2 2 yn1 yn 2 yn From these equations, we obtain yn2 yn 2yn yn 2 Similarly, we can show that yn3 yn 3yn 3 yn yn 2 3 Symbolically, these results can be rewritten as follows: yn 1 (1 ) yn yn 2 (1 ) yn 2 yn 3 (1 ) yn 3 ....... yn r (1 ) yn r ynr yn C1yn C2 yn n n 2 (1) yn r r Central Differences In some applications, central difference notation is found to be more convenient to represent the successive differences of a function. Here, we use the symbol to represent central difference operator and the subscript of y for any difference as the average of the subscripts y1 2 y1 y0 , In general y3 2 y2 y1 , yi yi(1 2) yi(1 2) Higher order differences are defined as follows: yi yi(1 2) yi(1 2) 2 yi n n1 yi(1 2) n1 yi (1 2) These central differences can be systematically arranged as indicated in the Table Thus, we observe that all the odd differences have a fractional suffix and all the even differences with the same subscript lie horizontally. The following alternative notation may also be adopted to introduce finite difference operators. Let y = f (x) be a functional relation between x and y, which is also denoted by yx. Suppose, we are given consecutive values of x differing by h say x, x + h, x +2h, x +3h, etc. The corresponding values of y are yx , yxh , yx2h , yx3h , As before, we can form the differences of these values. Thus yx yxh yx f ( x h) f ( x) yx yxh yx 2 Similarly yx yx yxh f ( x) f ( x h) yx yx ( h / 2) yx ( h / 2) h f x 2 h f x 2 Numerical Analysis Lecture 18