interpolation(1) - wordpress.com · lagrange interpolation polynomials • basic concept • the...

29
INTERPOLATION(1) ELM1222 Numerical Analysis 1 Some of the contents are adopted from Laurene V. Fausett, Applied Numerical Analysis using MATLAB. Prentice Hall Inc., 1999 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Upload: phamxuyen

Post on 09-Apr-2018

260 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

INTERPOLATION(1)

ELM1222 Numerical Analysis

1

Some of the contents are adopted from

Laurene V. Fausett, Applied Numerical Analysis using MATLAB. Prentice Hall Inc., 1999

ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 2: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Today’s lecture

• Polynomial Interpolation

• Lagrange Interpolation

• Newton Interpolation

• Difficulties with Polynomial Interpolation

• Hermite Interpolation

• Rational-Function Interpolation

2 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 3: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Lagrange Interpolation Polynomials

• Basic concept

• The Lagrange interpolating polynomial is the polynomial of degree n-1

that passes through the n points.

• Using given several point, we can find Lagrange interpolation polynomial.

3 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 4: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

General Form of Lagrange

• The general form of the polynomial is

p(x) = L1y1 + L2y2 + … + Lnyn

where the given points are (x1,y1), ….. , (xn,yn).

• The equation of the line passing through two points (x1,y1) and (x2,y2) is

• The equation of the parabola passing through three points (x1,y1), (x2,y2), and

(x3,y3) is

2

12

11

21

