I'm having trouble on doing a homework exercise.
I need to describe an efficient algorithm which solves the polynomial interpolation problem:
Let
P[i,j]
be the polynomial interpolation of the points (xi, yi),...,(xj,yj). Find 3 simple polynomials q(x), r(x), s(x) of degree 0 or 1 such that:P[i,j+1]={q(x)P[i,j](x)-r(x)P[i+1,j+1](x)}/s(x)
Given the points (x1,y1),....(xn,yn), describe an efficient dynamic programming algorithm based on the recurrence relation which you found in section 1 for computing the coefficients a0,...an-1 of the polynomial interpolation.
Well, I know how to solve the polynomial interpolation problem using Newton polynomial which looks quite similar to the above recurrence relation but I don't see how it helps me to find q(x), r(x), s(x) of degree 0 or 1, and assuming I have the correct q(x), r(x), s(x)- how do I solve this problem using dynamic programming?
Any help will be much appreciated.
x at i
orx at j
mean their place in the ordered list of input points.Some explanations:
First we need to understand what
P[i,j](x)
means.Put all your initial
(x,y)
pairs in the main diagonal of ann x n
matrix. Now you can extractP[0,0](x)
to be the y value of the point in your matrix at(0,0)
.P[0,1]
is the linear interpolation of the points in your matrix at(0,0)
and(1,1)
. This will be a straight line function.P[0,2]
is the linear interpolation of two previous linear interpolations, which means that youry
s now will be the linear functions which you calculated at the previous step. This is also the dynamic algorithm which builds the full polynom.I highly recommend you have a look at this very good lecture, and the full lecture notes.