Lecture notes on Vrtonl nd Approxmte Methods n Appled Mthemtcs - A Perce UBC Lecture 4: Pecewse Cubc Interpolton Compled 6 August 7 In ths lecture we consder pecewse cubc nterpolton n whch cubc polynoml pproxmton s ssumed over ech subntervl In order to obtn suffcent nformton to determne these coeffcents, we requre contnuty of the nterpoltng polynomls n neghborng ntervls s well s the contnuty of number of dervtves Dependng on the number of dervtves tht we requre to be contnuous t the sttchng ponts we obtn dfferent pproxmton schemes n whch ddtonl dt bout the functon fx beng pproxmted mght hve to be furnshed n order tht there s suffcent dt to determne the coeffcents of the cubc polynomls Key Concepts: Pecewse cubc nterpolton, Cubc Splnes, Cubc Hermte Interpolton 4 Pecewse Cubc Interpolton 4 Degree of freedom nlyss of pecewse cubc nterpolnts Consder the domn [, b] tht s prttoned nto N ntervls hvng N + nodes nd N nternl nodes In ech of these subntervls ssume tht dfferent cubc polynoml s to be constructed Let p 3,N x be the combnton of ll these cubc polynomls We now dscuss the lterntve pproxmton schemes tht one obtns dependng on the dfferent schemes of constrnt Schemes of constrnt: Pecewse Cubc Hermte polynomls: p 3,N x nd p 3,N x re contnuous t nteror nodes There re four unknown coeffcents for ech of the N ntervls nd N constrnts due to the contnuty requrements on p 3,N x nd p 3,N x DOF : 4N N = N + specfy functon vlue nd ts dervtve t ll N + nodes Hve to specfy f & f t ll N + nodes! Cubc Splne: p 3,N x, p 3,N x, nd p 3,N x re ll contnuous t nteror ponts DOF : 4N 3N = N + 3 = N + }{{} + specfy f t ll N + nodes nd mpose EXTRA CONDITIONS The extr condtons re up to the user to prescrbe dependng on the pplcton, eg p 3x = = p 3x N whcs clled the nturl splne
4 Pecewse Cubc Hermte polynomls x = x x N = L DOF: 4N N = N + prescrbe fx nd f x t =,, N Representton of f n terms of Hermte bss functons h x nd h x: N N fx hx = fx h x + f x h x where h d x j = δ j nd dx h x j = δ j d dx h x j = h x j = Constructng bss functons on the cnoncl ntervl [, ]: = = } We use the lner Lgrnge bss functons N ξ = +ξ ξ : N ξ b = δ b, ξ,b = ± h h h Let h ξ = α ξ + β [N ξ] ; h ξ = α ξ + β[n ξ] h ξ = γ ξ + δ [N ξ] ; h ξ = γ ξ + δ [N ξ] - h ξ To fnd α, β, γ nd δ we mpose the condtons : = h = β α = h = α + β α = α β α = nd β = h ξ = 4 + ξ ξ Smlrly h ξ = 4 ξ + ξ For the dervtve bss functons = h = δ γ = h = γ δ } Smlrly h ξ = 4 ξ + ξ δ = γ = h ξ = 4 + ξ ξ
Expressons for bss functons on n rbtrry ntervl [x, x + ] Interpolton 3 Use the lner trnsformton xξ = x N ξ + x +N ξ = x ξ + x + + ξ x + x + = + x + x ξ The nverse trnsformton s: ξx = x x + x + x + x = x x + x + x + ξ = x + x + x x x + = x x x + x x + x + ξ = x + x x x ξ = x + x ξ = x + x + x x + x x Here x = x + x nd observe tht h x = [ x + x x ] x + x x 3 4 h + x = [ x + x + x] x x x 3 4 h x = x x x + x x 43 h + x = x + xx x x 44 d dξ ξ = d dx ξx dx dξ = d dx ξx x Error nvolved: For functon vlues the error s gven by: whle for dervtves the error s : fx hx f 4 x 4 384 f x h x f 4 3 x 3 6
4 43 Pecewse Cubc Splne nterpolton NDOF: 4N 3N = N + + specfy fx t x,, x N + extr condtons 43 Dervton usng Cubc Herme nterpolton Snce we hve smlr pecewse cubc polynomls to the Pecewse Cubc Hermte polynomls on ech subntervl but wth ddtonl contnuty requred t the N nteror nodes, our strtng pont s the Hermte cubc bss expnson We then mpose ddtonl condtons to mke up for the dervtves f x whch re not known or requred n the cse of splnes On [x k, x k+ ] x k x k x k+ [ x k + x x k ] x k+ x [ x k + x k+ x] x x k sx = f k x k 3 + f k+ x k 3 +s x x k x k+ x k x k + s x x k+ x x k k+ x k where the f k nd f k+ from the Hermte expnson hve been replced by the unknown qunttes s k nd s k+ whch re to be determned by system of equtons whch ensure tht x s contnuous t nternl nodes The frst nd second dervtves of sx must be contnuous t the ntereor ponts x j, j = N Contnuty of the frst dervtve s lredy obtned by our choce of bss functons So we pply contnuty of x to get equtons for the coeffcents s k Tht s, we clculte s x on the two ntervls [x k, x k ] nd [x k, x k+ ] nd requre contnuty t x k After some lgebr x k s k + x k + x k s k + x k s k+ = 3f[x k, x k+ ] x k + f[x k, x k ] x k We hve N equtons nd N + unknowns s, s,, s N so we need more condtons Sy we specfy I f = s nd s N = f N then on unform mesh x k = x: 4 s 4 s 4 4 s N = 3 f[x, x ] + f[x, x ] f[x, x 3 ] + f[x, x ] f[x N, x N ] + f[x N, x N ] s s N A trdgonl system of equtons esy to solve!
Interpolton 5 43 Alterntve cubc splne dervton for dervtve prmry vrbles y y + Y x x x + Let Y x = x x 3 + b x x + c x x + d Y x = 3 x x + b x x + c Y x = 6 x x + b y = Y x = d y + = Y x + = h 3 + b h + c + y where = x + x Let s = Y x = c s + = Y x + = 3 h + b + s Y x = b = Y x = 6 + b [ ] [ ] [ h 3 h y+ y 3h = s h ] b s + s / / = y + y s h 4 s + s h h 4 6 y { b = h 3 s + s 3h y + y s } / h 4 y+ y = h 3 + s + + s h y+ y s b = 3 + + s h s + + s = y + 6 s + s + 6 y s + s 6 y + y = s + + 4 s + 4 s + s s + + + s + s = 3f[x, x ] + f[x, x + ]
6 433 Another splne dervton wth y y y + s prmry vrbles Y x Y x Y + x x x x + Let Y x = x x 3 + b x x + c x x + d Y x = 3 x x + b x x + c Y x = 6 x x + b t x : y = Y x = d nterpoltes the functon t x 45 y + = Y x + = h 3 + b h + c + y enforce contnuty 46 Introduce prmry vrble : = Y x = b b = / 47 Buld n contnuty of Y + = Y x + = 6 + = s Impose contnuty of frst dervtves: c = y + s s + Y x = s x x 3 + s 6 x x + c x x + y s + y + = s h 3 + s 6 + c + y y+ y s + c = s s 6 h = y s + + s 6 s Y + + s 6 Y x = 3 x x + b x x + c = c x = 3 h + b + c s = 3 s 6 h + + { y 6 48 s + s 6 } or 3 + 6 + + + + = 6 y y + + + + = 6 y y =, N EXTRA CONDITIONS N EQ
434 Extr Condtons y y y n x h x x h n x N X N Nturl Splne: = = N two extr condtons Interpolton 7 h + h h h h + h h h N h N h N + h N N = 6 y y h y y h y 3 y h y y h y N y N h N y Ny N h N Clmped Splne: Specfed frst dervtves Gven f x = A nd f x n = B A = Y x = c = y y h h s + h 6 = A h + h = 6 y y h A B = Y Nx n = 3 n h n + b n h n + c n sn s n = 3 h n + s n h n + y n y n hn n + h n n 6h n h n 6 6 B y n y n = 3h n n 3h n n + 6h n n h n n h n n h n 6 B y ny n h n = h n n + h n n But h + h + h + h = 6 {[f [x, x ] f [x, x ]} h h h h + h h h n h n + h n h n h n h n N N = 6 y y /h A y y /h y y h y n y n /h n y n y n /h n B ynyn y h n
8 3 Qudrtc boundry ntervl representton = s s 6h qudrtc = N = N = n = s N s N 6h N qudrtc 3h + h h h h + h h 4 Lner extrpolton h N3 + h N h N h N h N + 3h N N = 6 f[x, x ] f[x, x ] f[x N, x N f[x N, x N ] S x S S S x x x = h + h h h = s = h h h h + h + h + h = 6f[x, x ] f[x, x ] h h + h h + h h + h + h = RHS h h h h + h h h + h + h = RHS h h +h h h h + h h h h h h + h h h h
Interpolton 9 5 Not--knot condton Y x Y x Y N x Y N x Unknowns = 4N Constrnts = 3N 3 4N 3N 3 = N + unknowns the vlues t x,, x N + + + + = 6f[x, x ] f[x, x ] Y x = x x 3 + b x x + c x x + d Y x = 3 x x + b x x + c Y x = 6 x x + b, x x = h s = Y x = 6 x x + 6h / = h + h = h + h h h h But h + h + h + h = 6f[x, x ] f[x, x ] + h h + h + h h h Also + h N h N + h N N + h N h N h N h + h = 6f[x, x ] f[x, x ] h N + h N N = 6f[x N, x N ] f[x N, x N ] + h h h + h h h h + h h h + h h 6 A perodc splne: h N h N h N + h N x + = x N x + = x N h N + h N h N h N + h N N N
III Smoothness property of nturl splne x = = x N In order to mpose ths condton t s convenent to consder the k s unknowns n whch cse the equtons become: x k k + x k + x k+ k + x k+ k+ = 6f[x k, x k+ ] f[x k, x k ] k =,, N NOTE: Importnt dentty: y [y + ] = y y + = y Let yx be ny other nterpolnt of fx t x,, x N then y dx Now dx = y dx = y s y dx + = y s = y s b b b N y dx x k y s dx = const on ech subntervl k= x k N x k c k y s botnterpolnts k= If we choose s : = = b for exmple or f y nd s botnterpolte f t nd b then y dx = y dx + x k dx dx Thus s s the nterpolnt wth the MINIMUM CURVATURE e smoothest Error nvolved n splne nterpolton: fx = sx f 4 5 x4 384 f x s x f 4 x 3 4 f x s x f 5 x 4 6 y dx = x = mx x : for nonunform ponts nd ll x [x, x N ] for nonunform ponts nd ll x [x, x N ] for unform smple ponts x cubc splne provdes n excellent technque for NUMERICAL DIFFERENTIATION
Interpolton How do we solve for the { k }? d c d c 3 d 3 d n c n n d n x x x n = b b n d d x + c x = b 4 d x + d x + c x 3 = b 4 d c x + c x 3 = b b d d d x + c x 3 = b d = d d c b = b d b Smlrly d k+x k+ + c k+ x k+ = b k+ 43 where d k+ = d k+ k+ d k c k b k+ = b k+ k+ d b k 44 k d c d c d n c n d n x x n = b b b n Bck Substtuton x n = b n/d n x n = b n c n x/d n x n = b n/d n 45 x k = b k c k x k+ /d k k = n,, 46
Note, f we let m k = k d k then A = m m n d c c n d n LU = LU Forwrd Ly = b y = L b Bck Ux = y Substtuton