Curve Fitting to Cubic poly

Yes. A linear function, y= ax+ b, has two coefficients, a and b, that need to be determined so you need to equations. One way to do that is to use two different points- a line is determined by two points- so you have y0=ax0+b\displaystyle y_0= ax_0+ b and y1=ax1+b\displaystyle y_1= ax_1+ b to solve for a and b. But knowing the value and slope (derivative) at a single point also gives two equations: y0=ax0+b\displaystyle y_0= ax_0+ b and a=a0\displaystyle a= a_0 gives y0=a0x0+b\displaystyle y_0= a_0x_0+ b so b=y0a0x0\displaystyle b= y_0- a_0x_0. The equation of the linear function with value y0\displaystyle y_0 and slope a0\displaystyle a_0 at x=x0\displaystyle x= x_0 is y=a0x+y0a0x0\displaystyle y= a_0x+ y_0- a_0x_0.

Similarly, a quadratic, y=ax2+bx+c\displaystyle y= ax^2+ bx+ c has three coefficients so we need three equations. We can get three equations using three points- a parabola is determined by three points- or using the value, first derivative, and second derivative at one point. For example, if y(x0)=y0\displaystyle y(x_0)= y_0, y(x0)=m0\displaystyle y'(x_0)= m_0, and y(x0)=m1\displaystyle y''(x_0)= m_1 then
y(x0)=ax02+bx0+c=y0\displaystyle y(x_0)= ax_0^2+ bx_0+ c= y_0
y(x0)=2ax0+b=m0\displaystyle y'(x_0)= 2ax_0+ b= m_0 and
y(x0)=2a=m1\displaystyle y''(x_0)= 2a= m_1.
Three equations we can solve for a, b, and c.

Finally, a cubic, y=ax3+bx2+cx+d\displaystyle y= ax^3+ bx^2+ cx+ d has four coefficients so we need four equations. We can get those equations by using four points- a cubic is determined by four points- or using the value, first derivative, second derivative, and third derivative at one point. For example, if y(x0)=y0\displaystyle y(x_0)= y_0, y(x0)=m0\displaystyle y'(x_0)= m_0, y(x0)=m1\displaystyle y''(x_0)= m_1, and y(x0)=m2\displaystyle y'''(x_0)= m_2 then we have
y(x0)=ax03+bx02+cx0+d=y0\displaystyle y(x_0)= ax_0^3+ bx_0^2+ cx_0+ d= y_0
y(x0)=3ax02+2bx0+c=m0\displaystyle y'(x_0)=3ax_0^2+ 2bx_0+ c= m_0
y(x0)=6ax0+2b=m1\displaystyle y''(x_0)= 6ax_0+ 2b= m_1 and
y(x0)=6a=m2\displaystyle y'''(x_0)= 6a= m_2.
Four equations we can solve for a, b, c, and d.

Of course, that can be extended to polynomials of any degree, n. Such a polynomial has n+ 1 coefficients so we need n+ 1 equations. Those can be the value of the polynomial at n+ 1 different points or the value of the polynomial and its first n derivatives at a single point.
 
Yes. A linear function, y= ax+ b, has two coefficients, a and b, that need to be determined so you need to equations. One way to do that is to use two different points- a line is determined by two points- so you have y0=ax0+b\displaystyle y_0= ax_0+ b and y1=ax1+b\displaystyle y_1= ax_1+ b to solve for a and b. But knowing the value and slope (derivative) at a single point also gives two equations: y0=ax0+b\displaystyle y_0= ax_0+ b and a=a0\displaystyle a= a_0 gives y0=a0x0+b\displaystyle y_0= a_0x_0+ b so b=y0a0x0\displaystyle b= y_0- a_0x_0. The equation of the linear function with value y0\displaystyle y_0 and slope a0\displaystyle a_0 at x=x0\displaystyle x= x_0 is y=a0x+y0a0x0\displaystyle y= a_0x+ y_0- a_0x_0.

Similarly, a quadratic, y=ax2+bx+c\displaystyle y= ax^2+ bx+ c has three coefficients so we need three equations. We can get three equations using three points- a parabola is determined by three points- or using the value, first derivative, and second derivative at one point. For example, if y(x0)=y0\displaystyle y(x_0)= y_0, y(x0)=m0\displaystyle y'(x_0)= m_0, and y(x0)=m1\displaystyle y''(x_0)= m_1 then
y(x0)=ax02+bx0+c=y0\displaystyle y(x_0)= ax_0^2+ bx_0+ c= y_0
y(x0)=2ax0+b=m0\displaystyle y'(x_0)= 2ax_0+ b= m_0 and
y(x0)=2a=m1\displaystyle y''(x_0)= 2a= m_1.
Three equations we can solve for a, b, and c.

Finally, a cubic, y=ax3+bx2+cx+d\displaystyle y= ax^3+ bx^2+ cx+ d has four coefficients so we need four equations. We can get those equations by using four points- a cubic is determined by four points- or using the value, first derivative, second derivative, and third derivative at one point. For example, if y(x0)=y0\displaystyle y(x_0)= y_0, y(x0)=m0\displaystyle y'(x_0)= m_0, y(x0)=m1\displaystyle y''(x_0)= m_1, and y(x0)=m2\displaystyle y'''(x_0)= m_2 then we have
y(x0)=ax03+bx02+cx0+d=y0\displaystyle y(x_0)= ax_0^3+ bx_0^2+ cx_0+ d= y_0
y(x0)=3ax02+2bx0+c=m0\displaystyle y'(x_0)=3ax_0^2+ 2bx_0+ c= m_0
y(x0)=6ax0+2b=m1\displaystyle y''(x_0)= 6ax_0+ 2b= m_1 and
y(x0)=6a=m2\displaystyle y'''(x_0)= 6a= m_2.
Four equations we can solve for a, b, c, and d.

Of course, that can be extended to polynomials of any degree, n. Such a polynomial has n+ 1 coefficients so we need n+ 1 equations. Those can be the value of the polynomial at n+ 1 different points or the value of the polynomial and its first n derivatives at a single point.
thanks appreciate it. This ^ is great
 
Top