chapter 3 interpolation and polynomial approximation
play

Chapter 3 Interpolation and Polynomial Approximation Per-Olof - PowerPoint PPT Presentation

Chapter 3 Interpolation and Polynomial Approximation Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis Polynomial Interpolation Polynomials Polynomials P n ( x ) =


  1. Chapter 3 Interpolation and Polynomial Approximation Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis

  2. Polynomial Interpolation Polynomials Polynomials P n ( x ) = a n x n + · · · a 1 x + a 0 are commonly used for interpolation or approximation of functions Benefits include efficient methods, simple differentiation, and simple integration Also, Weierstrass Approximation Theorem says that for each ε > 0 , there is a P ( x ) such that | f ( x ) − p ( x ) | < ε for all x in [ a, b ] for f ∈ C [ a, b ] . In other words, polynomials are good at approximating general functions.

  3. The Lagrange Polynomial Theorem If x 0 , . . . , x n distinct and f given at these numbers, a unique polynomial P ( x ) of degree ≤ n exists with f ( x k ) = P ( x k ) , for each k = 0 , 1 , . . . , n The polynomial is n � P ( x ) = f ( x 0 ) L n, 0 ( x ) + . . . + f ( x n ) L n,n ( x ) = f ( x k ) L n,k ( x ) k =0 where ( x − x 0 )( x − x 1 ) · · · ( x − x k − 1 )( x − x k +1 ) · · · ( x − x n ) L n,k ( x ) = ( x k − x 0 )( x k − x 1 ) · · · ( x k − x k − 1 )( x k − x k +1 ) · · · ( x k − x n ) ( x − x i ) � = ( x k − x i ) i � = k

  4. Lagrange Polynomial Error Term Theorem x 0 , . . . , x n distinct in [ a, b ] , f ∈ C n +1 [ a, b ] , then for x ∈ [ a, b ] there exists ξ ( x ) in ( a, b ) with f ( x ) = P ( x ) + f ( n +1) ( ξ ( x )) ( x − x 0 )( x − x 1 ) · · · ( x − x n ) ( n + 1)! where P ( x ) is the interpolating polynomial.

  5. Divided Differences Divided Differences Write the n th Lagrange polynomial in the form P n ( x ) = a 0 + a 1 ( x − x 0 ) + a 2 ( x − x 0 )( x − x 1 ) + · · · = a n ( x − x 0 )( x − x 1 ) · · · ( x − x n − 1 ) Introduce the k th divided difference f [ x i , x i +1 , . . . , x i + k − 1 , x i + k ] = f [ x i +1 , x i +2 , . . . , x i + k ] − f [ x i , x i +1 , . . . , x i + k − 1 ] x i + k − x i The coefficients are then a k = f [ x 0 , x 1 , x 2 , . . . , x k ] and n � P n ( x ) = f [ x 0 ] + f [ x 0 , x 1 , . . . , x k ]( x − x 0 ) · · · ( x − x k − 1 ) k =1

  6. Newton’s Divided-Difference MATLAB Implementation function F = divideddifference(x, f) % Compute interpolating polynomial using Divided Differences. n = length(x) − 1; F = zeros(n+1,n+1); F(:,1) = f(:); for i = 1:n for j = 1:i F(i+1,j+1) = (F(i+1,j) − F(i,j)) / (x(i+1) − x(i − j+1)); end end

  7. Equally Spaced Nodes Equal Spacing Suppose x 0 , . . . , x n increasing with equal spacing h = x i +1 − x i and x = x 0 + sh The Newton Forward-Difference Formula then gives n � s � � ∆ k f ( x 0 ) P n ( x ) = f ( x 0 ) + k k =1 where ∆ f ( x 0 ) = f ( x 1 ) − f ( x 0 ) ∆ 2 f ( x 0 ) = ∆ f ( x 1 ) − ∆ f ( x 0 ) = f ( x 2 ) − 2 f ( x 1 ) + f ( x 0 ) · · ·

  8. Backward Differencing The Newton Backward-Difference Formula Reordering the nodes gives P n ( x ) = f [ x n ] + f [ x n , x n − 1 ]( x − x n ) + · · · = f [ x n , . . . , x 0 ]( x − x n )( x − x n − 1 ) · · · ( x − x 1 ) The Newton Backward-Difference Formula is n � − s � � ( − 1) k ∇ k f ( x n ) P n ( x ) = f [ x n ] + k k =1 where the backward difference ∇ p n is defined by ∇ p n = p n − p n − 1 ∇ k p n = ∇ ( ∇ k − 1 p n )

  9. Osculating Polynomials Definition Let x 0 , . . . , x n be distinct in [ a, b ] , and m i nonnegative integers. Suppose f ∈ C m [ a, b ] , with m = max 0 ≤ i ≤ n m i . The osculating polynomial approximating f is the P ( x ) of least degree such that d k P ( x i ) = d k f ( x i ) for i = 0 , . . . , n and k = 0 , . . . , m i , dx k dx k Special Cases n = 0 : m 0 th Taylor polynomial m i = 0 : n th Lagrange polynomial m i = 1 : Hermite polynomial

  10. Hermite Interpolation Theorem If f ∈ C 1 [ a, b ] and x 0 , . . . , x n ∈ [ a, b ] distinct, the Hermite polynomial is n n � � f ′ ( x j ) ˆ H 2 n +1 ( x ) = f ( x j ) H n,j ( x ) + H n,j ( x ) j =0 j =0 where H n,j ( x ) = [1 − 2( x − x j ) L ′ n,j ( x j )] L 2 n,j ( x ) H n,j ( x ) = ( x − x j ) L 2 ˆ n,j ( x ) . Moreover, if f ∈ C 2 n +2 [ a, b ] , then f ( x ) = H 2 n +1 ( x ) + ( x − x 0 ) 2 · · · ( x − x n ) 2 f (2 n +2) ( ξ ( x )) (2 n + 2)! for some ξ ( x ) ∈ ( a, b ) .

  11. Hermite Polynomials from Divided Differences Divided Differences Suppose x 0 , . . . , x n and f, f ′ are given at these numbers. Define z 0 , . . . , z 2 n +1 by z 2 i = z 2 i +1 = x i Construct divided difference table, but use f ′ ( x 0 ) , f ′ ( x 1 ) , . . . , f ′ ( x n ) instead of the undefined divided differences f [ z 0 , z 1 ] , f [ z 2 , z 3 ] , . . . , f [ z 2 n , z 2 n +1 ] The Hermite polynomial is 2 n +1 � H 2 n +1 ( x ) = f [ z 0 ] + f [ z 0 , . . . , z k ]( x − z 0 ) · · · ( x − z k − 1 ) k =1

  12. Cubic Splines Definition Given a function f on [ a, b ] and nodes a = x 0 < · · · < x n = b , a cubic spline interpolant S for f satisfies: (a) S ( x ) is a cubic polynomial S j ( x ) on [ x j , x j +1 ] (b) S j ( x j ) = f ( x j ) and S j ( x j +1 ) = f ( x j +1 ) (c) S j +1 ( x j +1 ) = S j ( x j +1 ) (d) S ′ j +1 ( x j +1 ) = S ′ j ( x j +1 ) (e) S ′′ j +1 ( x j +1 ) = S ′′ j ( x j +1 ) (f) One of the following boundary conditions: (i) S ′′ ( x 0 ) = S ′′ ( x n ) = 0 ( free or natural boundary) (ii) S ′ ( x 0 ) = f ′ ( x 0 ) and S ′ ( x n ) = f ′ ( x n ) ( clamped boundary)

  13. Natural Splines Computing Natural Cubic Splines Solve for coefficients a j , b j , c j , d j in S j ( x ) = a j + b j ( x − x j ) + c j ( x − x j ) 2 + d j ( x − x j ) 3 by setting a j = f ( x j ) , h j = x j +1 − x j , and solving A x = b :  1 0  h 0 2( h 0 + h 1 ) h 1     ... ... ... A =       h n − 2 2( h n − 2 + h n − 1 ) h n − 1   0 1 b = (0 , 3( a 2 − a 1 ) /h 1 − 3( a 1 − a 0 ) /h 0 , . . . , 3( a n − a n − 1 ) /h n − 1 − 3( a n − 1 − a n − 2 ) /h n − 2 , 0) T x = ( c 0 , . . . , c n ) T Finally, b j = ( a j +1 − a j ) /h j − h j (2 c j + c j +1 ) / 3 , d j = ( c j +1 − c j ) / (3 h j )

  14. Clamped Splines Computing Clamped Cubic Splines Solve for coefficients a j , b j , c j , d j in S j ( x ) = a j + b j ( x − x j ) + c j ( x − x j ) 2 + d j ( x − x j ) 3 using same procedure as for natural cubic splines, but with 2 h 0 h 0   h 0 2( h 0 + h 1 ) h 1     ... ... ... A =       h n − 2 2( h n − 2 + h n − 1 ) h n − 1   h n − 1 2 h n − 1 b = (3( a 1 − a 0 ) /h 0 − 3 f ′ ( a ) , 3( a 2 − a 1 ) /h 1 − 3( a 1 − a 0 ) /h 0 , . . . , 3( a n − a n − 1 ) /h n − 1 − 3( a n − 1 − a n − 2 ) /h n − 2 , 3 f ′ ( b ) − 3( a n − a n − 1 ) /h n − 1 ) T

Recommend


More recommend