Does there exist a polynomial function for every n points, whose extremas are these points? Given $ n $ points in $ \mathbb{R}^2 $, does there exist a polynomial function of any degree, whose extremas include these $ n $ points?
Given 3 points:
$
P_1 = (0,4), P_2 = (2,2), P_3 = (4,7)
$
And some function $f(x)$, for which the following holds:
$$
P_1, P_2, P_3 \in f(x)
\\
f'(0) = f'(2) = f'(4) = 0
$$
So $f(x)$ should be at least of degree 4 (please correct me if I'm wrong).
$$
f(x) = \sum_{i=0}^3 a_i \ x^i
\\
f'(x) = \sum_{i=1}^3 i \ a_i \ x^{i-1}
$$
That means I need to find 4 unknown variables => 4 equations.
I could use:


*

*$f'(0) = 0$

*$f'(2) = 0$

*$f'(4) = 0$

*$f \ (0) = 4$


And here's the problem: The $y$ coordinates of the points don't matter. So is it possible to find such a polynomial function? If it is, how do I find it?
Why I need this function:
I would like to write a generator for 3D objects with organic shapes. I would like to use a mathematical function to describe the shape of the object. Ideally a user should be able to define points, the extremas, and the program generates a shape that doesn't exceed these points.
 A: I'm a little unclear as to the exact conditions you require the polynomial to satisfy, so I'm going to answer the question in the title. Given points $x_1, x_2, \dots, x_n$, to make a polynomial which has extrema at those points first form the polynomial
$$
P(x)=(x-x_1)(x-x_2)\cdots(x-x_n).
$$
Now let $Q(x)$ be the integral of $P(x)$, say $Q(x)=\int_0^x P(t)\,dt$. The polynomial $Q(x)$ has extrema at the points $x_1,x_2,\dots,x_n$, as desired.
A: Your problem is a special case of the Hermite Interpolation Problem, where you are looking for a polynome $P$ whose derivatives up to order $m-1$ (including the 0-th derivative, i.e., the value of the polynome itself) match given values in some points $x_1, \ldots,x_n$.
In your case $m$ is 2 and the given values for the derivative are always 0. For given set of $m \cdot n$ conditions, there is exactly one polynome of degree $n\cdot m -1$ or lower that fulfills your conditions, so in your case you will need a polynome of degree $2n-1$ for $n$ points. (This polynome may incidentally have a lower degree.) In particular, this means that your polynome may have additional local extrema in the relevant domain, which may even be more “extreme” than your prescribed extrema.
Considering your application you might want to take a look at other interpolation functions than polynomes such as Bézier curves, splines or spiros, which are all used by vector graphic programs, the first ones being by far the most common¹. Given the right constraints, these are more likely to fulfill your criteria.

¹ Also, you might want to take a general look at some vector graphic programs such as Inkscape, since your application with the user defining some points and the program generating an appropriate curve from this is roughly what these programs do.
