100%(1)1 out of 1 people found this document helpful
This preview shows page 1 - 4 out of 9 pages.
Piece-wise Linear Interpolation and Splines*Hector D. Ceniceros1Piece-wise Linear InterpolationOne way to reduce the error in linear interpolation is to divide [a, b] intosmall subintervals [x0, x1], ...,[xn-1, xn]. In each of the subintervals [xj, xj+1]we approximatefbyp(x) =f(xj) +f(xj+1)-f(xj)xj+1-xj(x-xj),x∈[xj, xj+1].(1)We know thatf(x)-p(x) =12f00(ξ)(x-xj)(x-xj+1),x∈[xj, xj+1](2)whereξis some point betweenxjandxj+1.Suppose that|f00(x)| ≤M2,∀x∈[a, b] then|f(x)-p(x)| ≤12M2maxxj≤x≤xj+1|(x-xj)(x-xj+1)|.(3)Now the max at the right hand side is attained at the midpoint (xj+xj+1)/2andmaxxj≤x≤xj+1|(x-xj)(x-xj+1)|=xj+1-xj22=14h2j,(4)*These are lecture notes for Math 104 A. These notes and all course materials areprotected by United States Federal Copyright Law, the California Civil Code. The UCPolicy 102.23 expressly prohibits students (and all other persons) from recording lecturesor discussions and from distributing or selling lectures notes and all other course materialswithout the prior written permission of the instructor.1
wherehj=xj+1-xj. Thereforemaxxj≤x≤xj+1|f(x)-p(x)| ≤18M2h2j.(5)If we want this error to be smaller than a prescribed toleranceδwe can takesufficiently small subintervals. Namely, we can pickhjsuch that18M2h2j≤δwhich implies thathj≤r8δM2.(6)2Cubic SplinesSeveral applications require a smoother curve than that provided by a piece-wise linear approximation.Continuity of the first and second derivativesprovide that required smoothness.One of the most frequently used such approximations is a cubic spline,which is is a piecewise cubic function,s(x), which interpolates a set points(x0, f0),(x1, f1), . . .(xn, fn), and has two continuous derivatives.In eachsubinterval [xj, xj+1],s(x) is a cubic polynomial, which we may representassj(x) =aj(x-xj)3+bj(x-xj)2+cj(x-xj) +dj.(7)Lethj=xj+1-xj.(8)The splines(x) interpolates the given data:sj(xj) =fj=dj,(9)sj(xj+1) =ajh3j+bjh2j+cjhj+dj=fj+1.(10)Nows0j(x) = 3aj(x-xj)2+ 2bj(x-xj) +cjands00j(x) = 6aj(x-xj) + 2bj.Therefores0j(xj) =cj,(11)s0j(xj+1) = 3ajh2j+ 2bjhj+cj,(12)s00j(xj) = 2bj,(13)s00j(xj+1) = 6ajhj+ 2bj.(14)2
We are going to write the spline coefficientsaj,bj,cj, anddjin terms offjandfj+1and the unknown valueszj=s00j(xj) andzj+1=s00j(xj+1). We havedj=f