3.4 hermite interpolation 3.5 cubic spline interpolationzxu2/acms40390f13/lec-3.4-5.pdfhermite...

15
3.4 Hermite Interpolation 3.5 Cubic Spline Interpolation 1

Upload: others

Post on 07-Jan-2020

38 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

3.4 Hermite Interpolation 3.5 Cubic Spline Interpolation

1

Page 2: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Hermite Polynomial

Definition. Suppose ๐‘“ โˆˆ ๐ถ1[๐‘Ž, ๐‘]. Let ๐‘ฅ0, โ€ฆ , ๐‘ฅ๐‘› be distinct numbers in [๐‘Ž, ๐‘], the Hermite polynomial ๐‘ƒ(๐‘ฅ) approximating ๐‘“ is that:

1. ๐‘ƒ ๐‘ฅ๐‘– = ๐‘“ ๐‘ฅ๐‘– , for ๐‘– = 0, โ€ฆ , ๐‘›

2.๐‘‘๐‘ƒ ๐‘ฅ๐‘–

๐‘‘๐‘ฅ=

๐‘‘๐‘“ ๐‘ฅ๐‘–

๐‘‘๐‘ฅ, for ๐‘– = 0,โ€ฆ , ๐‘›

Remark: ๐‘ƒ(๐‘ฅ) and ๐‘“(๐‘ฅ) agree not only function values but also 1st derivative values at ๐‘ฅ๐‘–, ๐‘– = 0,โ€ฆ , ๐‘›.

2

Page 3: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Osculating Polynomials

Definition. Let ๐‘ฅ0, โ€ฆ , ๐‘ฅ๐‘› be distinct numbers in ๐‘Ž, ๐‘ and for ๐‘– = 0,โ€ฆ , ๐‘›, let ๐‘š๐‘– be a nonnegative integer. Suppose that ๐‘“ โˆˆ ๐ถ๐‘š ๐‘Ž, ๐‘ , where ๐‘š = max

0โ‰ค๐‘–โ‰ค๐‘›๐‘š๐‘–. The

osculating polynomial approximating ๐‘“ is the polynomial

๐‘ƒ(๐‘ฅ) of least degree such that ๐‘‘๐‘˜๐‘ƒ ๐‘ฅ๐‘–

๐‘‘๐‘ฅ๐‘˜=

๐‘‘๐‘˜๐‘“ ๐‘ฅ๐‘–

๐‘‘๐‘ฅ๐‘˜ for each

๐‘– = 0,โ€ฆ , ๐‘› and k= 0,โ€ฆ ,๐‘š๐‘– .

Remark: the degree of ๐‘ƒ(๐‘ฅ) is at most ๐‘€ = ๐‘š๐‘–๐‘›๐‘–=0 + ๐‘›.

3

Page 4: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Theorem. If ๐‘“ โˆˆ ๐ถ1 ๐‘Ž, ๐‘ and ๐‘ฅ0, โ€ฆ , ๐‘ฅ๐‘› โˆˆ ๐‘Ž, ๐‘ distinct numbers, the Hermite polynomial of degree at most 2๐‘› + 1 is:

๐ป2๐‘›+1 ๐‘ฅ = ๐‘“ ๐‘ฅ๐‘— ๐ป๐‘›,๐‘—(๐‘ฅ)

๐‘›

๐‘—=0

+ ๐‘“โ€ฒ ๐‘ฅ๐‘— ๐ป ๐‘›,๐‘—(๐‘ฅ)

๐‘›

๐‘—=0

Where

๐ป๐‘›,๐‘— ๐‘ฅ = [1 โˆ’ 2(๐‘ฅ โˆ’ ๐‘ฅ๐‘—)๐ฟโ€ฒ๐‘›,๐‘—(๐‘ฅ๐‘—)]๐ฟ๐‘›,๐‘—

2 (๐‘ฅ)

