Splines - Piece-wise Linear Interpolation and Splines Hector D Ceniceros 1 Piece-wise Linear Interpolation One way to reduce the error in linear

# Splines - Piece-wise Linear Interpolation and Splines...

• 9
• 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. Ceniceros 1 Piece-wise Linear Interpolation One way to reduce the error in linear interpolation is to divide [ a, b ] into small subintervals [ x 0 , x 1 ] , ..., [ x n - 1 , x n ]. In each of the subintervals [ x j , x j +1 ] we approximate f by p ( x ) = f ( x j ) + f ( x j +1 ) - f ( x j ) x j +1 - x j ( x - x j ) , x [ x j , x j +1 ] . (1) We know that f ( x ) - p ( x ) = 1 2 f 00 ( ξ )( x - x j )( x - x j +1 ) , x [ x j , x j +1 ] (2) where ξ is some point between x j and x j +1 . Suppose that | f 00 ( x ) | ≤ M 2 , x [ a, b ] then | f ( x ) - p ( x ) | ≤ 1 2 M 2 max x j x x j +1 | ( x - x j )( x - x j +1 ) | . (3) Now the max at the right hand side is attained at the midpoint ( x j + x j +1 ) / 2 and max x j x x j +1 | ( x - x j )( x - x j +1 ) | = x j +1 - x j 2 2 = 1 4 h 2 j , (4) * These are lecture notes for Math 104 A. These notes and all course materials are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of the instructor. 1
where h j = x j +1 - x j . Therefore max x j x x j +1 | f ( x ) - p ( x ) | ≤ 1 8 M 2 h 2 j . (5) If we want this error to be smaller than a prescribed tolerance δ we can take sufficiently small subintervals. Namely, we can pick h j such that 1 8 M 2 h 2 j δ which implies that h j r 8 δ M 2 . (6) 2 Cubic Splines Several applications require a smoother curve than that provided by a piece- wise linear approximation. Continuity of the first and second derivatives provide 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 ( x 0 , f 0 ) , ( x 1 , f 1 ) , . . . ( x n , f n ), and has two continuous derivatives. In each subinterval [ x j , x j +1 ], s ( x ) is a cubic polynomial, which we may represent as s j ( x ) = a j ( x - x j ) 3 + b j ( x - x j ) 2 + c j ( x - x j ) + d j . (7) Let h j = x j +1 - x j . (8) The spline s ( x ) interpolates the given data: s j ( x j ) = f j = d j , (9) s j ( x j +1 ) = a j h 3 j + b j h 2 j + c j h j + d j = f j +1 . (10) Now s 0 j ( x ) = 3 a j ( x - x j ) 2 + 2 b j ( x - x j ) + c j and s 00 j ( x ) = 6 a j ( x - x j ) + 2 b j . Therefore s 0 j ( x j ) = c j , (11) s 0 j ( x j +1 ) = 3 a j h 2 j + 2 b j h j + c j , (12) s 00 j ( x j ) = 2 b j , (13) s 00 j ( x j +1 ) = 6 a j h j + 2 b j . (14) 2
We are going to write the spline coefficients a j , b j , c j , and d j in terms of f j and f j +1 and the unknown values z j = s 00 j ( x j ) and z j +1 = s 00 j ( x j +1 ). We have d j = f