Download presentation
1
Chapter 3 Interpolation
and Polynomial Approximation If a function y = f(x) is too complicated for calculation or is even unknown, one way to approximate it is to first obtain its values y0 = f(x0), … yn = f(xn) at a sequence of points x0 … xn, and then construct a relatively simple approximating function g(x) f(x). If g(x) satisfies that g(xi) = f(xi) for all i = 0, … n, it is called the interpolating function of f(x). The most commonly used interpolating functions are …? algebraic polynomials. g(x) f(x) x0 x1 x2 x3 x4 x 1/19
2
satisfying L1,i(xj)=ij /* Kronecker Delta */
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial 3.1 Interpolation and the Lagrange Polynomial Find a polynomial of degree n, Pn(x) = a0 + a1x + … + anxn, such that Pn(xi) = yi for all i = 0, …, n. Note: for any i j, we must have xi xj . Lagrange Basis, satisfying L1,i(xj)=ij /* Kronecker Delta */ Given x0 , x1; y0 , y1 . Find P1(x) = a0 + a1x such that P1(x0) = y0 and P1(x1) = y1 . n = 1 P1(x) is the line function through the two given points ( x0 , y0 ) and ( x1, y1 ) . ) ( 1 x y P - + = 1 x - = y y1 = 1 ) ( i 1, i y x L L1,0(x) L1,1(x) 2/19
3
The n-th Lagrange interpolating polynomial
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial The mathematician S. had to move to a new place. His wife didn't trust him very much, so when they stood down on the street with all their things, she asked him to watch their ten trunks, while she got a taxi. Some minutes later she returned. Said the husband: "I thought you said there were ten trunks, but I've only counted to nine!" The wife said: "No, they're TEN!" "But I have counted them: 0, 1, 2, ..." Find Ln,i(x) for i = 0, …, n such that Ln,i(xj)=ij . Then let . Hence Pn(xi) = yi . = n i y x P ) ( Ln,i(x) n 1 Ln,i(x) Each Ln,i has n roots x0 … xi … xn The n-th Lagrange interpolating polynomial = - n j j i i x C ) ( )...( Ln,i(x) - = j i j i x C ) ( 1 Ln,i 3/19
4
D(x) = Pn(x) – Qn(x) is a polynomial of degree n
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial Theorem: If x0, x1, …, xn are n + 1 distinct numbers and f is a function whose values are given at these numbers, then the n-th Lagrange interpolating polynomial is unique. Proof: If not… Then there exists two polynomials Pn(x) and Qn(x) both satisfying the interpolating conditions. D(x) = Pn(x) – Qn(x) is a polynomial of degree n Yet D(x) has distinct roots x0, x1, …, xn . n + 1 Note: The interpolating polynomial is NOT unique unless its degree is constrained to be no greater than n. A counterexample is where p(x) can be a polynomial of any degree. 4/19
5
Analyze the Remainder ! ) 1 ( + = n f x K = + - ! ) 1 )( ( n x K
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial Analyze the Remainder Suppose Consider the truncation error and f Cn + 1[a, b]. = - n i x K R ) ( Rolle’s Theorem: If (x) is sufficiently smooth with (x0) = (x1) = 0, then there exists (x0 , x1) such that ’() = 0. Rn(x) has at least roots n+1 Fix any x xi for all i = 0, …, n. Define the function g for t in [a, b] by In general, if (x0) = (x1) = (x2) = 0 = - n i x t K Rn ) ( g(t) such that There exist g(x) has n+2 distinct roots x0 … xn x such that There exists = + - ! ) 1 )( ( n x K P f ! ) 1 ( + - n x K R ! ) 1 ( + = n f x K such that There exists 5/19
6
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial
Note: Since in most of the cases x cannot be determined, we obtain the upper bound of f (n+1) instead. That is, estimate an Mn+1 such that for all x(a,b) and take as the upper bound of the total error. The interpolating polynomial is accurate for any polynomial function f with degree n since f (n+1)(x) 0. Quiz: Given xi = i +1, i = 0, 1, 2, 3, 4, 5. Which is the graph of L5, 2(x)? y - 1 0.5 2 3 4 5 6 x A B C 6/19
7
h 1.72 10–3 Simply take n = 1000 and h = 0.001.
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial Example: Suppose a table is to be prepared for the function f(x) = ex for x in [0, 1]. Assume that each entry of the table is accurate up to 8 decimal places and the step size is h. What should h be for linear interpolation to give an absolute error of at most 10– 6 ? Solution: Suppose that [0, 1] is partitioned into n equal-spaced subintervals [x0, x1], [x1, x2], …, [xn–1 , xn], and x is in the interval [xk, xk+1]. Then the error estimation gives h 1.72 10–3 Simply take n = 1000 and h = 7/19
8
In general, interpolation is better than extrapolation.
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial Example: Given Use the linear and the quadratic Lagrange polynomial of sin x to compute sin 50 and then estimate the errors. Solution: First use x0, x1 and x1, x2 to compute the linear interpolations. Use In general, interpolation is better than extrapolation. ) 18 5 ( 50 sin 1 p P Here and sin 50 = … Error of extrapolation Use sin 50 , Error of interpolation 8/19
9
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial
Now use x0, x1 and x2 to compute the quadratic interpolation. ) 18 5 ( 50 sin 2 p P sin 50 = … Error of the quadratic interpolation Interpolation with higher degree usually obtain better results. The higher the better? Nooooooo…. 9/19
10
When you start writing the program,
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial When you start writing the program, you will find how easy it is to calculate the Lagrange polynomial. Oh yeah? What if I find the current interpolation not accurate enough? Right. Then all the Lagrange basis, Ln,i(x), will have to be re-calculated. Then you might want to take more interpolating points into account. Excellent point ! Let’s look at Neville’s Method… 10/19
11
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial
Definition: Let f be a function defined at x0, x1, …, xn, and suppose that m1, …, mk are k distinct integers with 0 mi n for each i. The Lagrange polynomial that agrees with f(x) at the k points denoted by Theorem: Let f be defined at x0, x1, …, xk, and let xi and xj be two distinct numbers in this set. Then describes the k-th Lagrange polynomial that interpolates f at the k+1 points x0, x1, …, xk . Proof: For any 0 r k and r i and j, the two interpolating polynomials on the numerator are equal to f(xr) at xr , so P(xr) = f(xr). The first polynomials on the numerator equals f(xi) at xi , while the second term is zero, so P(xi) = f(xi). Similarly P(xj) = f(xj). The k-th Lagrange polynomial that interpolates f at the k+1 points x0, x1, …, xk is unique. 11/19
12
HW: p.119 #5; p.120 #17 Neville’s Method x0 x1 x2 x3 x4 P0 P1 P2 P3
Chapter 3 Interpolation and Polynomial Approximation -- Interpolation and the Lagrange Polynomial Neville’s Method x0 x1 x2 x3 x4 P0 P1 P2 P3 P4 P0,1 P1,2 P2,3 P3,4 P0,1,2 P1,2,3 P2,3,4 P0,1,2,3 P1,2,3,4 P0,1,2,3,4 HW: p.119 #5; p.120 #17 12/19
13
3.2 Divided Differences ] , ... [ = x f
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences 3.2 Divided Differences The 1st divided difference of f w.r.t. xi and xj The 2nd divided difference of f w.r.t. xi , xj and xk The k+1st divided difference of f w.r.t. x0 … xk+1 1 ] , ... [ + - = k x f 13/19
14
Warning: my head is exploding… What is the point of this formula?
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences As a matter of fact, where Warning: my head is exploding… What is the point of this formula? The value of f [ x0, …, xk ] is independent of the order of the numbers x0, …, xk . 14/19
15
… … … … ai = f [ x0, …, xi ] Newton’s Interpolation Nn(x) Rn(x) 1 2
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences Newton’s Interpolation 1 2 … … … … n1 1 + (x x0) 2 + … … + (x x0)…(x xn1) n1 Nn(x) ai = f [ x0, …, xi ] Rn(x) 15/19
16
Since the n-th interpolating polynomial is unique, Nn(x) Pn(x).
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences Note: Since the n-th interpolating polynomial is unique, Nn(x) Pn(x). They must have the same truncation error. That is, The procedure is similar to Neville’s method. f (x0) f (x1) f (x2) … f (xn1) f (xn) f [x0, x1] f [x1, x2] … … f [xn1, xn] f [x0, x1 , x2] … … f [xn2, xn1, xn] f [x0, …, xn] f (xn+1) f [xn, xn+1] f [xn1, xn, xn+1] f [x1, …, xn+1] f [x0, …, xn+1] 16/19
17
Formulae with Equal Spacing
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences Formulae with Equal Spacing If the points are equally spaced: i f - = + 1 forward difference i k f 1 ) ( - + = i1 i f - = backward difference 1 - = i k f 其中 centered difference 17/19
18
Some important properties Linearity:
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences Some important properties Linearity: If f (x) is a polynomial of degree m , then is a polynomial of degree m – k and The values of the differences can be obtained from the function = - + D n j k f ) 1 ( where /* binomial coefficients */ k j n f D = + And vice-versa k h f x ! ] , ... [ D = n 1 - From Rn k h f ) ( D = x 18/19
19
Chapter 3 Interpolation and Polynomial Approximation -- Divided Differences
Newton’s formulae Newton’s forward-difference formula Let , then ) ( x f k t h N n = + HW: p.131 #5(a)(b); p.132 #13 Newton’s backward-difference formula Reverse the order of the points Let , then ) ( 1 n k x f t h N - = + 19/19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.