Pyrmd Algorthms for Brycentrc Rtonl Interpolton K Hormnn Scott Schefer Astrct We present new perspectve on the Floter Hormnn nterpolnt. Ths nterpolnt s rtonl of degree (n, d), reproduces polynomls of degree d, nd hs no rel poles. By cstng the evluton of ths nterpolnt s pyrmd lgorthm, we frst demonstrte close relton to Nevlle s lgorthm. We then derve n O(nd) lgorthm for computng the rycentrc weghts of the Floter Hormnn nterpolnt, whch mproves upon the orgnl O(nd 2 ) constructon. Introducton Gven the n + nterpolton nodes x 0 < x < < x n nd the ssocted dt f 0, f..., f n, there re two wys to wrte the rtonl Floter Hormnn nterpolnt [3] of degree d n. On the one hnd, t cn e expressed s the lend n d r(x) = λ (x)p (x) n d λ () (x) of the polynomls p of degree d, whch loclly nterpolte the dt f,..., f +d, wth weghtng functons λ (x) = ( ) (x x ) (x x +d ). On the other hnd, t cn e wrtten n the rycentrc form / n ( ) n ( ) r(x) = w f w (2) x x x x wth postve weghts w = mn(,n d) +d =mx(0, d) k=,k x x k. (3) The rycentrc form s prtculrly suted for evlutng the nterpolnt r n O(n) tme, once the weghts w, whch depend only on the nodes x nd not on the dt f, hve een precomputed. Usng (3), these weghts cn e determned n O(nd 2 ) steps, whch s exctly how common lrres lke Numercl Recpes [5] nd ALGLIB [2] perform the computton. We present two novel procedures for evlutng r(x), whch re nspred y Ron Goldmn s pyrmd lgorthms [4] for the evluton of polynoml nd splne curves. Whle the frst s tlored for Floter Hormnn nterpolnts nd explots the representton of r n (), the second s sed on (2) nd works for generl rycentrc rtonl nterpolnts of degree (n, n) wth rtrry weghts w. Both lgorthms requre O(n 2 ) opertons nd re closely relted to Nevlle s lgorthm for constructng nterpoltng polynomls of degree n. They further led to novel O(nd) lgorthm for computng the weghts n (3). Correspondng uthor; phone: +4.58.666.43.27; fx: +4.58.666.45.36; eml: k.hormnn@us.ch The clm n [5, pge 28] tht the worklod to construct the weghts s of order O(nd) opertons s wrong, ecuse the gven code ust mplements the formul n (3) n strghtforwrd wy nd s clerly of order O(nd 2 ).
+ + + 2 + 2 + 2 2 + Fgure : Pyrmd notton for lner comntons. Thck rrows ndcte ffne comntons, where we omt the normlzton fctors of the weghts to keep the dgrm less cluttered. Dshed rrows ndcte tht the weghts need to e multpled wth /2. Q 5 0 (x) Q 4 0 (x) Q4 (x) x x Q 3 0 (x) Q3 (x) Q3 2 (x) x x Q 2 0 (x) Q2 (x) Q2 2 (x) Q2 3 (x) x x Q 0 (x) Q (x) Q 2 (x) Q 3 (x) Q 4 (x) x x x x x x 4 Q 0 0 (x) Q0 (x) Q0 2 (x) Q0 3 (x) Q0 4 (x) Q0 5 (x) Fgure 2: Exmple of the pyrmd lgorthm for Floter Hormnn nterpolton wth n = 5 nd d = 2. 2 Evlutng the rtonl nterpolnt Usng the notton n Fgure, the Floter Hormnn nterpolnt n () cn e evluted y the pyrmd lgorthm n Fgure 2, whch s slght vrton of Nevlle s lgorthm [4, Chpter 2.2], where the weghts n the top n d rows of the pyrmd re not normlzed nd the weghts t the nteror edges n these rows re multpled wth n ddtonl fctor of /2. Tht s, for some gven evluton prmeter x, we strt wth the ntl dt Q 0 (x) = (f, ), = 0,..., n nd compute the ottom d rows of the pyrmd wth Nevlle s lgorthm s Q l (x) = x +l x Q l (x) + x x Q l + (x), = 0,..., n l, x +l x x +l x for l =,..., d, resultng n the vlues Q d (x) = (p (x), ), = 0,..., n d. We then contnue to compute the top n d rows of the pyrmd s Q l (x) = η n l+ for l = d +,..., n, where (x +l x)q l (x) + η n l+ η l = + (x x )Q l + (x), = 0,..., n l, {, f = 0 or = l, /2, otherwse, 2
P 0 0 η 0 η P 0 P η 2 0 η 2 η 2 η 2 2 P 2 0 P 2 P 2 2 η 3 0 η 3 η 3 η 3 2 η 3 2 η 3 3 P 3 0 P 3 P 3 2 P 3 3 Fgure 3: Recurrence of the vlues P l (left), whch re ll equl to (rght). resultng n the vlue Q n 0 (x) = ( f(x), g(x) ). We now oserve tht the dgrm n Fgure 2 stsfes the prllel property, tht s, prllel rrows ll hve the sme lels. Hence the product of lels long ny pth from Q d (x) to the pex of the pyrmd s lwys where µ (x) = (x x ) =0 n k=+d+ π(x) = (x k x) = ( ) n d π(x)λ (x), n (x x ). =0 Due to the ddtonl fctors η l, ech of these pths s further multpled y some power of /2. Denotng the sum of these powers y P n d, we hve n d Q n 0 (x) = P n d µ (x)q d (x). As ny pth from the node Q l s cler tht the vlues P l stsfy the recurrence 2 P 0 0 =, (x) to the pex must trverse ether of the nodes Ql P l = η l P l + ηl P l, = 0,..., l, l =,..., n d, s shown n Fgure 3, nd t follows y nducton tht P n d = for = 0,..., n. Therefore, (x) or Ql (x), t n d f(x) = ( ) n d π(x) λ (x)p (x), n d g(x) = ( ) n d π(x) λ (x), nd fnl dvson of these two components of Q n 0 (x) gves r(x) = f(x) g(x). 2 For the ske of smplcty, we tctly follow the conventon tht P l = 0 for < 0 nd > l. 3
R 5 0 (x) R 4 0 (x) R4 (x) x x R 3 0 (x) R3 (x) R3 2 (x) x x R 2 0 (x) R2 (x) R2 2 (x) R2 3 (x) x x R 0 (x) R (x) R 2 (x) R 3 (x) R 4 (x) x x x x x x 4 R 0 0 (x) R0 (x) R0 2 (x) R0 3 (x) R0 4 (x) R0 5 (x) Fgure 4: Exmple of the pyrmd lgorthm for generl rycentrc rtonl nterpolton wth n = 5. Another opton s to evlute the nterpolnt r y modfyng ll the rows of Nevlle s lgorthm, s shown n Fgure 4, nd to use the ntl dt R 0 (x) = w (f, ) = (w f, w ), = 0,..., n. We then compute the rows of the pyrmd from ottom to top s R l (x) = η n l+ for l =,..., n wth η l (x +l x)r l (x) + η n l+ defned s ove, resultng n the vlue + (x x )R l (x), = 0,..., n l, R n 0 (x) = ( f(x), g(x) ). Wth rguments smlr to the ones ove, t cn e shown tht n f(x) = ( ) n ( ) n π(x) w f, g(x) = ( ) n ( ) π(x) w, x x x x nd fnl dvson gves r(x) = f(x) g(x). Note tht ths second lgorthm works for ny set of weghts w, hence for ny rtonl nterpolnt of degree (n, n). Clerly, oth lgorthms requre O(n 2 ) steps nd re thus slower nd possly not s roust s the O(n) evluton of r(x) wth the rycentrc form (2), ut we eleve tht ths formulton sheds some nterestng new lght on the de of rycentrc rtonl nterpolton. We would further lke to pont out tht the lgorthm n Fgure 2 ers strong resemlnce to the lgorthm of Brry nd Goldmn [] for evlutng Ctmull Rom splnes. Both lgorthms frst crry out few rounds of Nevlle s lgorthm to compute the locl polynoml nterpolnts p (x), ut they dffer n the wy these vlues re comned whle gong through the top rows of the pyrmd: for Ctmull Rom splnes we lend the locl polynomls wth B-splne ss functons, nd for Floter Hormnn nterpolnts we use λ / n d =0 λ s lendng functons. 4 +
x x 0 x x 0 x 2 x 0 x 2 x 0 V0 2 V 2 V2 2 V3 2 V0 V V2 V3 V4 x 2 x x 2 x x 3 x x 3 x x 3 x 2 x 3 x 2 x 4 x 2 x 4 x 2 x 4 x 3 x 4 x 3 x 5 x 3 x 5 x 3 x 5 x 4 x 5 x 4 V0 0 V 0 V2 0 V3 0 V4 0 V5 0 Fgure 5: Exmple of the pyrmd lgorthm for computng the Floter Hormnn weghts w n (3) wth n = 5 nd d = 2. 3 Computng the weghts Comprng the two lgorthms n Fgures 2 nd 4, we notce tht they re dentcl n the top n d rows nd tht the nput dt Q 0 (x) nd R0 (x) dffer y the fctors w. Ths oservton suggests tht there mght exst n effcent pyrmd lgorthm for computng the Floter Hormnn weghts. Indeed, we cn determne the weghts w f we strt wth the vlues V d =, = 0,..., n d nd then work our wy down the ottom d rows of the pyrmd, usng the normlzton fctors from Nevlle s lgorthm, to compute 3 V l = V l+ x +l x + for l = d, d 2,..., 0, s shown n Fgure 5. To see tht V 0 vlues U l = mn(,n l) =mx(0, l) V l +l k=,k V l+ x +l+ x, = 0,..., n l, (4) = w for = 0,..., n, consder the, = 0,..., n, l = 0,..., d. (5) x x k For these vlues we clerly hve U 0 = V 0 nd U d = w for = 0,..., n, nd we further show tht U l = U l+ for ny l = 0,..., d. The mn de s frst to expnd ech ddend A l of U l usng (4) nd then to ugment the products y one fctor, A l = V l +l k=,k ( x x k = = V l+ V l+ x +l x + V l+ ) +l x +l+ x k=,k +l x x x +l x x x k k=,k }{{} =B l Next oserve tht the terms C l from Al nd Bl + from Al + C l + B+ l = V l+ x +l+ x x +l+ x = V l+ +l+ k=,k +l+ k=,k x x k = Al+. 3 For the ske of smplcty, we tctly follow the conventon tht V l x x k + V l+ x +l+ x x +l+ x x x k + V l+ x x x +l+ x +l+ k=,k x x k } {{ } =C l sum up to the ddend Al+ of U l+, +l+ k=,k = 0 for < 0 nd > n l. x x k. 5
Fnlly, notce tht B0 l = 0, ecuse V l+ = 0, nd B l l = Al+ l for > l, nd smlrly Cl n l = 0, ecuse V l+ n l = 0, nd Cl = Al+ for < n l. If we now denote the lower nd upper ounds of the summton ndex n (5) y l = mx(0, l), l = mn(, n l) nd dstngush the dfferent cses of the ndex, where ether l = 0 or l = l nd ether l = or l = n l, we fnd tht n ll cses U l = l = l A l = B l l + l = l + B l + l = l C l + C l l l = B l + l = l A l+ + C l l = l+ = l+ A l+ = U l+. Therefore, V 0 = U 0 = U = = U d = w, whch sserts tht the Floter Hormnn weghts re determned y the lgorthm ove n O(nd) steps. References [] P. J. Brry nd R. N. Goldmn. A recursve evluton lgorthm for clss of Ctmull Rom splnes. ACM SIGGRAPH Computer Grphcs, 22(4):99 204, Aug. 988. [2] S. Bochknov. ALGLIB 3.9.0 User Gude Interpolton nd fttng Rtonl nterpolton. http://www.lgl.net/nterpolton/rtonl.php, Dec. 204. [Onlne; ccessed 0-June- 205]. [3] M. S. Floter nd K. Hormnn. Brycentrc rtonl nterpolton wth no poles nd hgh rtes of pproxmton. Numersche Mthemtk, 07(2):35 33, Aug. 2007. [4] R. Goldmn. Pyrmd Algorthms: A Dynmc Progrmmng Approch to Curves nd Surfces for Geometrc Modelng. The Morgn Kufmnn Seres n Computer Grphcs nd Geometrc Modelng. Morgn Kufmnn, Sn Frncsco, 2003. [5] S. Teukolsky, B. P. Flnnery, W. T. Vetterlng, nd W. H. Press. Numercl Recpes n C: The Art of Scentfc Computng, chpter 3.4., pges 27 29. Cmrdge Unversty Press, New York, thrd edton, 2007. 6