polynomial interpolation - uhjiwenhe/math6371/lectures/lecture1.pdfnewton interpolation: additional...

14
Polynomial Interpolation Jiwen He Department of Mathematics, University of Houston [email protected] math.uh.edu/jiwenhe/math6371 Jiwen He, University of Houston Math 6371 – Section 13338 January 15 & 17, 2013 1/ 14

Upload: others

Post on 15-Oct-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Polynomial Interpolation

Jiwen He

Department of Mathematics, University of Houston

[email protected]/∼jiwenhe/math6371

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 1 /

14

Page 2: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Monomial interpolation: Data (1, 1), (2, 3), (4, 3)

Monomial interpolation:

p2(x) = c0 + c1x + c2x2

The interpolating conditions in matrix form read1 1 11 2 41 4 16

c0

c1

c2

=

133

The MATLAB commands:

A = [1 1 1; 1 2 4; 1 4 16]; y = [1; 3; 3]; c = A\y ;

yieldsc0 = −7/3, c1 = 4, c2 = −2/3.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 2 /

14

Page 3: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Lagrange interpolation: Data (1, 1), (2, 3), (4, 3)

Lagrange interpolation:

p2(x) = y0L0(x) + y1L1(x) + y2L2(x)

where y0 = 1, y1 = 3, y2 = 3 and

L0(x) =1

3(x−2)(x−4), L1(x) = −1

2(x−1)(x−4), L2(x) =

1

6(x−1)(x−2)

Despite the different form, this is precisely the same quadraticinterpolant as the one we found before

p2(x) = (−2x2 + 12x − 7)/3.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 3 /

14

Page 4: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Newton interpolation: Data (1, 1), (2, 3), (4, 3)

Newton interpolation:

p2(x) = f [x0] + f [x0, x1](x − x0) + f [x0, x1, x2](x − x0)(x − x1)

where x0 = 1, x1 = 2, x2 = 4, f [x0] = 1, f [x1] = 3, f [x2] = 3, and

f [x0, x1] =3− 1

2− 1= 2, f [x1, x2] =

3− 3

4− 2= 0, f [x0, x1, x2] =

0− 2

4− 1= −2

3,

yielding

p2(x) = 1 + 2(x − 1)− 2

3(x − 1)(x − 2)

= 1 + (x − 1)

(2− 2

3(x − 2)

)

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 4 /

14

Page 5: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Newton interpolation: Additional Data Point (5, 4)

Note that we need only add another row to the divided differencetable:

For p3 we have the expression

p3(x) = p2(x) + f [x0, x1, x2, x3](x − x0)(x − x1)(x − x2)

= 1 + (x − 1)

(2− 2

3(x − 2)

)+

1

4(x − 1)(x − 2)(x − 4)

= 1 + (x − 1)

(2 + (x − 2)

(−2

3+

1

4(x − 4)

)).

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 5 /

14

Page 6: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Newton interpolation: Additional Data Point

Obtaining a higher degree approximation is simply a matter ofadding a term.

p3(x) = p2(x) + f [x0, x1, x2, x3](x − x0)(x − x1)(x − x2)

Note that p2 predicts a rather different value for x = 5 thanthe additional datum f (x3) later imposes, which explains thesignificant difference between the two interpolating curves.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 6 /

14

Page 7: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Interpolating also Derivative Values

Give the five data values

Set up the divided differencetable

The resulting quartic interpolantis

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 7 /

14

Page 8: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Algorithm: Lagrange Interpolation

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 8 /

14

Page 9: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Algorithm: Newton Interpolation

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 9 /

14

Page 10: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Algorithms Comparison

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 10 /

14

Page 11: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Runge’s Phenomenon: Error of Interpolation

f (x) = xn+1 on [−1, 1], n = 11

Using n + 1 = 12 Chebyshevpoints (solid line) andequidistant points (dashedline)

The interpolation error forf (x) = xn+1 becomesf (x)− pn(x) = ψn(x),

because f (n+1)

(n+1)! = 1

Equidistant interpolationcan give rise to convergencedifficulties when the numberof interpolation pointsbecomes large.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 11 /

14

Page 12: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Runge Function: f (x) = 11+25x2 with Equidistant Points

Calculating f (n+1)

(n+1)! shows the growth in the error term near theinterval ends

The results do not improve as the degree of the polynomial isincreased.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 12 /

14

Page 13: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

Runge Function: f (x) = 11+25x2 with Chebyshev Points

The improvement over the interpolation at equidistant pointsis remarkable!

The Chebyshev points concentrate more near the interval

ends, which is precisely where f (n+1)

(n+1)! gets large.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 13 /

14

Page 14: Polynomial Interpolation - UHjiwenhe/math6371/lectures/lecture1.pdfNewton interpolation: Additional Data Point Obtaining a higher degree approximation is simply a matter of adding

f (x) = e3x sin(200x2)/(1 + 20x2) with Chebyshev Points

As n is increased further the error eventually goes down, andrather fast: the error then looks like O(q−n) for some q > 1.This is called spectral accuracy.

Jiwen He, University of Houston Math 6371 – Section 13338January 15 & 17, 2013 14 /

14