Docsity

Lagrange Interpolation and Neville's Algorithm | COMP 360, Study notes of Computer Graphics

Partial preview of the text

Download Lagrange Interpolation and Neville's Algorithm | COMP 360 and more Study notes Computer Graphics in PDF only on Docsity!

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

Linear Interpolation Straight Line

  • P ( t ) = P + t ( Q − P )
  • P ( t ) = ( 1 − t ) P + tQ Observations

€

P (0) = P

P ( 1 ) = Q

P = P (0)

Q = P ( 1 )

P ( t )

Linear Interpolation

P = P (0)

Q = P ( 1 )

P ( t )

P = P ( t 0 ) Q = P ( t 1 ) P ( t )

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 = P ( t 0 ) Q = P ( t 1 ) P 01 ( t )

Linear Interpolation

P 1

t 1 − t t^ −^ t 0

P 01 ( t )

P 1

t 1 − t

t 1 − t 0

t − t 0

t 1 − t 0

P 01 ( t )

P 0 P

0 Normalized Unnormalized 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 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 2 = P 012 ( t 2 ) P 012 ( t )

Cubic Interpolation P 0

P 1

P 2

P 3

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 1 P 2 P 01 ( t ) (^) P 12 ( t ) P 012 ( t ) t 1 − t t − t 0 t − t (^0) t 2 −^ t t 2 − t t − t 1 P 0 P (^1) P 2 P 12 ( t ) t 2 − t (^) t − t 1 P 3 P 123 ( t ) P 23 ( t ) t 3 − t t 3 − t t^ −^ t 2 t − t 1 t 2 − t t 2 − t t 3 − t t − t 1 t 3 − t t − t 1 t − t 2 P 12 ( t ) (^) P 23 ( t ) P 1 P 2

P 3

t 1 − t (^) t − t 0 t − t 0 P 012 ( t ) P 01 ( t ) P 123 ( t ) P 0

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 ,..., Pn and parameters t 0 ,..., tn, there exists a polynomial curve P 0 L n ( t ) of degree n that interpolates the given points at the specified parameter values. That is, P 0 L n ( tk ) = Pk k = 0 ,..., n. Proof: By induction on n. Define P 0 L n ( t ) = tn − t tn − t 0 P 0 L n − 1 ( t ) + t − t 0 tn − t 0 P 1 L n ( t ). Applying the same arguments we used in the quadratic and cubic cases, you can easily verify that P 0 L n ( tk ) = Pk k = 0,..., n. Since P 0 L n − 1 ( t ) and P 1 L n ( t ) are polynomials of degree n − 1 , it follows that P 0 L n ( t ) is a polynomial of degree n. ♦

Neville’s Algorithm -- Dynamic Programming P 0123 ( t ) t 3 − t t 2 − t t 2 − t t 3 − t t − t 1 t 3 − t t − t 1 t − t 2 P 12 ( t ) (^) P 23 ( t ) P 1 P 2 P 3 t 1 − t (^) t − t 0 t − t 0 t − t 0 P 012 ( t ) P 01 ( t ) P 123 ( t ) P 0 P 0123 ( tk ) = Pk

Advantages of Neville’s Algorithm

1. Numerically Stable - Uses the Given Data Directly - No Need to Represent the Polynomial in the Basis 1 , t , t 2 ,K 2. Fast - Dynamic Programming - O ( n 2 ) vs. O ( 2 n ) 3. Simple Structure - Parallel Property - Strip off First and Last Indices 4. Easy to Update - Add a Computation of O ( n ) Instead of Redoing Work of O ( n 2 ).