In this segment, we'll talk about how higher-order interpolation is generally a bad idea.
So, as in 1901, Runge published this article about how high order interpolation can be a bad idea.
So, in order to illustrate that point, what he did was he took a very simple function f of x
given by this quantity here, 1 divided by 1, plus 25 x squared, and x belonging to the range from
minus 1 to plus 1. And to start the illustration, so let's suppose he chose six data points,
which you are seeing right here in these green dots, six data points have been chosen on
the on the interval minus one comma one, equidistantly spaced.
And this is what you are seeing here as the six data points in the table as well. So,
when we have six data points we know that we can pass a fifth-order polynomial or less through it.
And this is what happened. He found out that the fifth-order polynomial does not represent
the function uh very well at a data, at certain points. So, you can see that this one is the
fifth-order polynomial, the red, the red curve, which you're seeing there. And the blue curve,
of course, is the original data and here original function. So, here what you're finding out is that
this is the amount of true error which you are going to get between the original function and
the interpolated polynomial. This is about, you're finding out that the absolute true
error is approximately of the order of 0.4 in this case. Now, one might suggest that hey maybe
six data points is not enough, maybe we should take in more data points in order for it to give
us better answers, or better representation of the function itself. Let's see what happens then.
So, here we have 20 data points being chosen data points, from -1 to plus 1. If you have 20
data points, these are equidistantly spaced again in the same interval of -1 comma 1,
and what we're going to do is that we're going to take these 20 data points and we're going
to pass a 19th order polynomial through it, and see if it represents the function better
than when we chose only six data. And this is what happened. And this is what happens when you choose
20 data points. So, you get a very good approximation of the function
between about -0.7 and plus 0.7, but outside of the domain, you're finding
out that there is a large difference between what the function actually is, and what the
interpolating polynomial is giving. So, this is our, this red line is our 19th order polynomial.
And the true error uh absolute true errors of of of the order of about eight, or so,
at these endpoints, or so, around here. And so we can we are seeing that hey as
you keep on increasing the points, you will get even more and more true error,
maximum true error between the original function and the interpreting polynomial. Hence,
showing you that higher-order interpolation is not a bad idea. So, what do we do about those cases?
What we do as follows, we use spline interpolation. And although you don't
know yet what spline interpolation is, it is basically using lower-order polynomials to
approximate all the data points which are given to us. So, what we do is
suffice to say we're using lower order polynomials and we will tell you what spline interpolation is,
but as an illustration, you are seeing that here this is the same 20 data points you are getting
the green line is your spline now, and it is on top of the original function,
which is a blue line, you're not being able to see the blue line because the green line is
overlapping it. And you can see that hey the spline interpolation is our answer to the problem
of using higher-order interpolant simulation. And that's something which we'll do later of course.
There is a good wolfram demonstration made by the good people at Mathematica, and it illustrates how
uh illustrates the concept of Runges phenomena here that as you keep on increasing
the number of points which you choose uh from a minus one to plus one that you are
getting uh getting worse and worse results
as you go along choosing more and more data points. And let's go and see that how that works.
So, here is the wolfram demo which shows you the Runge’s phenomena in this case right here we have
five data points being taken, and so hence the fourth-order polynomial is being drawn
uh, the orange line which you're seeing right here is the original function. And you can see that
the difference between the interpolant and the function is about a maximum of 0.5,
or so, as you can see from the graph. Let's go and see that if we want to increase the
number of data points does this error in the interpolant become smaller as one would expect?
And here we have 15 data points being chosen, and you can already see that yeah it is doing a very
good job between about -0.7 and plus 0.7 so far as representing the original function is concerned,
but outside of the domain, you're finding out that you're getting huge amounts of errors in
the interpolant about seven or so. And let's go and run this demonstration for the maximum
number of points available here. In this one is 50, so you're doing a 49th order polynomial,
and you can already see that it does an extremely good job of representing the function between -0.7
and plus 0.7, but once you go outside of the domain you're finding out that
the difference between the original function and the interpolant is becoming huge. Your
interpolant is also becoming highly oscillatory, and look at the error in the interpolant:
it is about 600 000, is the uh is the order of the error in the interpolant between the
original function and what you get from the interpolant itself. So, this gets to show you,
this is just a simulation and gets to show you that higher-order interpolation is a bad idea.