Search code examples
javamathematical-optimizationapache-commons-math

Finding optima of PolynomialFunction in commons.math


Is there a simple way to find the optimum of a PolynomialFunction (which is also a UnivariateDifferentiableFunction) in commons.math? There are a bewildering array of multidimensional optimizers, but AFAICS the only explicitly univariate optimizer is Brent, which doesn't take advantage of the differentiability.


Solution

  • Polynomials are special functions (in the general sense of "special") and have lots of distinctive, useful properties. My advice is to exploit those properties instead of trying to use a method for more general functions. Specifically, the extreme values of a polynomial are the roots of its derivative (where the second derivative is nonzero). The derivatives of a polynomial are easy to construct and evaluate, even in Java. I see that Apache Commons Math has LaguerreSolver to find the roots of a polynomial.