MATH1070 3 Interpolation.Pdf

MATH1070 3 Interpolation.Pdf

> 4. Interpolation and Approximation Most functions cannot be evaluated exactly: √ x, ex, ln x, trigonometric functions since by using a computer we are limited to the use of elementary arithmetic operations +, −, ×, ÷ With these operations we can only evaluate polynomials and rational functions (polynomial divided by polynomials). 4. Interpolation Math 1070 > 4. Interpolation and Approximation Interpolation Given points x0, x1, . , xn and corresponding values y0, y1, . , yn find a function f(x) such that f(xi) = yi, i = 0, . , n. The interpolation function f is usually taken from a restricted class of functions: polynomials. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1 Polynomial Interpolation Theory Interpolation of functions f(x) x0, x1, . , xn f(x0), f(x1), . , f(xn) Find a polynomial (or other special function) such that p(xi) = f(xi), i = 0, . , n. What is the error f(x) = p(x)? 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.1 Linear interpolation Linear interpolation Given two sets of points (x0, y0) and (x1, y1) with x0 6= x1, draw a line through them, i.e., the graph of the linear polynomial x − x1 x − x0 x0 x1 `(x) = y0 + y1 x0 − x1 x1 − x0 y0 y1 (x − x)y + (x − x )y `(x) = 1 0 0 1 (5.1) x1 − x0 We say that `(x) interpolates the value yi at the point xi, i = 0, 1, or `(xi) = yi, i = 0, 1 Figure: Linear interpolation 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.1 Linear interpolation Example Let the data points be (1, 1) and (4,2). The polynomial P1(x) is given by (4 − x) · 1 + (x − 1) · 2 P (x) = (5.2) 1 3 √ The graph y = P1(x) and y = x, from which the data points were taken. √ Figure: y = x and its linear interpolating polynomial (5.2) 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.1 Linear interpolation Example Obtain an estimate of e0.826 using the function values e0.82 =· 2.270500, e0.83 =· 2.293319 Denote x0 = 0.82, x1 = 0.83. The interpolating polynomial P1(x) x interpolating e at x0 and x1 is (0.83 − x) · 2.270500 + (x − 0.82) · 2.293319 P (x) = (5.3) 1 0.01 and P1(0.826) = 2.2841914 while the true value s e0.826 =· 2.2841638 to eight significant digits. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.2 Quadratic Interpolation Assume three data points (x0, y0), (x1, y1), (x2, y2), with x0, x1, x2 distinct. We construct the quadratic polynomial passing through these points using Lagrange’s folmula P2(x) = y0L0(x) + y1L1(x) + y2L2(x) (5.4) with Lagrange interpolation basis functions for quadratic interpolating polynomial (x−x1)(x−x2) L0(x) = (x0−x1)(x0−x2) (x−x0)(x−x2) L1(x) = (5.5) (x1−x0)(x1−x2) (x−x0)(x−x1) L2(x) = (x2−x0)(x2−x1) Each L (x) has degree 2 ⇒ P (x) has degree ≤ 2. Moreover i 2 Li(xj) = 0, j 6= i 1, i = j for 0 ≤ i, j ≤ 2 i.e., Li(xj) = δi,j = Li(xi) = 1 0, i 6= j the Kronecker delta function. P2(x) interpolates the data P2(x) = yi, i=0,1,2 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.2 Quadratic Interpolation Example Construct P2(x) for the data points (0, −1), (1, −1), (2, 7). Then (x−1)(x−2) x(x−2) x(x−1) P (x)= · (−1)+ · (−1)+ · 7 (5.6) 2 2 −1 2 Figure: The quadratic interpolating polynomial (5.6) 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.2 Quadratic Interpolation With linear interpolation: obvious that there is only one straight line passing through two given data points. With three data points: only one quadratic interpolating polynomial whose graph passes through the points. Indeed: assume ∃Q2(x), deg(Q2) ≤ 2 passing through (xi, yi), i = 0, 1, 2, then it is equal to P2(x). The polynomial R(x) = P2(x) − Q2(x) has deg(R) ≤ 2 and R(xi) = P2(xi) − Q2(xi) = yi − yi = 0, for i = 0, 1, 2 So R(x) is a polynomial of degree ≤ 2 with three roots ⇒ R(x) ≡ 0 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.2 Quadratic Interpolation Example Calculate a quadratic interpolate to e0.826 from the function values e0.82 =· 2.27050 e0.83 =· 2.293319 e0.84 =· 2.231637 0.82 0.83 0.84 With x0 = e , x1 = e , x2 = e , we have · P2(0.826) = 2.2841639 to eight digits, while the true answer e0.826 =· 2.2841638 and · P1(0.826) = 2.2841914. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.3 Higher-degree interpolation Lagrange’s Formula Given n + 1 data points (x0, y0), (x1, y1),..., (xn, yn) with all xi’s distinct, ∃ unique Pn, deg(Pn) ≤ n such that Pn(xi) = yi, i = 0, . , n given by Lagrange’s Formula n X Pn(x) = yiLi(x) = y0L0(x) + y1L1(x) + ··· ynLn(x) (5.7) i=0 n Y x−xj (x−x0) ··· (x−xi−1)(x−xi+1) ··· (x−xn) where Li(x)= = , xi −xj (xi −x0) ··· (xi −xi−1)(xi −xi) ··· (xi −xn) j=0,j6=i where Li(xj) = δij 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.4 Divided differences Remark; The Lagrange’s formula (5.7) is suited for theoretical uses, but is impractical for computing the value of an interpolating polynomial: knowing P2(x) does not lead to a less expensive way to compute P3(x). But for this we need some preliminaries, and we start with a discrete version of the derivative of a function f(x). Definition (First-order divided difference) Let x0 6= x1, we define the first-order divided difference of f(x) by f(x1) − f(x2) f[x0, x1] = (5.8) x1 − x2 If f(x) is differentiable on an interval containing x0 and x1, then the mean value theorem gives 0 f[x0, x1] = f (c), for c between x0 and x1. Also if x0, x1 are close together, then x + x f[x , x ] ≈ f 0 0 1 0 1 2 usually a very good approximation. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.4 Divided differences Example Let f(x) = cos(x), x0 = 0.2, x1 = 0.3. Then cos(0.3) − cos(0.2) f[x , x ] = =· −0.2473009 (5.9) 0 1 0.3 − 0.2 while x + x f 0 0 1 = − sin(0.25) =· −0.2474040 2 so f[x0, x1] is a very good approximation of this derivative. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.4 Divided differences Higher-order divided differences are defined recursively Let x0, x1, x2 ∈ R distinct. The second-order divided difference f[x1, x2] − f[x0, x1] f[x0, x1, x2] = (5.10) x2 − x0 Let x0, x1, x2, x3 ∈ R distinct. The third-order divided difference f[x1, x2, x3] − f[x0, x1, x2] f[x0, x1, x2, x3] = (5.11) x3 − x0 In general, let x0, x1, . , xn ∈ R, n + 1 distinct numbers. The divided difference of order n f[x1, . , xn] − f[x0, . , xn−1] f[x0, . , xn] = (5.12) xn − x0 or the Newton divided difference. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.4 Divided differences Theorem n Let n ≥ 1, f ∈ C [α, β] and x0, x1, . , xn n + 1 distinct numbers in [α, β]. Then 1 (n) f[x0, x1, . , xn] = n! f (c) (5.13) for some unknown point c between the maximum and the minimum of x0, . , xn. Example Let f(x) = cos(x), x0 = 0.2, x1 = 0.3, x2 = 0.4. The f[x0, x1] is given by (5.9), and cos(0.4) − cos(0.3) f[x , x ] = =· −0.3427550 1 2 0.4 − 0.3 hence from (5.11) −0.3427550 − (−0.2473009) f[x , x , x ] =· = −0.4772705 (5.14) 0 1 2 0.4 − 0.2 For n = 2, (5.13) becomes 1 1 1 f[x , x , x ] = f 00(c) = − cos(c) ≈ − cos(0.3) =· −0.4776682 0 1 2 2 2 2 which is nearly equal to the result in (5.14). 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.5 Properties of divided differences The divided differences (5.12) have special properties that help simplify work with them. (1) Let (i0, i1, . , in) be a permutation (rearrangement) of the integers (0, 1, . , n). It can be shown that f[xi0 , xi1 , . , xin ] = f[x0, x1, . , xn] (5.15) The original definition (5.12) seems to imply that the order of x0, x1, . , xn is important, but (5.15) asserts that it is not true. For n = 1 f(x0) − f(x1) f(x1) − f(x0) f[x0, x1] = = = f[x1, x0] x0 − x1 x1 − x0 For n = 2 we can expand (5.11) to get f(x0) f(x1) f(x2) f[x0, x1, x2] = + + (x0 − x1)(x0 − x2) (x1 − x0)(x1 − x2) (x2 − x0)(x2 − x1) (2) The definitions (5.8), (5.11) and (5.12) extend to the case where some or all of the xi coincide, provided that f(x) is sufficiently differentiable. 4. Interpolation Math 1070 > 4. Interpolation and Approximation > 4.1.5 Properties of divided differences For example, define f(x0) − f(x1) f[x0, x0] = lim f[x0, x1] = lim x1→x0 x1→x0 x1 − x0 0 f[x0, x0] = f (x0) For an arbitrary n ≥ 1, let all xi → x0; this leads to the definition 1 f[x , .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    56 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us