Interpolation & Polynomial Approximation Lagrange Interpolating - - PowerPoint PPT Presentation

interpolation polynomial approximation lagrange
SMART_READER_LITE
LIVE PREVIEW

Interpolation & Polynomial Approximation Lagrange Interpolating - - PowerPoint PPT Presentation

Interpolation & Polynomial Approximation Lagrange Interpolating Polynomials I Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University 2011 Brooks/Cole,


slide-1
SLIDE 1

Interpolation & Polynomial Approximation Lagrange Interpolating Polynomials I

Numerical Analysis (9th Edition) R L Burden & J D Faires

Beamer Presentation Slides prepared by John Carroll Dublin City University

c 2011 Brooks/Cole, Cengage Learning

slide-2
SLIDE 2

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 2 / 33

slide-3
SLIDE 3

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 2 / 33

slide-4
SLIDE 4

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 2 / 33

slide-5
SLIDE 5

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

4

Example: Second-Degree Lagrange Interpolating Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 2 / 33

slide-6
SLIDE 6

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

4

Example: Second-Degree Lagrange Interpolating Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 3 / 33

slide-7
SLIDE 7

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Algebraic Polynomials

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 4 / 33

slide-8
SLIDE 8

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Algebraic Polynomials

One of the most useful and well-known classes of functions mapping the set of real numbers into itself is the algebraic polynomials, the set

  • f functions of the form

Pn(x) = anxn + an−1xn−1 + · · · + a1x + a0 where n is a nonnegative integer and a0, . . . , an are real constants.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 4 / 33

slide-9
SLIDE 9

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Pn(x) = anxn + an−1xn−1 + · · · + a1x + a0,

Algebraic Polynomials (Cont’d)

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 5 / 33

slide-10
SLIDE 10

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Pn(x) = anxn + an−1xn−1 + · · · + a1x + a0,

Algebraic Polynomials (Cont’d)

One reason for their importance is that they uniformly approximate continuous functions.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 5 / 33

slide-11
SLIDE 11

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Pn(x) = anxn + an−1xn−1 + · · · + a1x + a0,

Algebraic Polynomials (Cont’d)

One reason for their importance is that they uniformly approximate continuous functions. By this we mean that given any function, defined and continuous

  • n a closed and bounded interval, there exists a polynomial that is

as “close” to the given function as desired.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 5 / 33

slide-12
SLIDE 12

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Weierstrass Approximation Theorem

Pn(x) = anxn + an−1xn−1 + · · · + a1x + a0,

Algebraic Polynomials (Cont’d)

One reason for their importance is that they uniformly approximate continuous functions. By this we mean that given any function, defined and continuous

  • n a closed and bounded interval, there exists a polynomial that is

as “close” to the given function as desired. This result is expressed precisely in the Weierstrass Approximation Theorem.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 5 / 33

slide-13
SLIDE 13

Weierstrass Taylor Polynomials Lagrange Polynomial Example

y x a b y 5 f(x) y 5 f(x) 1 e y 5 f(x) 2 e y 5 P(x)

Weierstrass Approximation Theorem

Suppose that f is defined and continuous on [a, b]. For each ǫ > 0, there exists a polynomial P(x), with the property that |f(x) − P(x)| < ǫ, for all x in [a, b].

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 6 / 33

slide-14
SLIDE 14

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Benefits of Algebraic Polynomials

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 7 / 33

slide-15
SLIDE 15

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Benefits of Algebraic Polynomials

Another important reason for considering the class of polynomials in the approximation of functions is that the derivative and indefinite integral of a polynomial are easy to determine and are also polynomials.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 7 / 33

slide-16
SLIDE 16

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Benefits of Algebraic Polynomials

Another important reason for considering the class of polynomials in the approximation of functions is that the derivative and indefinite integral of a polynomial are easy to determine and are also polynomials. For these reasons, polynomials are often used for approximating continuous functions.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 7 / 33

slide-17
SLIDE 17

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

4

Example: Second-Degree Lagrange Interpolating Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 8 / 33

