# AppSession_01

0 (0 Likes / 0 Dislikes)

Hello, and welcome
to Application Session 1
Of this Introduction to Linear Algebra
with Wolfram U.
The topic for the session
is polynomial interpolation.
Let's begin with a brief overview
of the session.
Here is a pair of points,
which are called data.
The first point is {1, 3},
the next one is {3, 7}.
And so you might guess
That the polynomial 2<i>x</i> + 1
passes through these points.
Here is a plot.
It shows that you have
The linear polynomial over here
And the two data points
over there.
Now, this linear polynomial
can be used to interpolate
The values for points between
the two given points.
You could take the point
over here, for example,
Like 2.3, and work out
the value over there based on
The interpolating polynomial.
This is a simple example
of an interpolating polynomial.
Here's a more formal discussion.
So let's say given
<i>n</i> points in the plane
Then there's a polynomial
of degree at most <i>n</i> - 1
Could be less than in some cases
Which passes through
these <i>n</i> points.
This polynomial is called
an interpolating polynomial
For the given set of points.
Let's say you have three points
Then you have a polynomial
of degree 2, etcetera.
Now, the main point is
that this polynomial
Can be constructed by solving
a system of linear equations.
So although you have
a non-linear problem
You actually have
a linear problem
Sitting below it.
That's a solving of
a system of linear equations.
Fortunately, we have
a very nice function
Called InterpolatingPolynomial
Which can be used
to compute this polynomial.
I'll take a few examples
of actually solving the system
And then we'll use
the built-in functions
Straightaway.
As a first example, here is,
again, a set of two points.
I want to construct
a linear interpolating polynomial.
I'll call it P[<i>x</i>] = <i>a x</i> + <i>b</i>
The problem is
to determine <i>a</i> and <i>b</i>
So I'll set up a linear system
for <i>a</i> and <i>b</i>
And what we'll do is
I set up the equations
over here.
So basically, I evaluate
the polynomial at the <i>x</i> values
And set them equal
to the <i>y</i> values.
OK, once I've done that
I can solve the system
for <i>a</i> and <i>b</i>.
I can plug in the solution
And so have that
the polynomial is 2 <i>x</i> - 1
Which looks correct from here.
So let's plot the polynomial
and the data
And you see that you actually
have the correct fit over here.
So onto the case of
a quadratic interpolating polynomial.
I've got three data points
So I'm going to have
a quadratic function
Fitting them.
I set up an equation system
With three unknowns of
<i>a</i>, <i>b</i> and <i>c</i>
Three currently unknowns.
I solve the system, plug it back,
obtain the polynomial
And when I plot over here
Then again,
there's a very nice fit.
The next case will be
a cubic interpolating polynomial.
So now I've got
four data points
But this time I'm going to use
the built-in function
InterpolatingPolynomial
To get the answer.
Now, the point is this is in
the so-called Horner form.
It must be expanded
to get a nice answer
From a [indistinct] perspective,
that's the expanded form.
And again, if you plot over here
You see you get a very nice plot
Of the data points
and the interpolating polynomial.
As the first simple application
Let's say I want to construct
a quartic polynomial, degree 4
With these roots over here.
So I set up
a dataset with five points
The first four points
are just the roots.
{2, 0}, {7, 0}, {5, 0}, {-3, 0}
And the last one
is more or less arbitrary
But I just pick it so that
I get a nice polynomial.
So here's
the interpolating polynomial.
Clearly, that's going to pass
through the required points.
And then you can plot over here
And you see that you have roots
exactly at those points
And there's a value
at the fifth point.
OK, let's take an application.
I have a sine function
A sine function is surely not
a polynomial function
But there's some data for it.
So I construct
an interpolating polynomial.
It looks a bit messy.
So I can use a Chop function
which chops off very small parts
To get a slightly more
elegant expression.
I can plot the data points
and the polynomial over here.
It looks like the fit
is quite nice.
So if I try to compute
the value at Pi/4
It looks like the approximate
and exact values
Are quite close to each other
But now if I go further away
you see that actually
The approximation
gets quite poor.
So the main point is that
Interpolation is good
where it is valid
Namely between the points
But once itâ€™s three away from them
You might get
a pretty bad approximation.
So let us be careful
when doing interpolation
Then using them for applications.
That's the end of this session
and the main point is that
An interpolating polynomial
of degree <i>n</i> - 1
Can be constructed for any
set of <i>n</i> points in the plane
And this polynomial, of course,
passes through those points
And it can be used to interpolate
the values between the points.
From the other perspective
You actually would
solve a linear system of equations
To get the coefficients
for that polynomial.
We have a built-in function,
InterpolatingPolynomial
Which can be used
to compute this polynomial
For large sets of data
Keeping in mind that
as the digits become large
The computation will become
quite complicated.
So I stop here.
Thank you very much.