Download presentation
Presentation is loading. Please wait.
Published byDaniel Oliver Modified over 8 years ago
2
3.3 Hermite Interpolation Chapter 3 Interpolation and Polynomial Approximation -- Hermite Interpolation Find the osculating polynomial P(x) such that P(x i ) = f (x i ), P’ (x i ) = f ’ (x i ), …, P (m_i) (x i ) = f (m_i) (x i ) for all i = 0, 1, …, n. 1/12 Note: Given N conditions (and hence N equations), a polynomial of degree can be determined. Given N conditions (and hence N equations), a polynomial of degree can be determined. N 1N 1N 1N 1 The osculating polynomial that agrees with f and all its derivatives of order m 0 at one point x 0 is just the Taylor polynomial The osculating polynomial that agrees with f and all its derivatives of order m 0 at one point x 0 is just the Taylor polynomial with remainder The case when m i = 1 for each i = 0, 1, …, n gives the Hermite polynomials. The case when m i = 1 for each i = 0, 1, …, n gives the Hermite polynomials.
3
Chapter 3 Interpolation and Polynomial Approximation -- Hermite Interpolation Example: Suppose x 0 x 1 x 2. Given f(x 0 ), f(x 1 ), f(x 2 ) and f ’(x 1 ), find the polynomial P(x) such that P(x i ) = f (x i ) , i = 0, 1, 2, and P’(x 1 ) = f ’(x 1 ). Analyze the errors. Solution: First of all, the degree of P(x) must be … 3. Similar to Lagrange polynomials, we may assume the form of Hermite polynomial as 2 13 )()()()()( 0 i ii xhx1x1 f ’xhxfxP where h i (x j ) = ij, h i ’(x 1 ) = 0, (x i ) = 0, ’(x 1 ) = 1 h1h1 h1h1 h0(x)h0(x) Has roots x 1, x 2, and h 0 ’(x 1 ) = 0 x 1 is a multiple root. )()()( 2 2 100 xxxxCxh h 0 (x 0 ) = 1 C 0 h2(x)h2(x) Similar to h 0 (x). h1(x)h1(x) Has roots x 0, x 2 ))( ()( 201 xxxxBAxAxxh A and B can be solved with h 1 (x 1 ) = 1 and h 1 ’(x 1 ) = 0. (x) h1h1 Has roots x 0, x 1, x 2 h1h1 ))( ()( 2101 xxxxxxCx h1h1 ’(x 1 ) = 1 C 1 can be solved. Similar to Lagrange error analysis 2/12
4
Chapter 3 Interpolation and Polynomial Approximation -- Hermite Interpolation In general, given x 0, …, x n ; y 0, …, y n and y 0 ’, …, y n ’. The Hermite polynomial H 2n+1 (x) satisfies H 2n+1 (x i ) = y i and H’ 2n+1 (x i ) = y i ’ for all i. n i )()( )( 0 i i xhxh yiyi x H 2n+1 n 0 i yi’yi’ where h i (x j ) = ij, h i ’(x j ) = 0, (x j ) = 0, ’(x j ) = ij hihi hihi hi(x)hi(x) x 0, …, x i, …, x n are all roots with multiplicity 2 )()()(x L2L2 BxAxh n, iiii A i and B i can be solved by h i (x i ) = 1 and h i ’(x i ) = 0 (x) hihi All the roots x 0, …, x n have multiplicity 2 except x i hihi )()( ii L n, i 2 (x) xxCx hihi ’(x i ) = 1 C i = 1 hihi )(x)( i L n, i 2 (x) xx If, then Solution: Let Such a Hermite interpolating polynomial is unique 3/12
5
Chapter 3 Interpolation and Polynomial Approximation -- Hermite Interpolation Quiz: Given x i = i +1, i = 0, 1, 2, 3, 4, 5. Which one is h 2 (x)? x 0 - -1 0.5 123456 y x y 0 - - -1 123456 slope=1 HW: p.140 #7 4/12
6
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation 3.4 Cubic Spline Interpolation Remember what I have said? Increasing the degree of interpolating polynomial will NOT guarantee a good result, since high-degree polynomials are oscillating. Example: Consider the Lagrange polynomial P n (x) of on [ 5, 5]. Take P n (x) f (x) Piecewise polynomial approximation 5/12
7
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation Piecewise linear interpolation Approximate f (x) by linear polynomials on each subinterval : Let. Then as uniform No longer smooth. Hermite piecewise polynomials Given Construct the Hermite polynomial of degree 3 with y and y’ on the two endpoints of. It is not easy to obtain the derivatives. How can we make a smooth interpolation without asking too much from f ? Headache … 6/12
8
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation Cubic Spline Definition: Given a function f defined on [a, b] and a set of nodes a = x 0 < x 1 < … < x n = b, a cubic spline interpolant S for f is a function that satisfies the following conditions: a.S(x) is a cubic polynomial, denoted S i (x), on the subinterval [ x i, x i+1 ] for each i = 0, 1, …, n – 1; b.S(x i ) = f (x i ) for each i = 0, 1, …, n; c.S i+1 (x i+1 ) = S i (x i+1 ) for each i = 0, 1, …, n – 2; d.S’ i+1 (x i+1 ) = S’ i (x i+1 ) for each i = 0, 1, …, n – 2; e.S” i+1 (x i+1 ) = S” i (x i+1 ) for each i = 0, 1, …, n – 2; f(x)f(x) H(x)H(x) S(x)S(x) 7/12
9
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation Method of Bending Moment Then S j ”(x) is a polynomial of degree, which can be determined by the values of f on nodes. 1 2 Assume S j ”(x j 1 ) = M j 1 , S j ”(x j ) = M j. Then for all x [ x j – 1, x j ], S j ”(x) = j j j j j j h xx M h xx M 1 1 Integrate S j ”(x) twice, we obtain S j ’(x) and S j (x) : j j j j j j j A h xx M h xx M 2 )( 2 )( 2 1 1 2 1 S j ’(x) = jj j j j j j j BxA h xx M h xx M 6 )( 6 )( 3 1 3 1 S j (x) = Can be solved by S j (x j 1 ) = y j 1 S j (x j ) = y j Let h j = x j – x j – 1 and S(x) = S j (x) for x [ x j – 1, x j ]. For each j it is a cubic polynomial The bending moment 8/12
10
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolationj jj j jj j h MM h yy A 6 11 j j j j j j j j j jjj h xx h M y h xx h M yBxA 1 22 1 1 ) 6 () 6 ( Now solve for M j : Since S’ is continuous at x j [x j 1, x j ]: S j ’(x) = j jj jj j j j j j j h MM xxf h xx M h xx M 6 ],[ 2 )( 2 )( 1 1 2 1 2 1 1 1 1 1 2 1 1 2 1 6 ],[ 2 )( 2 )( j jj jj j j j j j j h MM xxf h xx M h xx M [x j, x j+1 ]: S j+1 ’(x) = From S j ’(x j ) = S j+1 ’(x j ), we can combine the coefficients for M j 1, M j, and M j+1. Define,, and 1 1 jj j j hh h 1 jj ]),[],[( 6 11 1 jjjj jj j xxfxxf hh g for j 1 n1n1 That is, we have unknowns but only equations. n1n1 n+1n+1 Extra 2 boundary conditions are needed. 2 11 gMMM jjjjjj 9/12
11
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation S’(a) = y 0 ’ , S’(b) = y n ’ /* Clamped boundary */ [ a, x 1 ]: S 1 ’(x) = 1 01 10 1 2 1 1 2 1 0 6 ],[ 2 )( 2 )( h MM xxf h ax M h xx M 010 1 10 )],[( 6 2g y0’y0’ xxf h MM nnn n nn gxxf yn’yn’ h MM ]),[ ( 6 2 1 1 Similar for S n ’(x) on [ x n 1, b ] S”(a) = y 0 ” = M 0 , S”(b) = y n ” = M n Then The case when M 0 = M n = 0 is called a free boundary, and when that occurs, the spline is called a Natural Spline. Periodic boundary: If f is a periodic function, that is, y n = y 0 and S’(a + ) = S’(b ) M 0 = M n 10/12
12
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline InterpolationNote: Cubic Spline can be uniquely determined by its boundary conditions as long as the coefficient matrix is strictly diagonally dominant. Cubic Spline can be uniquely determined by its boundary conditions as long as the coefficient matrix is strictly diagonally dominant. If f C[ a, b ] and. Then If f C[ a, b ] and. Then as max h i 0. as max h i 0. That is, the accuracy of approximation can be improved by adding more nodes without increasing the degree of the splines. Sketch of the Algorithm: Cubic Spline ① Compute j, j, g j ; ② Solve for M j ; ③ Find the subinterval which contains x (i.e. find the corresponding j ); ④ Approximate f(x) by S j (x). HW: p.153-154 #9, 17 11/12
13
Chapter 3 Interpolation and Polynomial Approximation -- Cubic Spline Interpolation Lab 06. Cubic Spline Time Limit: 1 second; Points: 4 Construct the cubic spline interpolant S for the function f, defined at points x 0 < x 1 < … < x n, satisfying some given boundary conditions. Partition an given interval into m equal- length subintervals, and approximate the function values at the endpoints of these subintervals. 12/12
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.