Polynomial Interpolation
Total Page:16
File Type:pdf, Size:1020Kb
Numerical Methods 401-0654 6 Polynomial Interpolation Throughout this chapter n N is an element from the set N if not otherwise specified. ∈ 0 0 6.1 Polynomials D-ITET, ✬ ✩D-MATL Definition 6.1.1. We denote by n n 1 n := R t αnt + αn 1t − + ... + α1t + α0 R: α0, α1,...,αn R . P ∋ 7→ − ∈ ∈ the R-vectorn space of polynomials with degree n. o ≤ ✫ ✪ ✬ ✩ Theorem 6.1.2 (Dimension of space of polynomials). It holds that dim n = n +1 and n P P ⊂ 6.1 C∞(R). p. 192 ✫ ✪ n n 1 ➙ Remark 6.1.1 (Polynomials in Matlab). MATLAB: αnt + αn 1t − + ... + α0 Vector Numerical − Methods (αn, αn 1,...,α0) (ordered!). 401-0654 − △ Remark 6.1.2 (Horner scheme). Evaluation of a polynomial in monomial representation: Horner scheme p(t)= t t t t αnt + αn 1 + αn 2 + + α1 + α0 . ··· − − ··· Code 6.1: Horner scheme, polynomial in MATLAB format 1 function y = polyval (p,x) 2 y = p(1); for i =2: length (p), y = x y+p( i ); end ∗ D-ITET, D-MATL Asymptotic complexity: O(n) Use: MATLAB “built-in”-function polyval(p,x); △ 6.2 p. 193 6.2 Polynomial Interpolation: Theory Numerical Methods 401-0654 Goal: (re-)constructionofapolynomial(function)frompairs of values (fit). ✬ Lagrange polynomial interpolation problem ✩ Given the nodes < t < t < < tn < and the values y ,...,yn R compute −∞ 0 1 ··· ∞ 0 ∈ p n such that ∈P j 0, 1,...,n : p(t )= y . ∀ ∈ { } j j ✫ ✪ D-ITET, D-MATL 6.2 p. 194 6.2.1 Lagrange polynomials Numerical Methods 401-0654 ✬ ✩ Definition 6.2.1. Consider nodes <t <t < <tn < ( Lagrange interpolation). −∞ 0 1 ··· ∞ → Then define the Lagrange polynomials L ,L ,...,Ln n associated to (t ,...,tn) through 0 1 ∈P 0 n t tj L (t) := − i t t j=0 i − j jY=i 6 for all t R and all i 0, 1,...,n . ∈ ∈ { } ✫ ✪D-ITET, D-MATL 1 : i = j Note that L (t )= δ = . i j i,j 0 : i = j ( 6 6.2 p. 195 8 L 0 Numerical L 2 Methods L 5 401-0654 6 Example 6.2.1. Consider n N and Lagrange ∈ polynomials for uniformly spaced nodes 4 2j t = 1+ ,j 0, 1,...,n . 2 j − n ∈ { } Plot ➙ 0 n = 10, j =0, 2, 5 Lagrange Polynomials ✸ -2 -4 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 t Fig. 36 D-ITET, D-MATL ✬ ✩ Definition 6.2.2 (Lagrange interpolation operator). Consider <t0 <t1 <...<tn < . n+1 −∞ ∞ By I : R n we denote the linear mapping defined by t0,...,tn →P n n+1 R (y ,...,yn) I y ,...,yn := y L n . ∋ 0 7→ t0,...,tn 0 i i ∈P i=0 X ✫ ✪ 6.2 p. 196 ✬ ✩Numerical Theorem 6.2.3 (Existence & uniqueness of Lagrange interpolation polynomial). Methods 401-0654 The general polynomial interpolation problem (6.2) admits a unique solution p n and it holds ∈P that n p(t)= y L (t)= I (y ,...,yn) (t) i · i t0,...,tn 0 Xi=0 for all t R. ∈ ✫ ✪ 6.2.2 Conditioning of polynomial interpolation D-ITET, D-MATL Necessary for studying the conditioning: norms on vector space of continuous functions C(I, R) where I R is a non-empty bounded and closed interval: ⊂ supremum norm f ,I := sup f(t) : t I , (6.2.4) k k∞ {| | ∈ } L2-norm f := f(t) 2 dt , (6.2.5) k k2,I | | sZI 6.2 L1-norm f := f(t) dt . (6.2.6) k k1,I | | p. 197 ZI Numerical Methods 401-0654 ✬ ✩ Lemma 6.2.6 (Absolute conditioning of polynomial interpolation). Consider interval I R, ⊂ nodes < t <...<tn < and associated Lagrange polynomials L ,...,Ln. Then −∞ 0 ∞ 0 the Lagrange interpolation operator satisfy I t0,...,tn(y) ,I n It ,...,t = sup k k∞ = Li , (6.2.7) 0 n L( , ,I) y i=0 k·k∞ k·k∞ y Rn+1 0 | | ,I ∈ \{ } k k∞ X ∞ I 1 t0,...,tn(y) 2,I n 2 2 It ,...,t = sup k k L . (6.2.8) 0 n L( 2, 2,I) i=0 i 2,I k·k k·k y Rn+1 0 y 2 ≤ k k ∈ \{ } k k X ✫ ✪D-ITET, D-MATL n Terminology: Lebesgue constant of t0,...,tn and I R: λt ,...,t (I) := Li . ⊂ 0 n i=0 | | ,I ∞ X Example 6.2.4 (Estimation of the Lebesgue constant). Consider n N, I = [ 1, 1] and t = ∈ − k 6.2 p. 198 2k 1+ n , k 0, 1,...,n (uniformly spaced nodes). Then Numerical − ∈ { } Methods 401-0654 1 1 3 ... n 3 n+1 2n 1 λ (I) L (1 1) = n · n · n · · −n · n ···· n− t0,...,tn ≥| n/2 − n | 2 2 4 n 2 1 n · n ····· −n · 1 3 5 ... (n 3) (n + 1) (n + 2) ... (2n 1) = · · · · − · · · · − [2 4 6 ... (n 2) n]2 · · · · − · n (n + 1) (n + 3) ... (2n 1) √2 · · · − C 1.4n ≥ 2 4 ... (n 4) (n 2)2 n2 ≥ (n 2) n2 ≥ · · · · − · − · − for all n 6, 8, 10,... and some constant C (0, ). ∈ { } ∈ ∞ Theory[1]: for uniformly spaced nodes n/2 for all N and some constant λt0,...,tn(I) Ce n D-ITET, ≥ ∈ D-MATL C (0, ). ∈ ∞ ✸ Example 6.2.5 (Oscillating interpolation polynomial: Runge’s counterexample). Between the nodes the interpolation polynomial can oscillate excessively and overestimate the changes in the values: bad approximation of functions! 6.2 p. 199 2 Interpol. polynomial Numerical Methods 401-0654 1.5 Let n N. Interpolation polynomial with uniformly ∈ spaced nodes: 1 10j 1 tj := 5+ n , yj = 2 − 1+(tj) 0.5 for all j 0, 1,...,n . Plot n = 10 ➙ Interpolation polynomial ∈ { } See Example 6.4.1. 0 -0.5 -5 -4 -3 -2 -1 0 1 2 3 4 5 t D-ITET, D-MATL Attention: strong oscillations of the interpolation polynomials of high degree on uniformly spaced nodes! ✸ 6.3 p. 200 6.3 Polynomial Interpolation: Algorithms Numerical Methods 401-0654 6.3.1 Newton basis polynomials and divided differences Drawback of the Lagrange basis: adding another data point affects all basis polynomials! Alternative, “update friendly” method: Newton basis of n. P ✬ ✩ Definition 6.3.1. Consider t ,...,tn R with t ,...,tn = n +1. Then define Newton 0 ∈ |{ 0 }| basis polynomials N0,N1,...,Nn n associated to (t0,...,tn) through D-ITET, ∈P D-MATL n 1 − N (t):=1 , N (t):=(t t ) , ... , Nn(t) := (t t ) (6.3.1) 0 1 − 0 − i iY=0 for all t R. ∈ ✫ ✪ ➣ LSE for polynomial interpolation problem in Newton basis: R R Given (yj)j 0,1,...,n , find (aj)j 0,1,...,n such that ∈{ } ⊂ ∈{ } ⊂ 6.3 j 0, 1,...,n : a N (t )+ a N (t )+ + anNn(t )= y . p. 201 ∀ ∈ { } 0 0 j 1 1 j ··· j j triangular linear system Numerical ⇔ Methods 401-0654 a0 y0 N0(t0) N1(t0) N2(t0) Nn(t0) ··· a1 y1 N (t ) N (t ) N (t ) Nn(t ) . . 0 1 1 1 2 1 ··· 1 . N (t ) N (t ) N (t ) Nn(t ) . = . , 0 2 1 2 2 2 ··· 2 . . . an 1 yn 1 N0(tn) N1(tn) N2(tn) Nn(tn) − − ··· an yn i.e., 10 0 0 a0 y0 ···.. 1 (t1 t0) 0 . a1 y1 − . . . 1 (t2 t0) (t2 t0)(t2 t1) . . −. − .. − .. . = . 0 . . n 1 D-ITET, − an 1 yn 1 D-MATL 1 (tn t0) (tn t0)(tn t1) (tn ti) − − − − − ··· i=0 − an yn Q 6.3 p. 202 Solution of the system with forward substitution: Numerical Methods 401-0654 a0 = y0 , y a y y a = 1 − 0 = 1 − 0 , 1 t t t t 1 − 0 1 − 0 y1 y0 y2 y0 y1 y0 y2 a0 (t2 t0)a1 y2 y0 (t2 t0) t −t t −t t −t a = − − − = − − − 1− 0 = 2− 0 − 1− 0 , 2 (t t )(t t ) (t t )(t t ) t t 2 − 0 2 − 1 2 − 0 2 − 1 2 − 1 y3 y0 y1 y0 y3 a0 (t3 t0) a1 (t3 t0)(t3 t1) a2 t −t t −t (t3 t1) a2 a = − − − − − − = 3− 0 − 1− 0 − − 3 (t t )(t t )(t t ) (t t )(t t ) 3 − 0 3 − 1 3 − 2 3 − 1 3 − 2 y y y y y y y y 3− 0 1− 0 2− 0 1− 0 t3 t0 − t1 t0 t2 t0 − t1 t0 − t t − − t t − = 3− 1 − 2− 1 (t t ) D-ITET, 3 − 2 D-MATL . Simpler and more efficient algorithm using divided differences: y[ti] = yi y[ti+1,...,ti+k] y[ti,...,ti+k 1] y[t ,t ,...,t ] = − − (recursion) (6.3.2) i i+1 i+k t t 6.3 i+k − i p. 203 Recursive calculation by divided differences scheme: Numerical Methods 401-0654 t0 y[t0] > y[t0,t1] t1 y[t1] > y[t0,t1,t2] > y[t1,t2] > y[t0,t1,t2,t3], t2 y[t2] > y[t1,t2,t3] > y[t2,t3] t3 y[t3] Then n n t R: y L (t)= I (y ,...,yn) (t)= y[t ,...,t ] N (t) ∀ ∈ i · i t0,...,tn 0 0 i · i i=0 i=0 X X D-ITET, D-MATL and y[t0,t1,...,yi]= y[tπ(0),tπ(1),...,tπ(i)] for all permutations π : 0, 1,...,i 0, 1,...,i and all i 0, 1,...,n (see, e.g., Satz 2.2 { } → { } ∈ { } and Korollar 2.1 in [44, Rannacher, Einführung in die Numerische Mathematik, Vorlesungsskriptum, 2006]).