2

)(

)(

)(

)()( y

xx

xxy

xx

xxxp

3

2313

212

3212

311

3121

32

))((

))((

))((

))((

))((

))(()( y

xxxx

xxxxy

xxxx

xxxxy

xxxx

xxxxxp

))...()()...((

))...()()...(()(

111

111

nkkkkkk

nkkk

xxxxxxxx

xxxxxxxxxL

4 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 5: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Lagrange Interpolation

Example 1 :

(x1,y1)=(-2,4), (x2,y2)=(0,2), (x3,y3)=(2,8)

288

)2(2

4

)2)(2(4

8

)2(

8)02))(2(2(

)0))(2((2

)20))(2(0(

)2))(2((4

)22)(02(

)2)(0()(

2

xxxxxxxx

xxxxxxxp

5 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 6: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Lagrange Interpolation

• We can represent the Lagrange polynomial with coefficient ck.

𝑝(𝑥) = 𝑐1𝑁1 + 𝑐2𝑁2 + … + 𝑐𝑛𝑁𝑛

))...()()...(( 111 nkkkkkk

kk

xxxxxxxx

yc

))...()()...(()( 111 nkkk xxxxxxxxxN

6 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 7: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Higher Order Interpolation Polynomials

Example 2: Higher order interpolation polynomials

x = [ -2 -1 0 1 2 3 4],

y = [ -15 0 3 0 -3 0 15]

7 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 8: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Review and Discussion

• In Lagrange interpolation polynomial, it always go through given points.

• It is less convenient than the Newton form when additional data points may

be added to the problem.

3

2313

212

3212

311

3121

32

))((

))((

))((

))((

))((

))(()( y

xxxx

xxxxy

xxxx

xxxxy

xxxx

xxxxxp

8 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 9: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

1-9

Newton form of the equation of a straight line passing through two points

(x1, y1) and (x2, y2) is

Newton form of the equation of a parabola passing through three points

(x1, y1), (x2, y2), and (x3, y3) is

The general form of the polynomial passing through n points

(x1, y1), …,(xn, yn) is

Newton Interpolation Polynomials

)()( 121 xxaaxp

))(()()( 213121 xxxxaxxaaxp

))...((...))(()()( 11213121 nn xxxxaxxxxaxxaaxp

9 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 10: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Substituting (x1, y1) into

Substituting (x2, y2) into

Substituting (x3, y3) into

))(()( 213121 xxxxaxxaay

))(()( 213121 xxxxaxxaay

))(()()( 213121 xxxxaxxaaxp

))(()( 213121 xxxxaxxaay

11 ya

12

122

xx

yya

13

12

12

23

23

3xx

xx

yy

xx

yy

a

Consider a parabola equation obtained using three points

10 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Newton Interpolation Polynomials

Page 11: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Example 3: Passing through the points

(x1, y1)=(-2, 4), (x2, y2)=(0, 2), and (x3, y3)=(2, 8).

The equations is

Where the coefficients are

)0))(2(())2(()( 321 xxaxaaxp

411 ya

1)2(0

42

12

122

xx

yya

1)2(2

)2(0

42

02

28

13

12

12

23

23

3

xx

xx

yy

xx

yy

a

2)2()2(4)( 2 xxxxxxp

11 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Newton Interpolation Polynomials

Page 12: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Passing through the points (x1, y1)=(-2, 4), (x2, y2)=(0, 2), and (x3, y3)=(2, 8).

2)2()2(4)( 2 xxxxxxp

))(()()( 213121 xxxxaxxaaxp

12 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Newton Interpolation Polynomials

Page 13: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Additional Data Points

Example 4: adding the points (x4, y4) = (-1, -1) and (x5, y5) = (1, 1) to the

previous data

)1)(2)(2()2)(2()2()2(4)( xxxxxxxxxxxp

13 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 14: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Example 5: Consider again the data

with Lagrange form.

x = [ -2 -1 0 1 2 3 4 ],

y = [ -15 0 3 0 -3 0 15]

Higher Order Interpolation Polynomials

)1)(2()1)(2(6)2(1515)( xxxxxxxp

Do it again with Newton form.

the polynomial is cubic

14 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 15: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Higher Order Interpolation Polynomials

• Example 6: If the y values are modified slightly, the divided-difference table

shows the small contribution from the higher degree terms:

)3)(1)(1)(2(0007.0

)2)(1)(1)(2(0042.0)1)(1)(2(0167.0

)1)(2(0333.1)1)(2(95.5)2(5.1414)(

xxxxx

xxxxxxxxx

xxxxxxxN

15 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 16: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Example 7: The data

x = [ -2 -1.5 -1 -0.5 0 – 0.5 1 1.5 2]

y = [ 0 0 0 0.87 1 0.87 0 0 0]

illustrate the difficulty with using higher order polynomials to interpolate a

moderately large number of points.

Difficulties: Humped and Flat Data

16 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 17: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Example 8: The data

x = [ 0.00 0.20 0.80 1.00 1.20 1.90 2.00 2.10 2.95 3.00]

y = [ 0.01 0.22 0.76 1.03 1.18 1.94 2.01 2.08 2.90 2.95]

Not good with noisy straight line.

Difficulties: Noisy Straight Line

Newton polynomial coefficients

17 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 18: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Difficulties: Runge Function

Example 9:

The function

is an example of the fact that polynomial interpolation does not produce a good

approximation for some functions

using more function values (at evenly spaced x values) does not necessarily

improve the situation.

x = [ -1 -0.5 0.0 0.5 1.0 ]

y = [0.0385 0.1379 1.0000 0.1379 0.0385]

2251

1)(

xxf

18 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 19: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

1-19

Example 10:

x = [-1.000 -0.750 -0.500 -0.250 0.000 0.250 0.500 0.750 1.000 ]

y = [0.0385 0.0664 0.138 0.3902 1.000 0.3902 0.138 0.0664 0.0385]

The interpolation polynomial overshoots the true polynomial much more

severely than the polynomial formed by using only five points.

Difficulties: Runge Function

19 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 20: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Hermite Interpolation

Rational-Function Interpolation

20

Some of the contents are adopted from

Laurene V. Fausett, Applied Numerical Analysis using MATLAB. Prentice Hall Inc., 1999

ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 21: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Hermite Interpolation

• Hermite interpolation allows us to find a ploynomial that matched both

function value and some of the derivative values

21 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 22: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Hermite Interpolation Example 11:

22 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 23: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Difficult Data

• As with lower order polynomial interpolation, trying to interpolate in humped

and flat regions brings overshootings.

Example 12:

23 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 24: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Rational-Function Interpolation • Why use rational-function interpolation?

• Some functions are not well approximated by polynomials.(runge-function)

• but are well approximated by rational functions, that is quotients of polynomials.

24 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 25: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Bulirsch-Stoer algorithm

• Bulirsch-Stoer algorithm

• The approach is recursive,

• Given a set of m+1 data points (x1,y1), … , (xm+1, ym+1), we seek an interpolation function of the form

25 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

11)1)...(1())...(1(

)1...())...(1(

)1...())...(1(

))...(1())...(1(

miimii

miimii

mi

i

miimii

miimiii

ii

RR

RR

xx

xx

RR

RR

yRBulirsch-Stoer pattern

Page 26: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Bulirsch-Stoer algorithm

• Bulirsch-Stoer method for three data points

26 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 27: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

• Bulirsch-Stoer method for five data points Third stage

114

34

4

3

34434

R

RR

xx

xx

RRRR

115

45

5

4

45545

R

RR

xx

xx

RRRR

11334

2334

4

2

233434234

RR

RR

xx

xx

RRRR

11445

3445

5

3

344545345

RR

RR

xx

xx

RRRR

R5=y5 x5 y5

R4=y4 x4 y4

R3=y3 x3 y3

R2= y2 x2 y2

R1= y1 x1 y1

Second stage First stage data

112

12

2

1

12212

R

RR

xx

xx

RRRR

113

23

3

2

23323

R

RR

xx

xx

RRRR

11223

1223

3

1

122323123

RR

RR

xx

xx

RRRR

Bulirsch-Stoer algorithm

27 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 28: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Fifth stage Forth stage

1123234

123234

4

1

1232342341234

RR

RR

xx

xx

RRRR

1134345

234345

5

2

2343453452345

RR

RR

xx

xx

RRRR

112342345

12342345

5

1

12342345234512345

RR

RR

xx

xx

RRRR

Bulirsch-Stoer algorithm

28 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Page 29: INTERPOLATION(1) - WordPress.com · Lagrange Interpolation Polynomials • Basic concept • The Lagrange interpolating polynomial is the polynomial of degree n-1 that passes through

Rational-function interpolation

data points:

x = [-1 -0.5 0.0 0.5 1.0]

y = [0.0385 0.1379 1.0000 0.1379 0.0385]

29 ELM1222 Numerical Analysis | Dr Muharrem Mercimek

Example 13: