RealPolynomialFunction1D extends DoubleFunction1D { @Override public RealPolynomialFunction1D derivative() { final int n = _coefficients.length - 1; final double[] coefficients = new double[n]; for (int i = 1; i <= n; i++) { coefficients[i - 1] = i * _coefficients[i]; } return new RealPolynomialFunction1D(coefficients); } 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 testDerivative() { final double x = RANDOM.nextDouble(); assertEquals(3 * C[3] * Math.pow(x, 2) + 2 * C[2] * x + C[1], F.derivative().evaluate(x), EPS); }