Lagrange Interpolation and Neville s Algorithm Ron Goldman Department of Computer Science Rice University
Tension between Mathematics and Engineering 1. How do Mathematicians actually represent curves and surfaces? Algebra -- Formulas and Algorithms 2. How do Scientists and Engineers want to represent curves and surfaces? Geometry -- Interpolation and Approximation
Straight Lines Q P Equation =?
Linear Interpolation Straight Line P(t) = P + t(q P) P(t) = (1 t)p + tq Observations P(0) = P P(1) = Q P(t) Q = P(1) P = P(0)
Linear Interpolation P(t) Q = P(1) P = P(0) P(t) Q = P(t 1 ) P = P(t 0 )
Linear Interpolation Revisited Straight Line P 01 (t) = ( 1 f (t))p 0 + f (t)p 1 f (t 0 ) = 0 and f (t 1 ) = 1 y axis (t 1,1) y = t t 0 t 1 t 0 (t 0, 0) t axis
Linear Interpolation Revisited Linear Interpolation f (t) = (t t 0 ) (t 1 t 0 ) f (t 0 ) = 0 and f (t 1 ) = 1. Straight Line P 01 (t) = t 1 t t 1 t 0 P 0 + t t 0 t 1 t 0 P 1 P(t 0 ) = P P(t 1 ) = Q P 01 (t) Q = P(t 1 ) P = P(t 0 )
Linear Interpolation P 01 (t) t 1 t t 1 t 0 t t 0 t 1 t 0 P 01 (t) t 1 t t t 0 P 0 P 0 Normalized P 1 Unnormalized P 1 P 01 (t) = t 1 t t 1 t 0 P 0 + t t 0 t 1 t 0 P 1 P 01 (t 0 ) = P 0 P 01 (t 1 ) = P 1
Quadratic Interpolation P 0 P 1 P 01 (t) P 12 (t) P 012 (t) P 2 Problem Find a smooth curve P 012 (t) such that: P 012 (t 0 ) = P 0 P 012 (t 1 ) = P 1 P 012 (t 2 ) = P 2
Quadratic Interpolation Linear Interpolation P 01 (t) = t 1 t t 1 t 0 P 0 + t t 0 t 1 t 0 P 1 P 12 (t) = t 2 t t 2 t 1 P 1 + t t 1 t 2 t 1 P 2 Quadratic Interpolation P 012 (t) = t 2 t t 2 t 0 P 01 (t) + t t 0 t 2 t 0 P 12 (t)
Verification of Quadratic Interpolation P 012 (t) = t 2 t t 2 t 0 P 01 (t) + t t 0 t 2 t 0 P 12 (t) i. P 012 (t 0 ) = P 01 (t 0 ) = P 0 ii. P 012 (t 2 ) = P 12 (t 2 ) = P 2 iii. P 012 (t 1 ) = t 2 t 1 t 2 t 0 P 01 (t 1 ) + t 1 t 0 t 2 t 0 P 12 (t 1 ) = t 2 t 1 t 2 t 0 P 1 + t 1 t 0 t 2 t 0 P 1 = P 1 P 0 = P 012 (t 0 ) P 1 = P 012 (t 1 ) P 012 (t) P 2 = P 012 (t 2 )
Neville s Algorithm for Quadratic Interpolation P 012 (t) t 2 t t t 0 P 01 (t) P 12 (t) t 1 t t t 0 t2 t t t 1 P 0 P 1 P 2 P 012 (t k ) = P k
Cubic Interpolation P 3 P 1 P 0 P 2 Problem Find a smooth function P 0123 (t) such that: P 0123 (t 0 ) = P 0 P 0123 (t 1 ) = P 1 P 0123 (t 2 ) = P 2 P 0123 (t 3 ) = P 3
Neville s Algorithm for Two Quadratic Curves P 012 (t) P 123 (t) t 2 t t t 0 t 3 t t t 1 P 01 (t) P 12 (t) P 12 (t) P 23 (t) t 1 t t t 0 t 2 t t t 1 t 2 t t t 1 t 3 t t t 2 P 0 P 1 P P 2 1 P 2 P 3 P 012 (t) P 123 (t) t 2 t t t 0 t 3 t t t 1 P 01 (t) P 12 (t) P 23 (t) t 1 t t t 0 t 2 t t t 1 t 3 t t t 2 P 0 P 1 P 2 P 3
Neville s Algorithm for Cubic Curves P 0123 (t) t 3 t t t 0 P 012 (t) P 123 (t) t 2 t t t 0 t 3 t t t 1 P 01 (t) P 12 (t) P 23 (t) t 1 t t t 0 t 2 t t t 1 t 3 t t t 2 P 0 P 1 P2 P 3 P 0123 (t k ) = P k
Verification of Cubic Interpolation P 0123 (t) = t 3 t t 3 t 0 P 012 (t) + t t 0 t 3 t 0 P 123 (t) i. P 0123 (t 0 ) = P 012 (t 0 ) = P 0 ii. P 0123 (t 3 ) = P 123 (t 3 ) = P 3 iii. P 0123 (t 1 ) = t 3 t 1 t 3 t 0 P 012 (t 1 ) + t 1 t 0 t 3 t 0 P 123 (t 1 ) = t 3 t 1 t 3 t 0 P 1 + t 1 t 0 t 3 t 0 P 1 = P 1 iv. P 0123 (t 2 ) = P 2 (same as proof for t 1 )
Neville s Algorithm for Lagrange Interpolation Theorem: Given points P 0,..., P n and parameters t 0,..., t n, there exists a polynomial curve P 0Ln (t) of degree n that interpolates the given points at the specified parameter values. That is, P 0Ln (t k ) = P k k = 0,..., n. Proof: By induction on n. Define P 0Ln (t) = t n t t n t 0 P 0Ln 1 (t) + t t 0 t n t 0 P 1Ln (t). Applying the same arguments we used in the quadratic and cubic cases, you can easily verify that P 0Ln (t k ) = P k k = 0,..., n. Since P 0Ln 1 (t) and P 1Ln (t) are polynomials of degree n 1, it follows that P 0Ln (t) is a polynomial of degree n.
Neville s Algorithm -- Recursive Calls P 0123 (t) P 012 (t) P 123 (t) P 01 (t) P 12 (t) P 12 (t) P 23 (t) P 0 P 1 P 1 P 2 P 1 P 2 P 2 P 3
Neville s Algorithm -- Dynamic Programming P 0123 (t) t 3 t t t 0 P 012 (t) P 123 (t) t 2 t t t 0 t 3 t t t 1 P 01 (t) P 12 (t) P 23 (t) t 1 t t t 0 t 2 t t t 1 t 3 t t t 2 P 0 P 1 P2 P 3 P 0123 (t k ) = P k
Polynomial Algebra Theorem: A non-zero polynomial of degree less than or equal to n can have at most n roots. Proof: Recall that if P(t) is a polynomial, then r is a root of P(t) t r is a factor of P(t). Now a polynomial of degree at most n can have at most n linear factors. Therefore a polynomial of degree less than or equal to n can have at most n roots. Corollary: The only polynomial of degree less than or equal to n with more than n roots is the zero polynomial.
Uniqueness of Lagrange Interpolation Theorem: Given points P 0,..., P n and parameters t 0,..., t n, there exists only one polynomial curve P 0Ln (t) of degree n that interpolates the given points at the specified parameter values. That is, the curve generated by Neville s algorithm is unique Proof: Suppose that there are two polynomials of degree n such that Define P 0Ln (t k ) = P k k = 0,..., n Q 0Ln (t k ) = P k k = 0,...,n. R 0Ln (t) = Q 0Ln (t) P 0Ln (t). Then R 0Ln (t) is a polynomial of degree at most n. But R 0Ln (t k ) = Q 0Ln (t k ) P 0Ln (t k ) = 0 k = 0,...,n, so R 0Ln (t) has n +1 roots. Therefore R 0Ln (t) must be the zero polynomial, so P 0Ln (t) = Q 0Ln (t).
Uniqueness of Lagrange Interpolation (continued) Corollary: The Lagrange interpolant reproduces polynomials. That is, if the points P 0,..., P n lie at the parameters t 0,..., t n on a polynomial P(t) of degree less than or equal to n, then P 0Ln (t) = P(t). Observations Uniqueness applies only for fixed nodes. Changing the nodes t 0,..., t n, changes the Lagrange interpolant, even if the interpolation points P 0,..., P n are exactly the same.
Tensor Product Surface Interpolation Setup s = s 0 t = t 3 s = s 3 t = t 0 (a) Domain -- Rectangular Grid P 03 P 13 P 23 P 33 P 02 P 12 P 22 P 32 P 01 P 11 P 21 P 31 P 00 P 10 P 20 P 30 (b) Range -- Rectangular Array of Points Problem Find a smooth surface P(s,t) such that: P(s i,t j ) = P ij
Surface Interpolation P 03 P 13 P 23 P 33 P 02 P 12 P P(s,t) P 22 32 P 0 (t) P 1 (t ) P 2 (t) P 3 (t ) P 01 P 11 P 21 P 31 P 00 P10 P 20 P 30
Surface Interpolation
Neville s Algorithm for Tensor Product Surfaces P(s,t) s 2 s s s 0 s 1 s P 01 ( s) s s 0 s 2 s P 12 ( s) s s 1 t 2 t P 0 (t) P 1 (t ) t t 0 t 2 t t t 0 t 2 t P 2 (t) t t0 P 01 (t) P 12 (t) P 01 (t) P 12 (t) P 01 (t) P 12 (t) t 2 t t t 1 t 1 t t t 0 t t t t t 1 1 t t 1 t t t 0 t 2 t 0 t2 t t t 1 P 00 P P 01 02 P 10 P 11 P12 P 20 P21 P 22
Lofted Surface U 0 (t) U 1 (t) U 2 (t) U 3 (t) L U (s,t)
Neville s Algorithm for Lofted Surfaces L U (s,t) = U 0123 (s,t) s 3 s s s 0 U 012 (s,t) U 123 (s,t) s 2 s s s 0 s 3 s s s 1 U 01 (s,t) U 12 (s,t) U 23 (s,t) s 1 s s s 0 s 2 s s s 1 s 3 s s s 2 U 0 (t) U 1 (t) U 2 (t) U 3 (t)
Ruled Surface U 0 (t) U 1 (t) R(s,t) = s 1 s s 1 s 0 U 0 (t) + s s 0 s 1 s 0 U 1 (t)
Summary Key Ideas Linear Interpolation Dynamic Programming -- Neville s Algorithm Extensions to Surfaces Tensor Product Lofted Ruled
Themes Linearity Mathematics is Easy Represent Complicated Curves and Surfaces by (Successive) Linear Interpolations Polynomial Curves and Surfaces Lagrange Interpolation -- Neville s Algorithm Bezier Approximation -- de Casteljau s Algorithm B-Splines -- de Boor s Algorithm Blossoming