๐ป ๐‘›,๐‘— ๐‘ฅ = ๐‘ฅ โˆ’ ๐‘ฅ๐‘— ๐ฟ๐‘›,๐‘—2 ๐‘ฅ

Moreover, if ๐‘“ โˆˆ ๐ถ2๐‘›+2 ๐‘Ž, ๐‘ , then

๐‘“ ๐‘ฅ = ๐ป2๐‘›+1 ๐‘ฅ +๐‘ฅ โˆ’ ๐‘ฅ0

2โ€ฆ ๐‘ฅ โˆ’ ๐‘ฅ๐‘›2

2๐‘› + 2 !๐‘“ 2๐‘›+2 (๐œ‰(๐‘ฅ))

for some ๐œ‰ ๐‘ฅ โˆˆ ๐‘Ž, ๐‘ . Remark: 1. ๐ป2๐‘›+1 ๐‘ฅ is a polynomial of degree at most 2๐‘› + 1.

2. ๐ฟ๐‘›,๐‘—(๐‘ฅ) is jth Lagrange basis polynomial of degree ๐‘›.

3.๐‘ฅโˆ’๐‘ฅ0

2โ€ฆ ๐‘ฅโˆ’๐‘ฅ๐‘›2

2๐‘›+2 !๐‘“ 2๐‘›+2 (๐œ‰(๐‘ฅ)) is the error term.

4

Page 5: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

3rd Degree Hermite Polynomial

โ€ข Given distinct ๐‘ฅ0, ๐‘ฅ1 and values of ๐‘“ and ๐‘“โ€ฒ at these numbers.

๐ป3 ๐‘ฅ = 1 + 2๐‘ฅ โˆ’ ๐‘ฅ0๐‘ฅ1 โˆ’ ๐‘ฅ0

๐‘ฅ1 โˆ’ ๐‘ฅ

๐‘ฅ1 โˆ’ ๐‘ฅ0

2

๐‘“ ๐‘ฅ0

+ ๐‘ฅ โˆ’ ๐‘ฅ0๐‘ฅ1 โˆ’ ๐‘ฅ

๐‘ฅ1 โˆ’ ๐‘ฅ0

2

๐‘“โ€ฒ ๐‘ฅ0

+ 1 + 2๐‘ฅ1 โˆ’ ๐‘ฅ

๐‘ฅ1 โˆ’ ๐‘ฅ0

๐‘ฅ0 โˆ’ ๐‘ฅ

๐‘ฅ0 โˆ’ ๐‘ฅ1

2

๐‘“ ๐‘ฅ1

+ ๐‘ฅ โˆ’ ๐‘ฅ1๐‘ฅ0 โˆ’ ๐‘ฅ

๐‘ฅ0 โˆ’ ๐‘ฅ1

2

๐‘“โ€ฒ ๐‘ฅ1

5

Page 6: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Hermite Polynomial by Divided Differences

Suppose ๐‘ฅ0, โ€ฆ , ๐‘ฅ๐‘› and ๐‘“, ๐‘“โ€ฒ are given at these numbers. Define ๐‘ง0, โ€ฆ , ๐‘ง2๐‘›+1 by

๐‘ง2๐‘– = ๐‘ง2๐‘–+1 = ๐‘ฅ๐‘– , for ๐‘– = 0, โ€ฆ , ๐‘›

Construct divided difference table, but use ๐‘“โ€ฒ ๐‘ฅ0 , ๐‘“โ€ฒ ๐‘ฅ1 , . . , ๐‘“โ€ฒ ๐‘ฅ๐‘›

to set the following undefined divided difference: ๐‘“ ๐‘ง0, ๐‘ง1 , ๐‘“ ๐‘ง2, ๐‘ง3 , โ€ฆ , ๐‘“ ๐‘ง2๐‘›, ๐‘ง2๐‘›+1 .

The Hermite polynomial is

