Error in Linear Interpolation

Error in Linear Interpolation

ERROR IN LINEAR INTERPOLATION Let P1(x) be the linear polynomial interpolating f (x) at x0 and x1. Assume f (x) is twice continuously differentiable on an interval [a; b] which contains the points x0 < x1. Then for a ≤ x ≤ b, (x − x )(x − x ) f (x) − P (x) = 0 1 f 00(c ) 1 2 x for some cx between the minimum and maximum of x0, x1, and x. We usually use P1(x) as an approximation of f (x) for x 2 [x0; x1]. Then for an error bound, (x − x0)(x1 − x) 00 jf (x) − P1(x)j ≤ max jf (x)j; x 2 [x0; x1]: 2 x0≤x≤x1 Easily, with h = x1 − x0, 2 max (x − x0)(x1 − x) = h =4: x0≤x≤x1 Therefore, 2 h 00 jf (x) − P1(x)j ≤ max jf (x)j; x 2 [x0; x1]: 8 x0≤x≤x1 EXAMPLE Let f (x) = log10 x; and in line with typical tables of log10 x, we take 1 ≤ x0 ≤ x ≤ x1 ≤ 10, and again let h = x1 − x0. Then log e f 00(x) = − 10 x2 00 log10 e max jf (x)j = 2 : x0≤x≤x1 x0 Thus, 2 h log10 e jlog10 x − P1(x)j ≤ 2 ; x 2 [x0; x1]: 8 x0 Typical high school algebra textbooks contain tables of log10 x with a spacing of h = :01. What is the error in this case? 0:012 : jlog x − P (x)j ≤ log e = 5:4287 × 10−6: 10 1 8 10 In most tables, a typical entry is given to only four decimal places to the right of the decimal point, e.g. : log 5:41 = :7332 Therefore the entries are in error by as much as .00005. Comparing this with the interpolation error, we see the latter (with h = :01) is less important than the rounding errors in the table entries. From the bound, 2 2 h log10 e : h jlog10 x − P1(x)j ≤ 2 = :0543 2 8x0 x0 we see the error decreases as x0 increases, and it is about 100 times smaller for points near 10 than for points near 1. THE QUADRATIC CASE For n = 2, we have (x − x )(x − x )(x − x ) f (x) − P (x) = 0 1 2 f (3) (c ) (*) 2 3! x with cx some point between the minimum and maximum of the points in fx; x0; x1; x2g. To illustrate the use of this formula, consider the case of evenly spaced nodes: x1 = x0 + h; x2 = x1 + h Further suppose we have x0 ≤ x ≤ x2, as we would usually have when interpolating in a table of given function values (e.g. log10 x). The quantity Ψ2(x) = (x − x0)(x − x1)(x − x2) can be evaluated directly for a particular x. Graph of Ψ2(x) = (x + h) x (x − h) using (x0; x1; x2) = (−h; 0; h): y h x −h In the formula (∗), however, we do not know cx , and therefore we (3) (3) replace f (cx ) with a maximum of f (x) as x varies over x0 ≤ x ≤ x2. This yields jΨ2(x)j (3) jf (x) − P2(x)j ≤ max f (x) (**) 3! x0≤x≤x2 If we want a uniform bound for x0 ≤ x ≤ x2, we must compute max jΨ2(x)j = max j(x − x0)(x − x1)(x − x2)j x0≤x≤x2 x0≤x≤x2 With a change of variables x = x1 + t h, x − x0 = (1 + t) h; x − x1 = t h; x − x2 = (t − 1) h 3 3 3 2h max jΨ2(x)j = h max t − t = p x0≤x≤x2 −1≤t≤1 3 3 Combined with (∗∗), this yields h3 (3) jf (x) − P2(x)j ≤ p max f (x) 9 3 x0≤x≤x2 for x0 ≤ x ≤ x2. For f (x) = log10 x, with 1 ≤ x0 ≤ x ≤ x2 ≤ 10; this leads to h3 2 log e p 10 jlog10 x − P2(x)j ≤ · max 3 9 3 x0≤x≤x2 x :05572 h3 = 3 x0 For the case of h = :01, we have −8 5:57 × 10 −8 jlog10 x − P2(x)j ≤ 3 ≤ 5:57 × 10 x0 For comparison, −6 jlog10 x − P1(x)j ≤ 5:43 × 10 Question: How much larger could we make h so that quadratic interpolation would have an error comparable to that of linear interpolation of log10 x with h = :01? The error bound for the linear interpolation was 5:43 × 10−6, and therefore we want the same to be true of quadratic interpolation. Using a simpler bound, we want to find h so that 3 −6 jlog10 x − P2(x)j ≤ :05572 h ≤ 5 × 10 This is true if h = :04477. Therefore a spacing of h = :04 would be sufficient. A table with this spacing and quadratic interpolation would have an error comparable to a table with h = :01 and linear interpolation. AN ERROR FORMULA: THE GENERAL CASE Recall the general interpolation problem: find a polynomial Pn(x) for which deg(Pn) ≤ n Pn(xi ) = f (xi ); i = 0; 1; ··· ; n with distinct node points fx0; :::; xng and a given function f (x). Let [a; b] be a given interval on which f (x) is (n + 1)-times continuously differentiable; and assume the points x0; :::; xn, and x are contained in [a; b]. Then (x − x )(x − x ) ··· (x − x ) f (x) − P (x) = 0 1 n f (n+1) (c ) n (n + 1)! x with cx some point between the minimum and maximum of the points in fx; x0; :::; xng. As shorthand, introduce Ψn(x) = (x − x0)(x − x1) ··· (x − xn) a polynomial of degree n + 1 with roots fx0; :::; xng. Then Ψ (x) f (x) − P (x) = n f (n+1) (c ) n (n + 1)! x (n+1) When bounding the error we replace f (cx ) with its maximum over the interval containing fx; x0; :::; xng, as we have illustrated earlier in the linear and quadratic cases. We concentrate on understanding the size of Ψ (x) Ψ (x) or n n (n + 1)! ERROR FOR EVENLY SPACED NODES We consider first the case in which the node points are evenly spaced, as this seems the `natural' way to define the points at which interpolation is carried out. Moreover, using evenly spaced nodes is the case to consider for table interpolation. For evenly spaced node points on [0; 1], 1 h = ; x = 0; x = h; x = 2h; :::; x = nh = 1 n 0 1 2 n For this case, Ψn(x) = x (x − h)(x − 2h) ··· (x − 1) Using the following table n Mn n Mn 1 1.25E−1 6 4.76E−7 2 2.41E−2 7 2.20E−8 3 2.06E−3 8 9.11E−10 4 1.48E−4 9 3.39E−11 5 9.01E−6 10 1.15E−12 we can observe that the maximum jΨn(x)j Mn ≡ max x0≤x≤xn (n + 1)! becomes smaller with increasing n. Graphs of Ψn(x) are shown next for the cases of n = 2; :::; 9. y n = 2 y n = 3 1 x 1 x y n = 4 y n = 5 1 x 1 x Figure: Graphs of Ψn(x) on [0; 1] for n = 2; 3; 4; 5 y n = 6 y n = 7 1 x 1 x y n = 8 y n = 9 1 x 1 x Figure: Graphs of Ψn(x) on [0; 1] for n = 6; 7; 8; 9 More detailed view of the graph of Ψ6(x) = (x − x0)(x − x1) ··· (x − x6) with evenly spaced nodes: x x x x x x x x 0 1 2 3 4 5 6 What can we learn from the given graphs? Observe that there is enormous variation in the size of Ψn(x) as x varies over [0; 1]; and thus there is also enormous variation in the error as x so varies. For example, in the n = 9 case, jΨ (x)j max n = 3:39 × 10−11 x0≤x≤x1 (n + 1)! jΨ (x)j max n = 6:89 × 10−13 x4≤x≤x5 (n + 1)! and the ratio of these two errors is approximately 49. Thus the interpolation error is likely to be around 49 times larger when x0 ≤ x ≤ x1 as compared to the case when x4 ≤ x ≤ x5. When doing table interpolation, the point x at which we interpolate should be centrally located with respect to the interpolation nodes fx0; :::; xng being used to define the interpolation, if possible. Discussion on Convergence Consider now the problem of using an interpolation polynomial to approximate a given function f (x) on a given interval [a; b]. In particular, take interpolation nodes a ≤ x0 < x1 < ··· < xn−1 < xn ≤ b and produce the interpolation polynomial Pn(x) that interpolates f (x) at the given node points. We would like to have max jf (x) − Pn(x)j ! 0 as n ! 1 a≤x≤b Does it happen? Recall the error bound jΨn(x)j (n+1) max jf (x) − Pn(x)j ≤ max · max f (x) a≤x≤b a≤x≤b (n + 1)! a≤x≤b We begin with an example using evenly spaced node points. RUNGE'S EXAMPLE Use evenly spaced node points: b − a h = ; x = a + ih for i = 0; :::; n n i For some functions, such as f (x) = ex , the maximum error goes to zero quite rapidly. But the size of the derivative term f (n+1)(x) in jΨn(x)j (n+1) max jf (x) − Pn(x)j ≤ max · max f (x) a≤x≤b a≤x≤b (n + 1)! a≤x≤b can badly hurt or destroy the convergence of other cases.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    24 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