We have a simple graph situation with 3 evenly spaced points on the X axis:
{ 0, 0 }, { 50, 80 }, { 100, 40 }
We need to draw a smooth curve through these points, so we use a 2nd order polynomial fit function.
Now our middle point { 50, 80 } is the highest point on the graph, and we don't want any point on our drawn curve to be higher than this point.
Of course this isn't the result we get, because the fit draws several points after { 50, 80 } which are higher, i.e. { 60, 90 }, { 70, 100 }, before it curves back down again to meet { 100, 40 }.
Is there any way we can cheat, to somehow ensure no point on the drawn curve is higher than the highest point on our input ({ 50, 80 } in this case) - whilst still drawing a reasonably smooth curve?
In a second order polynomial, no. Try using a third order polynomial. Write $f(x)=ax^3+bx^2+cx+d$, and solve the system
$\begin{align} f(0)&=0 \\ f(50)&=80\\ f(100)&=40\\ f'(50)&=0 \end{align}$
for $a,b,c,d$. This will make the $(50,80)$ a (local!) maximum of the function. In general, for a $n$'th order polynomial, you can put exactly $n+1$ conditions on it (the same number as coefficients), not more.
Note: a third order polynomial will always go to infinity either on the right or left side of your graph. I would assume you only draw it for some limited interval, so everthing is fine.
EDIT: another note: if you have more points, taking higher and higher degrees polynomials typically starts to look quite bad. You should use so called "splines" for that. But for three points, polynomials are fine.