slide-18
SLIDE 18

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-19
SLIDE 19

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

The Taylor polynomials are described as one of the fundamental building blocks of numerical analysis.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-20
SLIDE 20

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

The Taylor polynomials are described as one of the fundamental building blocks of numerical analysis. Given this prominence, you might expect that polynomial interpolation would make heavy use of these functions.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-21
SLIDE 21

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

The Taylor polynomials are described as one of the fundamental building blocks of numerical analysis. Given this prominence, you might expect that polynomial interpolation would make heavy use of these functions. However this is not the case.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-22
SLIDE 22

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

The Taylor polynomials are described as one of the fundamental building blocks of numerical analysis. Given this prominence, you might expect that polynomial interpolation would make heavy use of these functions. However this is not the case. The Taylor polynomials agree as closely as possible with a given function at a specific point, but they concentrate their accuracy near that point.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-23
SLIDE 23

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Interpolating with Taylor Polynomials

The Taylor polynomials are described as one of the fundamental building blocks of numerical analysis. Given this prominence, you might expect that polynomial interpolation would make heavy use of these functions. However this is not the case. The Taylor polynomials agree as closely as possible with a given function at a specific point, but they concentrate their accuracy near that point. A good interpolation polynomial needs to provide a relatively accurate approximation over an entire interval, and Taylor polynomials do not generally do this.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 9 / 33

slide-24
SLIDE 24

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Example: f(x) = ex

We will calculate the first six Taylor polynomials about x0 = 0 for f(x) = ex.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 10 / 33

slide-25
SLIDE 25

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Example: f(x) = ex

We will calculate the first six Taylor polynomials about x0 = 0 for f(x) = ex.

Note

Since the derivatives of f(x) are all ex, which evaluated at x0 = 0 gives 1.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 10 / 33

slide-26
SLIDE 26

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Example: f(x) = ex

We will calculate the first six Taylor polynomials about x0 = 0 for f(x) = ex.

Note

Since the derivatives of f(x) are all ex, which evaluated at x0 = 0 gives 1. The Taylor polynomials are as follows:

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 10 / 33

slide-27
SLIDE 27

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = ex about x0 = 0

P0(x) = 1 P1(x) = 1 + x P2(x) = 1 + x + x2 2 P3(x) = 1 + x + x2 2 + x3 6 P4(x) = 1 + x + x2 2 + x3 6 + x4 24 P5(x) = 1 + x + x2 2 + x3 6 + x4 24 + x5 120

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 11 / 33

slide-28
SLIDE 28

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = ex about x0 = 0

y x 5 10 15 20 1 21 2 3 y 5 P2(x) y 5 P3(x) y 5 P4(x) y 5 P5(x) y 5 P1(x) y 5 P0(x) y 5 ex

Notice that even for the higher-degree polynomials, the error becomes progressively worse as we move away from zero.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 12 / 33

slide-29
SLIDE 29

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Example: A more extreme case

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 13 / 33

slide-30
SLIDE 30

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Example: A more extreme case

Although better approximations are obtained for f(x) = ex if higher-degree Taylor polynomials are used, this is not true for all functions.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 13 / 33

slide-31
SLIDE 31

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Example: A more extreme case

Although better approximations are obtained for f(x) = ex if higher-degree Taylor polynomials are used, this is not true for all functions. Consider, as an extreme example, using Taylor polynomials of various degrees for f(x) = 1

x expanded about x0 = 1 to

approximate f(3) = 1

3.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 13 / 33

slide-32
SLIDE 32

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Calculations

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 14 / 33

slide-33
SLIDE 33

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Calculations

Since f(x) = x−1, f ′(x) = −x−2, f ′′(x) = (−1)22 · x−3,

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 14 / 33

slide-34
SLIDE 34

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Calculations

Since f(x) = x−1, f ′(x) = −x−2, f ′′(x) = (−1)22 · x−3, and, in general, f (k)(x) = (−1)kk!x−k−1,

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 14 / 33

slide-35
SLIDE 35

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

