Docsity

Interpolation Errors and Efficient Polynomial Evaluation - Prof. Ramani Duraiswami, Study notes of Computer Science

Partial preview of the text

Download Interpolation Errors and Efficient Polynomial Evaluation - Prof. Ramani Duraiswami and more Study notes Computer Science in PDF only on Docsity!

Error

•^

Define the error term as:

-^

If

f(x)

is an n

th

order polynomial

p

(x)n

is of course exact.

•^

Otherwise, since there is a perfect match at

x

, x 0

,…,x 1

n

•^

This function has at least

n

+1 roots at the interpolation

points.

n^

n

x

f^

x

p

x

ε

0

1

( )

(^

)(

)^

(^

) ( )

n^

n

x^

x^

x^

x^

x^

x^

x^

h x

ε ∴

=

−

−

−

L

Interpolation Errors

•^

Suppose we want to measure error at a point

x

•^

To make polynomial go through

x

, add to existing

polynomial divided difference term.

-^

This is the error we make using existing polynomial

-^

Comparing with Taylor series

(^

0

1

0

1

0

,^

,^

[^

,^

,^

,^

]

n

n

n^

n^

n^

i

i

x

x

x

x

x

f^

x

p

x

f x

x

x

x

x

x

=

K

K

(^

(^

)

0

1

[^

,^

,^

]^

n

n

f x

x

x

f

n

K

Efficient polynomial evaluation

•^

Given a polynomial in power form how many operationsdoes it take to evaluate it?

-^

a

p^

px

L

+ a

1

x + a

0

Horner’s Rule

-^

Horner’s rule (Horner, 1819)

recursively

evaluates the polynomial

ap

x p^

+

L

+ a

1

x + a

0

as: ((

L

(a

p^

x + a

p-

)x+

L

)x + a

. 0 -^

costs

p

multiplications and

p

additions, no extra storage.

Reduces complexity from

O(p

2 )^

to

O(p)

Interpolation: the story so far

-^

Given a function at

N

points, find its value at other point(s)

-^

So far: polynomial interpolation^ –

Polynomials are guaranteed to approximate any given function in an interval asaccurately as we want

-^

Different polynomial bases^ –

Monomial or Power basis– Newton and Lagrange basis

-^

For a given set of points and function values^ –

interpolating polynomial is unique

-^

Interpolation problem requires solution of a linear system^ –

System is dense for Monomial/Power basis– Newton and Lagrange forms allow the direct solution of the polynomialinterpolation form– Newton form particularly convenient to add new values

-^

Error for interpolation with n points is related to the value of the(n+1)

th^

derivative of the underlying function

Examples of polynomial interpolation

•^

Go to MATLAB demo^ – Vandermonde– Polynomial interpolation for small set– For larger set

-^

See that even for six points we have a problem^ – In between the data points, (especially in first and last

subintervals), function shows excessive variation.

  • overshoots changes in the data values.– As a result, full-degree polynomial interpolation is hardly ever

used for data and curve fitting.

•^

However we saw polynomial interpolation works wellwhen degree is low

Piecewise linear interpolation

•^

Simple idea^ – Connect straight lines between data points– Any intermediate value read off from straight line

-^

The

local variable

,^

s , is

•^

s^

x - x

k

•^

The

first divided difference

is

•^

δ k

yk

- y

)/(xk

k +

–x

)k

•^

With these quantities in hand, the interpolant is

-^

L

( x

y

k^

x – x

) ( k

yk

- y

)/(xk

k +

–x

)k

•^

y

k^

s

δ k

•^

Linear function that passes through (

xk

, y

) and ( k

xk

, y

k +

•^

So we can reduce error by choosing small intervals where 2

nd

derivative is higher

  • If we can choose where to sample data– Do more where the “action” is more

Piecewise Cubic interpolation

•^

While we expect function not to vary, we expect it to alsobe smooth

-^

So we could consider piecewise interpolants of higherdegree

-^

How many pieces of information do we need to fit acubic between two points?^ – y=a+bx+cx

2 +dx

3

  • 4 coefficients– Need 4 pieces of information– 2 values at end points– Need 2 more pieces of information– Derivatives?