๐ป2๐‘›+1 ๐‘ฅ = ๐‘“ ๐‘ง0 + ๐‘“ ๐‘ง0, โ€ฆ , ๐‘ง๐‘˜ ๐‘ฅ โˆ’ ๐‘ง0 โ€ฆ(๐‘ฅ โˆ’ ๐‘ง๐‘˜โˆ’1)

2๐‘›+1

๐‘˜=1

6

Page 7: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Divided Difference Notation for Hermite Interpolation

โ€ข Divided difference notation: ๐ป3 ๐‘ฅ

= ๐‘“ ๐‘ฅ0 + ๐‘“โ€ฒ ๐‘ฅ0 ๐‘ฅ โˆ’ ๐‘ฅ0+ ๐‘“ ๐‘ฅ0, ๐‘ฅ0, ๐‘ฅ1 ๐‘ฅ โˆ’ ๐‘ฅ0

2

+ ๐‘“[๐‘ฅ0, ๐‘ฅ0, ๐‘ฅ1, ๐‘ฅ1] ๐‘ฅ โˆ’ ๐‘ฅ02(๐‘ฅ โˆ’ ๐‘ฅ1)

7

Page 8: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Problems with High Order Polynomial Interpolation

โ€ข 21 equal-spaced numbers to interpolate

๐‘“ ๐‘ฅ =1

1+25๐‘ฅ2. The interpolating polynomial

oscillates between interpolation points.

8

Page 9: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

3.5 Cubic Splines

โ€ข Idea: Use piecewise polynomial interpolation, i.e, divide the interval into smaller sub-intervals, and construct different low degree polynomial approximations (with small oscillations) on the sub-intervals.

โ€ข Challenge: If ๐‘“โ€ฒ(๐‘ฅ๐‘–) are not known, can we still generate interpolating polynomial with continuous derivatives?

9

Page 10: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Definition: Given a function ๐‘“ on [๐‘Ž, ๐‘] and nodes ๐‘Ž = ๐‘ฅ0 <โ‹ฏ < ๐‘ฅ๐‘› = ๐‘, a cubic spline interpolant ๐‘† for ๐‘“ satisfies:

(a) ๐‘†(๐‘ฅ) is a cubic polynomial ๐‘†๐‘—(๐‘ฅ) on [๐‘ฅ๐‘— , ๐‘ฅ๐‘—+1], โˆ€๐‘— =0,1, โ€ฆ , ๐‘› โˆ’ 1.

(b) ๐‘†๐‘— ๐‘ฅ๐‘— = ๐‘“(๐‘ฅ๐‘—) and ๐‘†๐‘— ๐‘ฅ๐‘—+1 = ๐‘“ ๐‘ฅ๐‘—+1 , โˆ€๐‘— = 0,1, โ€ฆ , ๐‘› โˆ’1.

(c) ๐‘†๐‘— ๐‘ฅ๐‘—+1 = ๐‘†๐‘—+1 ๐‘ฅ๐‘—+1 , โˆ€๐‘— = 0,1, โ€ฆ , ๐‘› โˆ’ 2.

(d) ๐‘†โ€ฒ๐‘— ๐‘ฅ๐‘—+1 = ๐‘†โ€ฒ๐‘—+1 ๐‘ฅ๐‘—+1 , โˆ€๐‘— = 0,1,โ€ฆ , ๐‘› โˆ’ 2.

(e) ๐‘†โ€ฒโ€ฒ๐‘— ๐‘ฅ๐‘—+1 = ๐‘†โ€ฒโ€ฒ๐‘—+1 ๐‘ฅ๐‘—+1 , โˆ€๐‘— = 0,1, โ€ฆ , ๐‘› โˆ’ 2.

(f) One of the following boundary conditions: (i) ๐‘†โ€ฒโ€ฒ ๐‘ฅ0 = ๐‘†โ€ฒโ€ฒ ๐‘ฅ๐‘› = 0 (called free or natural boundary)