Calculations

Since f(x) = x−1, f ′(x) = −x−2, f ′′(x) = (−1)22 · x−3, and, in general, f (k)(x) = (−1)kk!x−k−1, the Taylor polynomials are Pn(x) =

n

  • k=0

f (k)(1) k! (x − 1)k =

n

  • k=0

(−1)k(x − 1)k.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 14 / 33

slide-36
SLIDE 36

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

To Approximate f(3) = 1

3 by Pn(3)

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 15 / 33

slide-37
SLIDE 37

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

To Approximate f(3) = 1

3 by Pn(3)

To approximate f(3) = 1

3 by Pn(3) for increasing values of n, we

  • btain the values shown below — rather a dramatic failure!

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 15 / 33

slide-38
SLIDE 38

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

To Approximate f(3) = 1

3 by Pn(3)

To approximate f(3) = 1

3 by Pn(3) for increasing values of n, we

  • btain the values shown below — rather a dramatic failure!

When we approximate f(3) = 1

3 by Pn(3) for larger values of n, the

approximations become increasingly inaccurate.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 15 / 33

slide-39
SLIDE 39

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Taylor Polynomials for f(x) = 1

x about x0 = 1

To Approximate f(3) = 1

3 by Pn(3)

To approximate f(3) = 1

3 by Pn(3) for increasing values of n, we

  • btain the values shown below — rather a dramatic failure!

When we approximate f(3) = 1

3 by Pn(3) for larger values of n, the

approximations become increasingly inaccurate. n 1 2 3 4 5 6 7 Pn(3) 1 −1 3 −5 11 −21 43 −85

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 15 / 33

slide-40
SLIDE 40

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Footnotes

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 16 / 33

slide-41
SLIDE 41

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Footnotes

For the Taylor polynomials, all the information used in the approximation is concentrated at the single number x0, so these polynomials will generally give inaccurate approximations as we move away from x0.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 16 / 33

slide-42
SLIDE 42

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Footnotes

For the Taylor polynomials, all the information used in the approximation is concentrated at the single number x0, so these polynomials will generally give inaccurate approximations as we move away from x0. This limits Taylor polynomial approximation to the situation in which approximations are needed only at numbers close to x0.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 16 / 33

slide-43
SLIDE 43

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Footnotes

For the Taylor polynomials, all the information used in the approximation is concentrated at the single number x0, so these polynomials will generally give inaccurate approximations as we move away from x0. This limits Taylor polynomial approximation to the situation in which approximations are needed only at numbers close to x0. For ordinary computational purposes, it is more efficient to use methods that include information at various points.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 16 / 33

slide-44
SLIDE 44

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Taylor Polynomials

Footnotes

For the Taylor polynomials, all the information used in the approximation is concentrated at the single number x0, so these polynomials will generally give inaccurate approximations as we move away from x0. This limits Taylor polynomial approximation to the situation in which approximations are needed only at numbers close to x0. For ordinary computational purposes, it is more efficient to use methods that include information at various points. The primary use of Taylor polynomials in numerical analysis is not for approximation purposes, but for the derivation of numerical techniques and error estimation.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 16 / 33

slide-45
SLIDE 45

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

4

Example: Second-Degree Lagrange Interpolating Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 17 / 33

slide-46
SLIDE 46

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Polynomial Interpolation

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 18 / 33

slide-47
SLIDE 47

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Polynomial Interpolation

The problem of determining a polynomial of degree one that passes through the distinct points (x0, y0) and (x1, y1) is the same as approximating a function f for which f (x0) = y0 and f (x1) = y1 by means of a first-degree polynomial interpolating, or agreeing with, the values of f at the given points.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 18 / 33

slide-48
SLIDE 48

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Polynomial Interpolation

The problem of determining a polynomial of degree one that passes through the distinct points (x0, y0) and (x1, y1) is the same as approximating a function f for which f (x0) = y0 and f (x1) = y1 by means of a first-degree polynomial interpolating, or agreeing with, the values of f at the given points. Using this polynomial for approximation within the interval given by the endpoints is called polynomial interpolation.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 18 / 33

