Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Unit 4: Polynomial Interpolation (see course book p. 180) We denote (as above) by Pn the linear space (vector space) of all polynomials of (max-) degree n. Definition. [–] Let (xi, yi), i = 0 : n be n + 1 pairs of real numbers (typically measurement data) A polynomial p ∈ Pn interpolates these data points if p(xk ) = yk k = 0 : n holds. We assume in the sequel that the xi are distinct. C. Führer: FMN081-2005 72 4.1: Polynomial Interpolation An Interpolation Polynomial 5 4 polynomial (6th degree) 3 2 1 0 measurements -1 -2 0 1 2 3 4 5 6 How do we determine such a polynomial? C. Führer: FMN081-2005 73 4.2: Vandermonde Approach Ansats: p(x) = anxn + an−1xn−1 + · · · a1x + a0 Interpolation conditions p(xj ) = anxni + an−1xn−1 + · · · a1xi + a0 = yi i In matrix form n x0 xn−1 0 n x xn−1 1 1 xnn xn−1 n ··· ··· ··· ··· x0 x1 xn 0≤i≤n 1 an y0 y1 1 an−1 .. = .. a0 yn 1 or V a = y. V is called a Vandermonde matrix. C. Führer: FMN081-2005 74 4.3 Vandermonde approach in MATLAB polyfit sets up V and solves for a (the coefficients) Alternatively vander sets up V and a = V \y solves for a. polyval evaluates the polynomial for given x values. n + 1 points determine a polynomial of (max-)degree n. Obs! n is input to polyfit . C. Führer: FMN081-2005 75 4.4 Vandermonde approach in MATLAB Essential steps to generate and plot an interpolation polynomial: • Computing the coefficients (polyfit, vander etc) • Generating x-values for ploting, e.g. xval=[0:0.1:100] or xval=linspace(0,100,1000) • Evaluating the polynomial, e.g. yval=polyval(coeff,xval) • Plotting, e.g. plot(xval,yval) C. Führer: FMN081-2005 76 4.5 Lagrange Polynomials We take now another approach to compute the interpolation polynomial Definition. [–] The polynomials Lni ∈ P n with the property Lnk(xi) = 0 if 1 if k= 6 i k=i are called Lagrange polynomials. C. Führer: FMN081-2005 77 4.6 Lagrange Polynomials (Cont.) It is easy to check, that n Y Lnk(x) = i=0 i 6= k (x − xi) (xk − xi) The interpolation polynomial p can be written as p(x) = n X yk Lnk(x) k=0 Check that it indeed fulfills the interpolation conditions! C. Führer: FMN081-2005 78 4.7 Lagrange Polynomials: Example Lagrange polynomials of degree 3: An Interpolation Polynomial 5 4 polynomial (6th degree) 1 3 2 1 00 measurements -1 -2 0 1 0.33 2 3 0.66 4 5 61 C. Führer: FMN081-2005 79 4.8 The vector space P n We have two ways to express a polynomial Monomial representation p(x) = Lagrange representation p(x) = Pn k k=0 ak x Pn n k=0 yk Lk (x) They describe the same polynomial (as the interpolation polynomial is unique). C. Führer: FMN081-2005 80 4.9 The vector space P n (Cont.) We introduced two bases in P n: Monomial basis {1, x, x2, · · · , xn}, coordinates ak , k = 0 : n Lagrange basis {Ln0 (x), Ln1 (x), · · · , Lnn(x)}, coordinates yk , k = 0 : n It is easy to show, that these really are bases (linear independent elements). C. Führer: FMN081-2005 81 4.10 Inner Product Space Definition. [9.1] Let V be a linear space and (·, ·) : V × V → R a map with properties • (v, v) ≥ 0 and (v, v) = 0 ⇔ v = 0, • (αv, w) = α(v, w) for α ∈ R, • (v, w) = (w, v) • (v + w, u) = (v, u) + (v, u) then V is called an inner product space and (·, ·) an inner product. C. Führer: FMN081-2005 82 4.11 Inner Product Space (Examples) • Rn is an inner product space with the inner product n X (v, u) = viui = v Tu see scalar product i=0 • P n is an inner product space with the inner product n X (p, q)xi = p(xi)q(xi) pointwise inner product i=0 • P n is an inner product space with the inner product Z b L2-inner product (p, q)2 = p(x)q(x)dx a C. Führer: FMN081-2005 83 4.12 Inner Product Space - Orthogonality Definition. [9.2] Let V be an inner product space and let two elements p, q ∈ V have the property (p, q) = 0, then they are called orthogonal. One writes p⊥q or p = q ⊥. Lagrange polynomials Pn form an orthogonal basis with respect to the inner product (p, q) = i=0 p(xi)q(xi). C. Führer: FMN081-2005 84