Docsity

Interpolation: Fitting Continuous Functions to Discrete Data - Prof. James Lambers, Study notes of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Jim Lambers
MAT 460/560
Fall Semester 2009-10
Lecture 15 Notes
These notes correspond to Section 3.1 in the text.
Interpolation
Calculus provides many tools that can be used to understand the behavior of functions, but in most
cases it is necessary for these functions to be continuous or differentiable. This presents a problem
in most “real” applications, in which functions are used to model relationships between quantities,
but our only knowledge of these functions consists of a set of discrete data points, where the data
is obtained from measurements. Therefore, we need to be able to construct continuous functions
based on discrete data.
The problem of constructing such a continuous function is called data fitting. In this lecture,
we discuss a special case of data fitting known as interpolation, in which the goal is to find a
linear combination of 𝑛known functions to fit a set of data that imposes 𝑛constraints, thus
guaranteeing a unique solution that fits the data exactly, rather than approximately. The broader
term “constraints” is used, rather than simply “data points”, since the description of the data may
include additional information such as rates of change or requirements that the fitting function
have a certain number of continuous derivatives.
When it comes to the study of functions using calculus, polynomials are particularly simple to
work with. Therefore, in this course we will focus on the problem of constructing a polynomial
that, in some sense, fits given data. We first discuss some algorithms for computing the unique
polynomial 𝑝𝑛(𝑥) of degree 𝑛that satisfies 𝑝𝑛(𝑥𝑖) = 𝑦𝑖,𝑖= 0, . . . , 𝑛, where the points (𝑥𝑖, 𝑦𝑖) are
given. The points 𝑥0, 𝑥1, . . . , 𝑥𝑛are called interpolation points. The polynomial 𝑝𝑛(𝑥) is called the
interpolating polynomial of the data (𝑥0, 𝑦0), (𝑥1, 𝑦1), . . ., (𝑥𝑛, 𝑦𝑛). At first, we will assume that the
interpolation points are all distinct; this assumption will be relaxed in a later lecture.
Computing the Interpolating Polynomial
If the interpolation points 𝑥0, . . . , 𝑥𝑛are distinct, then the process of finding a polynomial that
passes through the points (𝑥𝑖, 𝑦𝑖), 𝑖= 0, . . . , 𝑛, is equivalent to solving a system of linear equations
𝐴x=bthat has a unique solution. However, different algorithms for computing the interpolating
polynomial use a different 𝐴, since they each use a different basis for the space of polynomials of
degree ≤𝑛.
The most straightforward method of computing the interpolation polynomial is to form the
system 𝐴x=bwhere 𝑏𝑖=𝑦𝑖,𝑖= 0, . . . , 𝑛, and the entries of 𝐴are defined by 𝑎𝑖𝑗 =𝑝𝑗(𝑥𝑖),
𝑖, 𝑗 = 0, . . . , 𝑛, where 𝑥0, 𝑥1, . . . , 𝑥𝑛are the points at which the data 𝑦0, 𝑦1, . . . , 𝑦𝑛are obtained, and
1
pf3
pf4

Partial preview of the text

Download Interpolation: Fitting Continuous Functions to Discrete Data - Prof. James Lambers and more Study notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Jim Lambers MAT 460/ Fall Semester 2009- Lecture 15 Notes

These notes correspond to Section 3.1 in the text.

Interpolation

Calculus provides many tools that can be used to understand the behavior of functions, but in most cases it is necessary for these functions to be continuous or differentiable. This presents a problem in most “real” applications, in which functions are used to model relationships between quantities, but our only knowledge of these functions consists of a set of discrete data points, where the data is obtained from measurements. Therefore, we need to be able to construct continuous functions based on discrete data. The problem of constructing such a continuous function is called data fitting. In this lecture, we discuss a special case of data fitting known as interpolation, in which the goal is to find a linear combination of 푛 known functions to fit a set of data that imposes 푛 constraints, thus guaranteeing a unique solution that fits the data exactly, rather than approximately. The broader term “constraints” is used, rather than simply “data points”, since the description of the data may include additional information such as rates of change or requirements that the fitting function have a certain number of continuous derivatives. When it comes to the study of functions using calculus, polynomials are particularly simple to work with. Therefore, in this course we will focus on the problem of constructing a polynomial that, in some sense, fits given data. We first discuss some algorithms for computing the unique polynomial 푝푛(푥) of degree 푛 that satisfies 푝푛(푥푖) = 푦푖, 푖 = 0,... , 푛, where the points (푥푖, 푦푖) are given. The points 푥 0 , 푥 1 ,... , 푥푛 are called interpolation points. The polynomial 푝푛(푥) is called the interpolating polynomial of the data (푥 0 , 푦 0 ), (푥 1 , 푦 1 ),.. ., (푥푛, 푦푛). At first, we will assume that the interpolation points are all distinct; this assumption will be relaxed in a later lecture.