slide-49
SLIDE 49

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Define the functions L0(x) = x − x1 x0 − x1 and L1(x) = x − x0 x1 − x0 .

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 19 / 33

slide-50
SLIDE 50

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Define the functions L0(x) = x − x1 x0 − x1 and L1(x) = x − x0 x1 − x0 .

Definition

The linear Lagrange interpolating polynomial though (x0, y0) and (x1, y1) is P(x) = L0(x)f(x0) + L1(x)f(x1) = x − x1 x0 − x1 f(x0) + x − x0 x1 − x0 f(x1).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 19 / 33

slide-51
SLIDE 51

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

P(x) = L0(x)f(x0) + L1(x)f(x1) = x − x1 x0 − x1 f(x0) + x − x0 x1 − x0 f(x1). Note that L0(x0) = 1, L0(x1) = 0, L1(x0) = 0, and L1(x1) = 1,

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 20 / 33

slide-52
SLIDE 52

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

P(x) = L0(x)f(x0) + L1(x)f(x1) = x − x1 x0 − x1 f(x0) + x − x0 x1 − x0 f(x1). Note that L0(x0) = 1, L0(x1) = 0, L1(x0) = 0, and L1(x1) = 1, which implies that P(x0) = 1 · f(x0) + 0 · f(x1) = f(x0) = y0 and P(x1) = 0 · f(x0) + 1 · f(x1) = f(x1) = y1.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 20 / 33

slide-53
SLIDE 53

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

P(x) = L0(x)f(x0) + L1(x)f(x1) = x − x1 x0 − x1 f(x0) + x − x0 x1 − x0 f(x1). Note that L0(x0) = 1, L0(x1) = 0, L1(x0) = 0, and L1(x1) = 1, which implies that P(x0) = 1 · f(x0) + 0 · f(x1) = f(x0) = y0 and P(x1) = 0 · f(x0) + 1 · f(x1) = f(x1) = y1. So P is the unique polynomial of degree at most 1 that passes through (x0, y0) and (x1, y1).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 20 / 33

slide-54
SLIDE 54

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Example: Linear Interpolation

Determine the linear Lagrange interpolating polynomial that passes through the points (2, 4) and (5, 1).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 21 / 33

slide-55
SLIDE 55

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Example: Linear Interpolation

Determine the linear Lagrange interpolating polynomial that passes through the points (2, 4) and (5, 1).

Solution

In this case we have L0(x) = x − 5 2 − 5 = −1 3(x − 5) and L1(x) = x − 2 5 − 2 = 1 3(x − 2),

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 21 / 33

slide-56
SLIDE 56

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

Example: Linear Interpolation

Determine the linear Lagrange interpolating polynomial that passes through the points (2, 4) and (5, 1).

Solution

In this case we have L0(x) = x − 5 2 − 5 = −1 3(x − 5) and L1(x) = x − 2 5 − 2 = 1 3(x − 2), so P(x) = −1 3(x − 5) · 4 + 1 3(x − 2) · 1 = −4 3x + 20 3 + 1 3x − 2 3 = −x + 6.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 21 / 33

slide-57
SLIDE 57

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The Linear Case

x y

y 5 P(x) = 2x 1 6

1 1 2 3 4 2 3 4 5

(2,4) (5,1)

The linear Lagrange interpolating polynomial that passes through the points (2, 4) and (5, 1).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 22 / 33

slide-58
SLIDE 58

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: Degree n Construction

y x x0 x1 x2 xn y 5 P(x) y 5 f (x)

To generalize the concept of linear interpolation, consider the construction of a polynomial of degree at most n that passes through the n + 1 points (x0, f(x0)), (x1, f(x1)), . . . , (xn, f(xn)).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 23 / 33

slide-59
SLIDE 59

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Constructing the Degree n Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 24 / 33

slide-60
SLIDE 60

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Constructing the Degree n Polynomial

