Numerical methods - lecture 8 Jiří Zelinka Autumn 2017 Jiří Zelinka 1/15 Spline interpolation x0,..., xn - given points, x0 < x\ < • • • < xn fo,...,fn- given function values r, d > 0 natural numbers, r - degree, d - defect S - spline - piecewise polynomials of degree r S has continuous derivatives up to order r — d Sr d - space of splines of degree r with defect d Jiří Zelinka □ UP Numerical methods - lecture 8 2/15 Example 1. Si i - piecewise linear continuous functions 0.9 h 0.8 h 0.7 h 0.6 h 0.5 h 0.4 h 0.3 h 0.2 h 0.1 linear spline function 1/(1 -x ) S G ► oc □ iS1 Jiří Zelinka Numerical methods - lecture 8 8/15 Least squares method Theoretical background A • x = b: system of linear equations For given x let rx = b — A • x: residue for the vector x x is called the solution in sense of least squares if X < X for any x. 1Z(A)\ the range space of the matrix A 1Z^(A)\ the orthogonal complement of 7Z(A) The vector b can be decomposed in the form b = b\ + bn(x) - given function depending on the parameters Cq, ..., cn. We want to find the parameters Cq, ..., cn to minimize n £ [0w - *f /c=0 5 ""O O' 11/15 We are looking for the solution in the sense of least squares of the system: c0%{x0) Q)o(x2) + + + cii(xb) + cii(xi) + cii(x2) + + Cm0m(xO) + Cm0m(xx) + Cm0m(x2) fo fl Q)o(Xn) + Cii(xn) + Let A = ( o(*0) QiM •• o(xi) i(xi) • • o(x2) m(x2) V MXn) i(xn) ••• m(x„) J and r~ = í fo\ {fnJ □ S Jiří Zelinka Numerical methods - lecture 8 12/15 Then the parameters c = (cq, ..., cm)T are given by the normal equations AT•A•c=AT•f i.e. c = Jiří Zelinka □ [31 Numerical methods - lecture 8 13/15 Example: 1 2 3 4 5 6 7 8 9 10 fi 2.7 5.5 7.5 9.0 11.3 12.6 14.9 17.4 19.3 21.5 Find a linear function approximating data. Solution: 0(x) = 1, Oi(x) = x /i i i i i i i i i Vi A = 1 \ f 21 \ 2 5.5 3 7.5 4 9.0 5 f = 11.3 6 12.6 7 14.9 8 17.4 9 19.3 10 / I 21.5 ) Jiří Zeli nka Numerical m ethods - lecture 14/15 c = (A T A)~1AT.f=(12 1.0267 0261 ,