# Thread: How to modify a polynomial to pass through two specific points?

1. ## How to modify a polynomial to pass through two specific points?

I have a set of noisy experimental data which effectively describes the gradient of a function which passes through two known specific x,y endpoint coordinates.

I can fit a polynomial to the gradient data to give me
dy/dx=a0+a1.x+a2.x^2+a3.x^3+a4.x^4+a5.x^5

and then integrate it to give me
Y(x)=C+a0.x+a1.x^2/2+a2.x^3/3+a3.x^4/4+a4.x^5/5+a5.x^6/6
a polynomial which descibes the function fairly well. Of course there is a constant of integration which I can set so that the function passes as close as possible to the known end points.

My problem is that because of noise and possible some progressive error in the experimental data there is some residual "slope" in the function such that it passes above one end point and below the other. I really want it to go exactly through them.

I can modify the first order polynomial coefficient to improve it, but cannot get it exact enough presumably because of contributions from higher order coefficients. Iterating on this can help but I am not certain it will converge or indeed whether it is the "right" thing to do.

So, my question is, is there a way of deterministly modifying a polynomial function to pass through two specific points?

Thanks in advance for any help anyone can offer.

2. ## suggestion

Originally Posted by jrr
I have a set of noisy experimental data which effectively describes the gradient of a function which passes through two known specific x,y endpoint coordinates.

I can fit a polynomial to the gradient data to give me
dy/dx=a0+a1.x+a2.x^2+a3.x^3+a4.x^4+a5.x^5

and then integrate it to give me
Y(x)=C+a0.x+a1.x^2/2+a2.x^3/3+a3.x^4/4+a4.x^5/5+a5.x^6/6
a polynomial which descibes the function fairly well. Of course there is a constant of integration which I can set so that the function passes as close as possible to the known end points.

My problem is that because of noise and possible some progressive error in the experimental data there is some residual "slope" in the function such that it passes above one end point and below the other. I really want it to go exactly through them.

I can modify the first order polynomial coefficient to improve it, but cannot get it exact enough presumably because of contributions from higher order coefficients. Iterating on this can help but I am not certain it will converge or indeed whether it is the "right" thing to do.

So, my question is, is there a way of deterministly modifying a polynomial function to pass through two specific points?

Thanks in advance for any help anyone can offer.
although i not getting you very well (because i am not accoustomed to the way the problem has been put)i would like to suggest the following:
1)perhaps you could try to remove the noise as much as possible.
2)perhaps you could further modify your constant of integration after some manipulation with the coefficients to remove the 'progressive-error'.

3. Originally Posted by Pulock2009
although i not getting you very well (because i am not accoustomed to the way the problem has been put)i would like to suggest the following:
1)perhaps you could try to remove the noise as much as possible.
2)perhaps you could further modify your constant of integration after some manipulation with the coefficients to remove the 'progressive-error'.
Sorry if I am not clear, I am not a mathematician, its an engineering problem which I have tried to describe as best as I can.

1)The experimental data has fundamental limitations which means that it cannot be improved.
2) let me try and explain a little more what I have tried:
Assuming the integrated function is
y=C+a0.x+a1.x^2/2+a2.x^3/3+a3.x^4/4+a4.x^5/5+a5.x^6/6 and the known end points are at x1,y1 and x2,y2

Assume when I evaluate the polynomial at x1 and x2 I get y values of yp1 and yp2, then the errors at the two endpoints are e1 = yp1-y1 and e2 = yp2-y2.
Then I have calculated overall slope error (e2-e1)/(x2-x1) and then subtracted this from a0 in the polynomial
Similarly I have calculated an offset error (e1+e2)/2 and subtracted it from C in the polynomial.
This reduces e1 and e2 but does not make them close enough to zero for my application
So, I am thinking that maybe I need some way of manipulating higher order coefficients as well?

Hope this helps to clarify the problem

4. ## suggestion

Originally Posted by jrr
Sorry if I am not clear, I am not a mathematician, its an engineering problem which I have tried to describe as best as I can.

1)The experimental data has fundamental limitations which means that it cannot be improved.
2) let me try and explain a little more what I have tried:
Assuming the integrated function is
y=C+a0.x+a1.x^2/2+a2.x^3/3+a3.x^4/4+a4.x^5/5+a5.x^6/6 and the known end points are at x1,y1 and x2,y2

Assume when I evaluate the polynomial at x1 and x2 I get y values of yp1 and yp2, then the errors at the two endpoints are e1 = yp1-y1 and e2 = yp2-y2.
Then I have calculated overall slope error (e2-e1)/(x2-x1) and then subtracted this from a0 in the polynomial
Similarly I have calculated an offset error (e1+e2)/2 and subtracted it from C in the polynomial.
This reduces e1 and e2 but does not make them close enough to zero for my application
So, I am thinking that maybe I need some way of manipulating higher order coeffficints as well?

Hope this helps to clarify the problem
i am giving you a very broad suggestion since you specified that you need to make e1 and e2 close enough to zero(although i am still not getting you very well):you could probably use limits somehow.as for the manipulation of higher order coefficients that is a1,a5.....,a(n-1),an there are many ways:you can expand them (using taylor, maclaurin series etc.) or you can express them as products using theory of equations.