We first construct, for each k = 0, 1, . . . , n, a function Ln,k(x) with the property that Ln,k(xi) = 0 when i = k and Ln,k(xk) = 1.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 24 / 33

slide-61
SLIDE 61

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Constructing the Degree n Polynomial

We first construct, for each k = 0, 1, . . . , n, a function Ln,k(x) with the property that Ln,k(xi) = 0 when i = k and Ln,k(xk) = 1. To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of Ln,k(x) contain the term (x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 24 / 33

slide-62
SLIDE 62

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Constructing the Degree n Polynomial

We first construct, for each k = 0, 1, . . . , n, a function Ln,k(x) with the property that Ln,k(xi) = 0 when i = k and Ln,k(xk) = 1. To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of Ln,k(x) contain the term (x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn). To satisfy Ln,k(xk) = 1, the denominator of Ln,k(x) must be this same term but evaluated at x = xk.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 24 / 33

slide-63
SLIDE 63

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Constructing the Degree n Polynomial

We first construct, for each k = 0, 1, . . . , n, a function Ln,k(x) with the property that Ln,k(xi) = 0 when i = k and Ln,k(xk) = 1. To satisfy Ln,k(xi) = 0 for each i = k requires that the numerator of Ln,k(x) contain the term (x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn). To satisfy Ln,k(xk) = 1, the denominator of Ln,k(x) must be this same term but evaluated at x = xk. Thus Ln,k(x) = (x − x0) · · · (x − xk−1)(x − xk+1) · · · (x − xn) (xk − x0) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn).

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 24 / 33

slide-64
SLIDE 64

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Ln,k(x) = (x − x0) · · · (x − xk−1)(x − xk+1) · · · (x − xn) (xk − x0) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn).

x x0 x1 xk21 xk xk11 xn21 xn Ln,k(x) 1 . . . . . .

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 25 / 33

slide-65
SLIDE 65

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Theorem: n-th Lagrange interpolating polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 26 / 33

slide-66
SLIDE 66

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Theorem: n-th Lagrange interpolating polynomial

If x0, x1, . . . , xn are n + 1 distinct numbers and f is a function whose values are given at these numbers,

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 26 / 33

slide-67
SLIDE 67

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Theorem: n-th Lagrange interpolating polynomial

If x0, x1, . . . , xn are n + 1 distinct numbers and f is a function whose values are given at these numbers, then a unique polynomial P(x) of degree at most n exists with f(xk) = P(xk), for each k = 0, 1, . . . , n.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 26 / 33

slide-68
SLIDE 68

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

Theorem: n-th Lagrange interpolating polynomial

If x0, x1, . . . , xn are n + 1 distinct numbers and f is a function whose values are given at these numbers, then a unique polynomial P(x) of degree at most n exists with f(xk) = P(xk), for each k = 0, 1, . . . , n. This polynomial is given by P(x) = f(x0)Ln,0(x) + · · · + f(xn)Ln,n(x) =

n

  • k=0

f(xk)Ln,k(x) where, for each k = 0, 1, . . . , n, Ln,k(x) is defined as follows:

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 26 / 33

slide-69
SLIDE 69

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: The General Case

P(x) = f(x0)Ln,0(x) + · · · + f(xn)Ln,n(x) =

n

  • k=0

f(xk)Ln,k(x)

Definition of Ln,k(x)

Ln,k(x) = (x − x0)(x − x1) · · · (x − xk−1)(x − xk+1) · · · (x − xn) (xk − x0)(xk − x1) · · · (xk − xk−1)(xk − xk+1) · · · (xk − xn) =

n

  • i=0

i=k

(x − xi) (xk − xi) We will write Ln,k(x) simply as Lk(x) when there is no confusion as to its degree.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 27 / 33

slide-70
SLIDE 70

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Outline

1

Weierstrass Approximation Theorem

2

Inaccuracy of Taylor Polynomials

3

Constructing the Lagrange Polynomial

4

Example: Second-Degree Lagrange Interpolating Polynomial

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 28 / 33