(ii) ๐‘†โ€ฒ ๐‘ฅ0 = ๐‘“โ€ฒ(๐‘ฅ0) and ๐‘†โ€ฒ ๐‘ฅ๐‘› = ๐‘“โ€ฒ(๐‘ฅ๐‘›) (called clamped boundary)

10

Page 11: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Things to match at interior point ๐‘ฅ๐‘—+1:

โ€ข The spline segment ๐‘†๐‘—(๐‘ฅ) is on ๐‘ฅ๐‘— , ๐‘ฅ๐‘—+1 .

โ€ข The spline segment ๐‘†๐‘—+1(๐‘ฅ) is on ๐‘ฅ๐‘—+1, ๐‘ฅ๐‘—+2 .

โ€ข Their function values: ๐‘†๐‘— ๐‘ฅ๐‘—+1 = ๐‘†๐‘—+1 ๐‘ฅ๐‘—+1 =๐‘“ ๐‘ฅ๐‘—+1

โ€ข First derivative values: ๐‘†โ€ฒ๐‘— ๐‘ฅ๐‘—+1 = ๐‘†โ€ฒ๐‘—+1 ๐‘ฅ๐‘—+1

โ€ข Second derivative values: ๐‘†โ€ฒโ€ฒ๐‘— ๐‘ฅ๐‘—+1 = ๐‘†โ€ฒโ€ฒ๐‘—+1 ๐‘ฅ๐‘—+1

11

Page 12: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Building Cubic Splines โ€ข Define:

๐‘†๐‘— ๐‘ฅ = ๐‘Ž๐‘— + ๐‘๐‘— ๐‘ฅ โˆ’ ๐‘ฅ๐‘— + ๐‘๐‘—(๐‘ฅ โˆ’ ๐‘ฅ๐‘—)2+๐‘‘๐‘—(๐‘ฅ โˆ’ ๐‘ฅ๐‘—)

3

and โ„Ž๐‘— = ๐‘ฅ๐‘—+1 โˆ’ ๐‘ฅ๐‘—, โˆ€๐‘— = 0,1, โ€ฆ , ๐‘› โˆ’ 1.

Solve for coefficients ๐‘Ž๐‘— , ๐‘๐‘— , ๐‘๐‘— , ๐‘‘๐‘— by:

1. ๐‘†๐‘— ๐‘ฅ๐‘— = ๐‘Ž๐‘— = ๐‘“(๐‘ฅ๐‘—)

2. ๐‘†๐‘—+1 ๐‘ฅ๐‘—+1 = ๐‘Ž๐‘—+1 = ๐‘Ž๐‘— + ๐‘๐‘—โ„Ž๐‘— + ๐‘๐‘—(โ„Ž๐‘—)2+๐‘‘๐‘—(โ„Ž๐‘—)

3

3. ๐‘†โ€ฒ๐‘— ๐‘ฅ๐‘— = ๐‘๐‘—, also ๐‘๐‘—+1 = ๐‘๐‘— + 2๐‘๐‘—โ„Ž๐‘— + 3๐‘‘๐‘—(โ„Ž๐‘—)2

4. ๐‘†โ€ฒโ€ฒ๐‘— ๐‘ฅ๐‘— = 2๐‘๐‘—, also ๐‘๐‘—+1 = ๐‘๐‘— + 3๐‘‘๐‘—โ„Ž๐‘—

5. Natural or clamped boundary conditions

12

Page 13: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Solving the Resulting Equations

โˆ€๐‘— = 1,2,โ€ฆ , ๐‘› โˆ’ 1

โ„Ž๐‘—โˆ’1๐‘๐‘—โˆ’1 + 2 โ„Ž๐‘—โˆ’1 + โ„Ž๐‘— ๐‘๐‘— + โ„Ž๐‘—๐‘๐‘—+1

=3

