Constructing Polynomial Function from Set of Points and Slopes I only have a basic knowledge of calculus but I would like to know if it's possible to, given a set of points each with their own slopes, construct the simplest (or any) polynomial function that perfectly fits the given information.
In other words, a polynomial $P(x)$ would need to take on the value of each given ordinate at each given abscissa, and it's derivative, $P'(x)$ would need to take on the value of each given slope and each given abscissa.
I'm thinking that it might not be possible because if there's a series of points  that lie on a straight line among many other, randomly distributed ones, the derivative $P'(x)$ would have a segment of constant value in the middle of the chaotic curvature surrounding it. I don't think that polynomial functions can have this kind of behavior, can they?
If it's indeed impossible to do this, is there any other way to construct a curve that fits the given data?
 A: I think what you want
is Hermite interpolation.
Look here:
https://en.wikipedia.org/wiki/Hermite_interpolation
A: Try this. Given points $x_1,...,x_n$, positions $y_1,...,y_n$, and slopes $y'_1,...,y'_n$, you will need a polynomial of degree $2n-1$ with coefficients $a_0,...,a_{2n-1}.$ Then the matrix equation
$$
\left(\begin{array}{cccccc}
1 & x_1 & x_1^2 & ... & ... & x_1^{2n-1}\\
\vdots & \vdots & \vdots & \ddots & & \vdots\\
1 & x_n & x_n^2& ... & ... & x_n^{2n-1}\\
0 & 1 & 2x_1 & 3x_1^2 & ... & (2n-1)x_1^{2n-2}\\
\vdots & \vdots & \vdots & \ddots & & \vdots\\
0 & 1 & 2x_n & 3x_n^2 & ... & (2n-1)x_n^{2n-2}\\
\end{array}\right)
\left(\begin{array}{c}
a_0\\
a_1\\
\vdots\\
a_{2n-1}
\end{array}\right)
=
\left(\begin{array}{c}
y_1\\
\vdots\\
y_n\\
y'_1\\
\vdots\\
y'_n
\end{array}\right)
$$
is a mathematical way of representing what you want to do. If this system is consistent, your polynomial exists. As for your proposed counterexample, it seems that for the behavior you want, you would need an infinite number of points. This method only works for a finite number of points.
A: This is an interpolation problem. Particularly a polynomial interpolation. 
I would suggest Spline interpolation. It takes care of the smoothing properties at the end points. 


*

*In general, the more constraints/conditions you pose at the end
points, the higher the order of the interpolation polynomial.



Check: https://en.wikipedia.org/wiki/Spline_interpolation

