final Function1D<Double, Double> grad = diff.differentiate(func);
assertEquals(-0.5, grad.evaluate(0.0), 1e-8);
final Function1D<DoubleMatrix1D, Double> params_func = VECTOR_PARAMS.asFunctionOfParameters(1.0);
final ScalarFieldFirstOrderDifferentiator vdiff = new ScalarFieldFirstOrderDifferentiator();
final Function1D<DoubleMatrix1D, DoubleMatrix1D> vgrad = vdiff.differentiate(params_func);
final DoubleMatrix1D res = vgrad.evaluate(new DoubleMatrix1D(new double[] {Math.PI, 0}));
assertEquals(0.0, res.getEntry(0), 1e-8);
assertEquals(Math.PI, res.getEntry(1), 1e-8);
}
}