โ„Ž๐‘—๐‘Ž๐‘—+1 โˆ’ ๐‘Ž๐‘— โˆ’

3

โ„Ž๐‘—โˆ’1๐‘Ž๐‘— โˆ’ ๐‘Ž๐‘—โˆ’1

Remark: (n-1) equations for (n+1) unknowns {๐‘๐‘—}๐‘—=0๐‘› .

Also, ๐‘Ž๐‘› โ‰ก ๐‘“(๐‘ฅ๐‘›)

Once compute ๐‘๐‘—, we then compute:

๐‘๐‘— = ๐‘Ž๐‘—+1โˆ’๐‘Ž๐‘—

โ„Ž๐‘—โˆ’

โ„Ž๐‘— 2๐‘๐‘—+๐‘๐‘—+1

3 and

๐‘‘๐‘— =๐‘๐‘—+1โˆ’๐‘๐‘—

3โ„Ž๐‘— for ๐‘— = 0,1,2, โ€ฆ , ๐‘› โˆ’ 1

13

Page 14: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Completing the System

โ€ข Natural boundary condition:

1. 0 = ๐‘†โ€ฒโ€ฒ0 ๐‘ฅ0 = 2๐‘0 โ†’ ๐‘0 = 0

2. 0 = ๐‘†โ€ฒโ€ฒ๐‘› ๐‘ฅ๐‘› = 2๐‘๐‘› โ†’ ๐‘๐‘› = 0

โ€ข Clamped boundary condition:

a) ๐‘†โ€ฒ0 ๐‘ฅ0 = ๐‘0 = ๐‘“โ€ฒ(๐‘ฅ0)

b) ๐‘†โ€ฒ๐‘›โˆ’1 ๐‘ฅ๐‘› = ๐‘๐‘› = ๐‘๐‘›โˆ’1 + โ„Ž๐‘›โˆ’1(๐‘๐‘›โˆ’1 + ๐‘๐‘›) = ๐‘“โ€ฒ(๐‘ฅ๐‘›)

Remark: a) and b) gives additional equations:

2โ„Ž0๐‘0 + โ„Ž0๐‘1 =3

โ„Ž0(๐‘Ž1 โˆ’ ๐‘Ž0) โˆ’ 3๐‘“โ€ฒ(๐‘ฅ0)

โ„Ž๐‘›โˆ’1๐‘๐‘›โˆ’1 + 2โ„Ž๐‘›โˆ’1๐‘๐‘› = โˆ’3

โ„Ž0๐‘Ž๐‘› โˆ’ ๐‘Ž๐‘›โˆ’1 + 3๐‘“โ€ฒ(๐‘ฅ๐‘›)

14

Page 15: 3.4 Hermite Interpolation 3.5 Cubic Spline Interpolationzxu2/acms40390F13/Lec-3.4-5.pdfHermite Polynomial by Divided Differences Suppose ๐‘ฅ0,โ€ฆ,๐‘ฅ and ๐‘“, ๐‘“โ€ฒ are given

Error Bound

If ๐‘“ โˆˆ ๐ถ4[๐‘Ž, ๐‘], let ๐‘€ = max๐‘Žโ‰ค๐‘ฅโ‰ค๐‘

|๐‘“4(๐‘ฅ)|. If ๐‘† is the

unique clamped cubic spline interpolant to ๐‘“ with respect to the nodes: ๐‘Ž = ๐‘ฅ0 < โ‹ฏ < ๐‘ฅ๐‘› = ๐‘, then with

โ„Ž = max0โ‰ค๐‘—โ‰ค๐‘›โˆ’1

๐‘ฅ๐‘—+1 โˆ’ ๐‘ฅ๐‘—

max๐‘Žโ‰ค๐‘ฅโ‰ค๐‘

|๐‘“ ๐‘ฅ โˆ’ ๐‘†(๐‘ฅ)| โ‰ค5๐‘€โ„Ž4

384.

15