Computing the Interpolating Polynomial

If the interpolation points 푥 0 ,... , 푥푛 are distinct, then the process of finding a polynomial that passes through the points (푥푖, 푦푖), 푖 = 0,... , 푛, is equivalent to solving a system of linear equations 퐴x = b that has a unique solution. However, different algorithms for computing the interpolating polynomial use a different 퐴, since they each use a different basis for the space of polynomials of degree ≤ 푛. The most straightforward method of computing the interpolation polynomial is to form the system 퐴x = b where 푏푖 = 푦푖, 푖 = 0,... , 푛, and the entries of 퐴 are defined by 푎푖푗 = 푝푗 (푥푖), 푖, 푗 = 0,... , 푛, where 푥 0 , 푥 1 ,... , 푥푛 are the points at which the data 푦 0 , 푦 1 ,... , 푦푛 are obtained, and

푝푗 (푥) = 푥푗^ , 푗 = 0, 1 ,... , 푛. The basis { 1 , 푥,... , 푥푛} of the space of polynomials of degree 푛 + 1 is called the monomial basis, and the corresponding matrix 퐴 is called the Vandermonde matrix for the points 푥 0 , 푥 1 ,... , 푥푛. Unfortunately, this matrix can be ill-conditioned, especially when interpolation points are close together. In Lagrange interpolation, the matrix 퐴 is simply the identity matrix, by virtue of the fact that the interpolating polynomial is written in the form

푝푛(푥) =

X^ 푛

푗=

where the polynomials {ℒ푛,푗 }푛푗=0 have the property that

ℒ푛,푗 (푥푖) =

1 if 푖 = 푗 0 if 푖 ∕= 푗

The polynomials {ℒ푛,푗 }, 푗 = 0,... , 푛, are called the Lagrange polynomials for the interpolation points 푥 0 , 푥 1 ,.. ., 푥푛. They are defined by

ℒ푛,푗 (푥) =

Y^ 푛

푘=0,푘∕ =푗

As the following result indicates, the problem of polynomial interpolation can be solved using Lagrange polynomials.

Theorem Let 푥 0 , 푥 1 ,... , 푥푛 be 푛 + 1 distinct numbers, and let 푓 (푥) be a function defined on a domain containing these numbers. Then the polynomial defined by

푝푛(푥) =

X^ 푛

푗=

is the unique polynomial of degree 푛 that satisfies

푝푛(푥푗 ) = 푓 (푥푗 ), 푗 = 0, 1 ,... , 푛.

The polynomial 푝푛(푥) is called the interpolating polynomial of 푓 (푥). We say that 푝푛(푥) interpolates 푓 (푥) at the points 푥 0 , 푥 1 ,... , 푥푛.

Example We will use Lagrange interpolation to find the unique polynomial 푝 3 (푥), of degree 3 or less, that agrees with the following data:

푖 푥푖 푦푖 0 − 1 3 1 0 − 4 2 1 5 3 2 − 6

(푥^3 − 푥).

By substituting 푥푖 for 푥 in each Lagrange polynomial ℒ 3 ,푗 (푥), for 푗 = 0, 1 , 2 , 3, it can be verified that

ℒ 3 ,푗 (푥푖) =

1 if 푖 = 푗 0 if 푖 ∕= 푗

It follows that the Lagrange interpolating polynomial 푝 3 (푥) is given by

X^3

푗=

(푥^3 − 3 푥^2 + 2푥) + (−4)

(푥^3 − 2 푥^2 − 푥 + 2) + (5)

(푥^3 − 푥^2 − 2 푥) +

(푥^3 − 푥)

(푥^3 − 3 푥^2 + 2푥) + (−2)(푥^3 − 2 푥^2 − 푥 + 2) −

(푥^3 − 푥^2 − 2 푥) − (푥^3 − 푥)

푥^3 +

푥^2 + (−1 + 2 + 5 + 1) 푥 − 4

= − 6 푥^3 + 8푥^2 + 7푥 − 4.

Substituting each 푥푖, for 푖 = 0, 1 , 2 , 3, into 푝 3 (푥), we can verify that we obtain 푝 3 (푥푖) = 푦푖 in each case. □