slide-71
SLIDE 71

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Example: f(x) = 1

x

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 29 / 33

slide-72
SLIDE 72

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Example: f(x) = 1

x

(a) Use the numbers (called nodes) x0 = 2, x1 = 2.75 and x2 = 4 to find the second Lagrange interpolating polynomial for f(x) = 1

x .

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 29 / 33

slide-73
SLIDE 73

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Example: f(x) = 1

x

(a) Use the numbers (called nodes) x0 = 2, x1 = 2.75 and x2 = 4 to find the second Lagrange interpolating polynomial for f(x) = 1

x .

(b) Use this polynomial to approximate f(3) = 1

3.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 29 / 33

slide-74
SLIDE 74

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Part (a): Solution

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 30 / 33

slide-75
SLIDE 75

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Part (a): Solution

We first determine the coefficient polynomials L0(x), L1(x), and L2(x): L0(x) = (x − 2.75)(x − 4) (2 − 2.5)(2 − 4) = 2 3(x − 2.75)(x − 4) L1(x) = (x − 2)(x − 4) (2.75 − 2)(2.75 − 4) = −16 15(x − 2)(x − 4) L2(x) = (x − 2)(x − 2.75) (4 − 2)(4 − 2.5) = 2 5(x − 2)(x − 2.75)

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 30 / 33

slide-76
SLIDE 76

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Part (a): Solution

We first determine the coefficient polynomials L0(x), L1(x), and L2(x): L0(x) = (x − 2.75)(x − 4) (2 − 2.5)(2 − 4) = 2 3(x − 2.75)(x − 4) L1(x) = (x − 2)(x − 4) (2.75 − 2)(2.75 − 4) = −16 15(x − 2)(x − 4) L2(x) = (x − 2)(x − 2.75) (4 − 2)(4 − 2.5) = 2 5(x − 2)(x − 2.75) Also, since f(x) = 1

x :

f(x0) = f(2) = 1/2, f(x1) = f(2.75) = 4/11, f(x2) = f(4) = 1/4

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 30 / 33

slide-77
SLIDE 77

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

Part (a): Solution (Cont’d)

Therefore, we obtain P(x) =

2

  • k=0

f(xk)Lk(x) = 1 3(x − 2.75)(x − 4) − 64 165(x − 2)(x − 4) + 1 10(x − 2)(x − 2.75) = 1 22x2 − 35 88x + 49 44.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 31 / 33

slide-78
SLIDE 78

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

P(x) = 1 22x2 − 35 88x + 49 44 (b) Use this polynomial to approximate f(3) = 1

3.

Part (b): Solution

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 32 / 33

slide-79
SLIDE 79

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

P(x) = 1 22x2 − 35 88x + 49 44 (b) Use this polynomial to approximate f(3) = 1

3.

Part (b): Solution

An approximation to f(3) = 1

3 is

f(3) ≈ P(3) = 9 22 − 105 88 + 49 44 = 29 88 ≈ 0.32955.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 32 / 33

slide-80
SLIDE 80

Weierstrass Taylor Polynomials Lagrange Polynomial Example

The Lagrange Polynomial: 2nd Degree Polynomial

P(x) = 1 22x2 − 35 88x + 49 44 (b) Use this polynomial to approximate f(3) = 1

3.

Part (b): Solution

An approximation to f(3) = 1

3 is

f(3) ≈ P(3) = 9 22 − 105 88 + 49 44 = 29 88 ≈ 0.32955. Earlier, we we found that no Taylor polynomial expanded about x0 = 1 could be used to reasonably approximate f(x) = 1/x at x = 3.

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 32 / 33

slide-81
SLIDE 81

Weierstrass Taylor Polynomials Lagrange Polynomial Example

Second Lagrange interpolating polynomial for f(x) = 1

x

x y 1 2 3 4 5 1 2 3 4 y 5 f (x) y 5 P(x)

Numerical Analysis (Chapter 3) Lagrange Interpolating Polynomials I R L Burden & J D Faires 33 / 33