RealPolynomialFunction1D extends DoubleFunction1D { @Override public Double evaluate(final Double x) { Validate.notNull(x, "x"); double y = _coefficients[_n - 1]; for (int i = _n - 2; i >= 0; i--) { y = x * y + _coefficients[i]; } return y; } RealPolynomialFunction1D(final double... coefficients); @Override Double evaluate(final Double x); double[] getCoefficients(); @Override DoubleFunction1D add(final DoubleFunction1D f); @Override RealPolynomialFunction1D add(final double a); @Override RealPolynomialFunction1D derivative(); @Override RealPolynomialFunction1D divide(final double a); @Override DoubleFunction1D multiply(final DoubleFunction1D f); @Override RealPolynomialFunction1D multiply(final double a); @Override DoubleFunction1D subtract(final DoubleFunction1D f); @Override RealPolynomialFunction1D subtract(final double a); RealPolynomialFunction1D toMonic(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testEvaluate() { final double x = RANDOM.nextDouble(); assertEquals(C[3] * Math.pow(x, 3) + C[2] * Math.pow(x, 2) + C[1] * x + C[0], F.evaluate(x), EPS); }