Consider a regression/data fitting problem with polynomials. We have an extra constraint that the solution must be monotonic. So I have the following questions:
- For a given polynomial, how to efficiently determine if it is monotonic (at least in a given interval)?
- Furthermore, how to impose the monotonic constraint (again at least in a given interval)?
Thanks a lot in advance!
A polynomial $p(x)$ is monotonic on an interval $I$ iff its derivative $p'(x)$ is everywhere nonnegative or everywhere nonpositive on $I$, or equivalently if all of the roots of $p'(x)$ in the interior of the interval have even order.
As an manually workable example, consider a generic cubic polynomial $$p(x) := Ax^3 + Bx^2 + Cx + D.$$ Differentiating gives $$p'(x) = 3A x^2 + 2B x + C,$$ and (henceforth provided that $A \neq 0$) this has no real roots if $$\Delta := (2B)^2 - 4(3A)(C) = 4(B^2 - 3 A C)$$ is negative and a real double root if $\Delta = 0$. If $\Delta > 0$ then $p'$ has two single roots.
So, $p$ is monotonic on $\mathbb{R}$ iff $\Delta \leq 0$. On an interval $I$, $p$ is monotonic iff either (1) $\Delta \leq 0$ or (2) $\Delta > 0$ and neither of the roots of $p'$ (which can be computed with the quadratic formula) are contained in the interior of $I$.