Chain rules for divided differences and the error in parametric curve interpolation Michael Floater Centre of Mathematics for Applications, Department of Informatics, University of Oslo Parametric curve interpolation We can interpolate a sequence of points x0 , x1 , . . . , xn ∈ Rd , with a (vector-valued) polynomial p : R → Rd , degree ≤ n, by choosing any parameter values t0 < t1 < · · · < tn and demanding that p(ti ) = xi , i = 0, 1, . . . , n. Examples: I find the ti to reduce the degree of p, de Boor, Höllig & Sabin (1987), Degen (1993), Scherer & Mørken (1997), Schaback (1998), Grandine & Hogan (2004). I choose ‘uniform’ ti : let ti = i. I choose ‘chordal’ ti : let t0 = 0 and ti+1 = ti + kxi+1 − xi k. Approximation error Suppose the points xi are samples xi = f(si ) from some (often unknown) curve f : R → Rd , where s0 < s1 < · · · < sn . What is the error of approximation, i.e., what is the distance between p|[t0 ,tn ] and f|[s0 ,sn ] ? A natural way to measure the distance is to let φ : R → R be the polynomial, degree ≤ n, such that φ(ti ) = si , i = 0, 1, . . . , n, and look at the difference f(φ(t)) − p(t), t ∈ [t0 , tn ]. Since p interpolates f ◦ φ at t = ti , Newton’s error formula gives f(φ(t)) − p(t) = (t − t0 )(t − t1 ) · · · (t − tn )[t0 , t1 , . . . , tn , t](f ◦ φ). In this talk: 1. Derive formulas for divided differences of composite functions 2. Some resulting error analysis 3. Other divided difference formulas... Derivatives of composite functions Basic chain rule: (g ◦ f )0 (x) = g 0 (f (x))f 0 (x). Higher order chain rules: (g ◦ f )00 (x) = g 00 (f (x))(f 0 (x))2 + g 0 (f (x))f 00 (x), (g ◦ f )000 = g 000 (f 0 )3 + 3g 00 f 0 f 00 + g 0 f 000 , (g ◦ f )(4) = g (4) (f 0 )4 + 6g 000 (f 0 )2 f 00 + g 00 (3(f 00 )2 + 4f 0 f 000 ) + g 0 f (4) , (g ◦ f )(5) = · · · . Faa di Bruno’s formula Published in 1857: (g ◦f )(n) (x) = X n! g (k) (f (x)) b1 ! · · · bn ! f (1) (x) 1! !b1 ··· f (n) (x) n! The sum is over all k = 1, . . . , n and solutions b1 , . . . , bn ≥ 0 to b1 + b2 2 + · · · + bn n = n, b1 + · · · + bn = k, i.e., partitions of the integer n. Cavaliere Francesco Faa di Bruno, Note sur une nouvelle formule de calcul differentiel, Quarterly J. Pure Appl. Math, 1 (1857), 359–360. !bn Examples 3 = b1 + b2 2 + b3 3 3=1+1+1=1+2=3 000 (g ◦ f ) = g 000 (f 0 )3 + 3g 00 f 0 f 00 + g 0 f 000 4 = b1 + b2 2 + b3 3 + b4 4 4=1+1+1+1=1+1+2=1+3=2+2=4 (g ◦ f )(4) = g (4) (f 0 )4 + 6g 000 (f 0 )2 f 00 + 4g 00 f 0 f 000 + 3g 00 (f 00 )2 + g 0 f (4) Divided differences [x0 ]f = f (x0 ) f (x1 ) − f (x0 ) [x0 , x1 ]f = , x − x0 1 f (x2 ) − f (x1 ) f (x1 ) − f (x0 ) . − (x2 − x0 ), [x0 , x1 , x2 ]f = x2 − x1 x1 − x0 ... [x1 , . . . , xn ]f − [x0 , . . . , xn−1 ]f [x0 , . . . , xn ]f = xn − x0 f (n) (x) x0 ,...,xn →x n! (n) f (ξ) [x0 , . . . , xn ]f = , n! lim [x0 , . . . , xn ]f = some ξ ∈ [x0 , xn ]. Chain rule for divided differences [x0 , . . . , xn ](g ◦ f ) = n X X k Y [f (xi0 ), . . . , f (xik )]g [xij−1 , . . . , xij ]f . k=1 0=i0 <···<ik =n j=1 I The second sum is over all sequences i1 < i2 < · · · < ik−1 of integers from the set {1, 2, . . . , n − 1}. n−1 . Number of terms in second sum = k−1 I Total number of terms = 2n−1 . I Unlike Faa di Bruno’s formula there are no factorials! I Examples [x0 , x1 ](g ◦ f ) = [f (x0 ), f (x1 )]g [x0 , x1 ]f , [x0 , x1 , x2 ](g ◦ f ) = [f (x0 ), f (x2 )]g [x0 , x1 , x2 ]f + [f (x0 ), f (x1 ), f (x2 )]g [x0 , x1 ]f [x1 , x2 ]f , [x0 , x1 , x2 , x3 ](g ◦ f ) = [f 0 , f 3 ]g [x0 , x1 , x2 , x3 ]f + [f 0 , f 1 , f 3 ]g [x0 , x1 ]f [x1 , x2 , x3 ]f + [f 0 , f 2 , f 3 ]g [x0 , x1 , x2 ]f [x2 , x3 ]f + [f 0 , f 1 , f 2 , f 3 ]g [x0 , x1 ]f [x1 , x2 ]f [x2 , x3 ]f . Second chain rule for divided differences [x0 , . . . , xn ](g ◦ f ) = n X [f (x0 ), . . . , f (xk )]g [xk , . . . , xn ]([x0 , ·]f · · · [xk−1 , ·]f ). k=1 I The last part can be expanded using the product rule. n−1 , the same as in the Number of terms of order k = k−1 previous formula. I Total number of terms = 2n−1 , as before. I Again, no factorials! I Examples [x0 , x1 ](g ◦ f ) = [f (x0 ), f (x1 )]g [x 0 , x1 ]f , [x0 , x1 , x2 ](g ◦ f ) = [f (x0 ), f (x1 )]g [x 0 , x1 , x2 ]f + [f (x0 ), f (x1 ), f (x2 )]g [x 0 , x2 ]f [x 1 , x2 ]f , [x0 , x1 , x2 , x3 ](g ◦ f ) = [f 0 , f 1 ]g [x 0 , x1 , x2 , x3 ]f + [f 0 , f 1 , f 2 ]g [x 0 , x2 ]f [x 1 , x2 , x3 ]f + [f 0 , f 1 , f 2 ]g [x 0 , x2 , x3 ]f [x 1 , x3 ]f + [f 0 , f 1 , f 2 , f 3 ]g [x 0 , x3 ]f [x 1 , x3 ]f [x 2 , x3 ]f . Polynomial interpolation, uniform parameterization Theorem. If ti = i, i = 0, 1, . . . , n then kf ◦ φ − pk[t0 ,tn ] ≤ Cn (sn − s0 )2 kf 00 kφ([t0 ,tn ]) . Why? Example: n = 2: f(φ(t)) − p(t) = t(t − 1)(t − 2)[0, 1, 2, t](f ◦ φ), and, with s = φ(t), and if 0 ≤ t ≤ 1 < 2, [0, t, 1, 2](f ◦ φ) = [s0 , s, s2 ]f [0, t]φ [t, 1, 2]φ + [s0 , s1 , s2 ]f [0, t, 1]φ [1, 2]φ + [s0 , s, s1 , s2 ]f [0, t]φ [t, 1]φ [1, 2]φ. Since [s0 , s, s1 , s2 ]f = ([s, s1 , s2 ]f − [s0 , s, s1 ]f)/(s2 − s0 ), and |[u, v ]φ|, |[u, v , w ]φ| ≤ K (s2 − s0 ), result follows. Polynomial interpolation, chordal parameterization Theorem. If t0 = 0 and ti+1 = ti + kxi+1 − xi k, i = 0, 1, . . . , n, then kf ◦ φ − pk[t0 ,tn ] ≤ Cn γs (sn − s0 )4 kf (4) kφ([t0 ,tn ]) . Why? Because chord lengths approximate arc lengths. If kf 0 (s)k = 1, then 0 < (si+1 − si ) − (ti+1 − ti ) ≤ Use divided difference chain rule... 1 (si+1 − si )3 kf 00 k2 . 12 Proof of chain rule Use product rule (Popoviciu, 1933, and Steffensen, 1939). For product of r functions, [x0 , . . . , xn ](f1 f2 · · · fr ) = X r Y [xij−1 , . . . , xij ]fj . 0=i0 ≤i1 ≤···≤ir =n j=1 Use divided difference of a monomial. If n ≤ r , X [x0 , . . . , xn ](·)r = x0µ0 x1µ1 · · · xnµn . µ0 +···+µn =r −n µi ≥0 By interpolation, enough to prove the formula when g is a polynomial of degree ≤ n. By linearity, enough to prove it when g (y ) = y r , r ≤ n. Then (g ◦ f )(x) = f r (x) and by product rule, X [x0 , . . . , xn ](f r ) = r Y [xαβ−1 , . . . , xαβ ]f . 0=α0 ≤α1 ≤···≤αr =n β=1 Take d.d.’s of order 0 outside the product: if (α0 , α1 , . . . , αr ) = (i0 , . . . , i0 , i1 , . . . , i1 , . . . , ik , . . . , ik ) | {z } | {z } | {z } 1+µ0 1+µ1 1+µk for some k, 1 ≤ k ≤ r , and 0 = i0 < i1 < · · · < ik = n, µ0 + · · · + µk = r − k, and µi ≥ 0 then r Y β=1 [xαβ−1 , . . . , xαβ ]f = fi0µ0 fi1µ1 µk · · · fik k Y [xij−1 , . . . , xij ]f . j=1 It follows that [x0 , . . . , xn ](f r ) = r X X X µ0 µk fi0 · · · fik k=1 0=i0 <···<ik =n µ0 +···+µk =r −k = r X X j=1 [fi0 , . . . , fik ](·)r k=1 0=i0 <···<ik =n = n X X k=1 0=i0 <···<ik =n QED. k Y [xij−1 , . . . , xij ]f k Y [xij−1 , . . . , xij ]f j=1 k Y [fi0 , . . . , fik ](·) [xij−1 , . . . , xij ]f . r j=1 Chain rule for multivariate divided differences Divided differences of a bivariate function f (x, y ): let [x0 ; y0 ]f = f (x0 , y0 ) and [x0 , . . . , xm ;y0 , . . . , yn ]f [x1 , . . . , xm ; y0 , . . . , yn ]f − [x0 , . . . , xm−1 ; y0 , . . . , yn ]f = xm − x0 [x0 , . . . , xm ; y1 , . . . , yn ]f − [x0 , . . . , xm ; y0 , . . . , yn−1 ]f . = yn − y0 lim [x , . . . , xm ; y0 , . . . , yn ]f = ,...,x →x 0 x0 m y0 ,...,yn →y D (m,n) f (x, y ) m!n! Introduce shorthand Univariate divided difference: [x; i, j]f := [xi , . . . , xj ]f , i ≤ j. p-variate divided difference: [x; i, j]f = [xi11 , . . . , xj11 ; . . . ; xipp , . . . , xjpp ]f where i = (i 1 , . . . , i p ), j = (j 1 , . . . , j p ) and i ≤ j. 1 p D1n · · · Dpn f (x) D n f (x) lim [x; 0, n]f = = . xk →x n1 ! · · · np ! n! p-variate product rule Two functions: [x; 0, n](fg ) = X [x; 0, i]f [x; i, n]g . 0≤i≤n r functions: r Y [x; 0, n] fj = j=1 r Y [x; ij−1 , ij ]fj . X 0=i0 ≤i1 ≤···≤ir =n j=1 n n i2 i i1 0 0 i3 (p, q)-variate chain rule With f = (f1 , . . . , fq ) : Rp → Rq , g : Rq → R, and fr ,j := fr (xj ), [x; 0, n](g ◦ f) = |n| X X [f1,ij0 , . . . , f1,ij1 ; . . . ; fq,ijq−1 , . . . , fq,ijq ]g × k=1 0=i0 <···<ik =n 0=j0 ≤···≤jq =k q Y jr Y r =1 j=jr −1 +1 [x; ij−1 , ij ]fr . Example 1: p = 2, q = 1, n = (2, 1) The formula is a sum over eight terms, one for each of the paths: k =1: 1 path k =2: 4 paths k =3: 3 paths [x; 00, 21](g ◦ f ) = [f00 , f21 ]g [x; 00, 21]f + [f00 , f10 , f21 ]g [x; 00, 10]f [x; 10, 21]f + [f00 , f20 , f21 ]g [x; 00, 20]f [x; 20, 21]f + [f00 , f01 , f21 ]g [x; 00, 01]f [x; 01, 21]f + [f00 , f11 , f21 ]g [x; 00, 11]f [x; 11, 21]f + [f00 , f10 , f20 , f21 ]g [x; 00, 10]f [x; 10, 20]f [x; 20, 21]f + [f00 , f10 , f11 , f21 ]g [x; 00, 10]f [x; 10, 11]f [x; 11, 21]f + [f00 , f01 , f11 , f21 ]g [x; 00, 01]f [x; 01, 11]f [x; 11, 21]f . Example 2: p = 2, q = 2, n = (1, 1) The formula is a sum over the three paths: k =1: 1 path k =2: 2 paths: left path, right path A path of length k gives rise to k + 1 terms: the number of ways to split a path of length k into two sub-paths. So there are 2 × 1 + 3 × 2 = 8 terms. With a = f1 and b = f2 , [x; 00, 11](g ◦ f) = [a00 , a11 ; b11 ]g [x; 00, 11]a + [a00 ; b00 , b11 ]g [x; 00, 11]b + [a00 , a10 , a11 ; b11 ]g [x; 00, 10]a [x; 10, 11]a + [a00 , a10 ; b10 , b11 ]g [x; 00, 10]a [x; 10, 11]b + [a00 ; b00 , b10 , b11 ]g [x; 00, 10]b [x; 10, 11]b + [a00 , a01 , a11 ; b11 ]g [x; 00, 01]a [x; 01, 11]a + [a00 , a01 ; b01 , b11 ]g [x; 00, 01]a [x; 01, 11]b + [a00 ; b00 , b01 , b11 ]g [x; 00, 01]b [x; 01, 11]b. Further work If g (f (x)) = x, express divided differences of f in terms of divided differences of g . If f (x, y (x)) = 0, express divided differences of y in terms of (bivariate) divided differences of f .