Numerical methods - lecture 7 Jiří Zelinka Autumn 2017 Jiří Zelinka Numerical methods - lecture 7 1/16 Interpolation x0,..., xn - given points, x,- ^ Xj for / ^ j fo,...,fn- given function values (measurments), f\ = f (x,-) 0(x) = ao0o(x) + * * * + a„0n(x) - given function depending on the parameters a0,..., a„. Examples: 0(x) = a0 + aix + • (x 7T0(x 7Ti(x' 7T2{x] 7T3{x] (x + l)(x - 0)(x - l)(x - 3) = x4 - 3x3 - x2 + 3x u>(x) : (x + 1) uj(x) : (x + O) o;(x) : (x — 1) co(x) : (x — 3) Jiří Zelinka Numerical methods - lecture 7 10/16 Horner scheme for division uj(x) : (x — x0), i.e. lo(x) : (x + 1) -1 1 -3-13 0 1 -4 0 0 tto(x) = x3 - 4x2 + 3x Horner scheme for 7To(xo) = 7Tq(—1): 7t(x) 1 -4 3 0 -1 1 -5 8 -8 to(-1) = -8 Lo(x) -- _ t0(x) _ l/x3 tto(xo) 8 V - 4x2 + 3x) Similarly Z_1? /_2 • • • 11/16 Disadvantage of the Lagrange interpolation polynomial: adding a point (xn+i, Z^+i) will cause recalculation of all base polynomials /_;. 12/16 Newton interpolation polynomial Base functions: 4>oM = 1. i(x) = (x-xo), > f[xb,xux2] ^ x2f2>f^ . " f[x0.....x,7] : : > f[xn-l,X„] ^ nXn-^Xn-!,*] 15/16 Example: f, -1 -3 0 1 > 1+3 _ 0+1 4 1 -1 > -1-1 1-0 3 1 > 1+1 _ 3-1 1 f[xh X;+i, x/+2] f[xo, Xi, x2, x3] -2-4 1+1 1+2 _ -3 3-0 = 1 1+3 = 3+1 1 P(x) = -3 + 4(x + l)-3(x+l)x + l(x+l)x(x-l) = = x3-3x2 + l 16/16