06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3. INTERPOLATION 96<br />

Summary: The <strong>in</strong>terpolat<strong>in</strong>g polynomial p 2 (x) for the data, (−1, −6), (1, 0), (2, 6), represented<br />

<strong>in</strong> three different basis functions is:<br />

Monomial: p 2 (x) =−4+3x + x 2<br />

Lagrange: p 2 (x) =− (x − 1)(x − 2) + 2(x +1)(x − 1)<br />

Newton: p 2 (x) =− 6+3(x +1)+(x +1)(x − 1)<br />

Similar to the monomial form, a polynomial written <strong>in</strong> Newton’s form can be evaluated<br />

us<strong>in</strong>g the Horner’s method which has O(n) complexity:<br />

p n (x) =a 0 + a 1 (x − x 0 )+a 2 (x − x 0 )(x − x 1 )+... + a n (x − x 0 )(x − x 1 ) ···(x − x n−1 )<br />

= a 0 +(x − x 0 )(a 1 +(x − x 1 )(a 2 + ... +(x − x n−2 )(a n−1 +(x − x n−1 )(a n )) ···))<br />

Example 50. Write p 2 (x) =−6+3(x +1)+(x +1)(x − 1) us<strong>in</strong>g the nested form.<br />

Solution. −6+3(x +1)+(x +1)(x − 1) = −6+(x +1)(2+x); note that the left-hand side<br />

has 2 multiplications, and the right-hand side has 1.<br />

Complexity of the three forms of polynomial <strong>in</strong>terpolation: The number of multiplications<br />

required <strong>in</strong> solv<strong>in</strong>g the correspond<strong>in</strong>g matrix equation <strong>in</strong> each polynomial<br />

basis is:<br />

• Monomial → O(n 3 )<br />

• Lagrange → trivial<br />

• Newton → O(n 2 )<br />

Evaluat<strong>in</strong>g the polynomials can be done efficiently us<strong>in</strong>g Horner’s method for monomial<br />

and Newton forms. A modified version of Lagrange form can also be evaluated us<strong>in</strong>g<br />

Horner’s method, but we do not discuss it here.<br />

Exercise 3.1-2: Compute, by hand, the <strong>in</strong>terpolat<strong>in</strong>g polynomial to the data (−1, 0),<br />

(0.5, 1), (1, 0) us<strong>in</strong>g the monomial, Lagrange, and Newton basis functions. Verify the three<br />

polynomials are identical.<br />

It’s time to discuss some theoretical results for polynomial <strong>in</strong>terpolation. Let’s start <strong>with</strong><br />

prov<strong>in</strong>g Theorem 47 which we stated earlier:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!