private double exactIntegration(PolynomialFunction p, double a, double b) {
   final double[] coeffs = p.getCoefficients();
   double yb = coeffs[coeffs.length - 1] / coeffs.length;
   double ya = yb;
   for (int i = coeffs.length - 2; i >= 0; --i) {
     yb = yb * b + coeffs[i] / (i + 1);
     ya = ya * a + coeffs[i] / (i + 1);
   }
   return yb * b - ya * a;
 }
예제 #2
0
 /** {@inheritDoc} */
 @Override
 public double value(final double x, final double... parameters) throws NoDataException {
   return PolynomialFunction.evaluate(parameters, x);
 }