commons-math3版本3.6不会出现任何编译错误,您的代码可以正常工作。
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
你的方程式可以写如下
int xValue = 5;
int howManyUnknowParamsHasFunction = 1;
int howManyDeriviationWillYouTake = 2;
int whatIsTheIndexOfThisParameterX = 0;
DerivativeStructure x = new DerivativeStructure(howManyUnknowParamsHasFunction, howManyDeriviationWillYouTake, whatIsTheIndexOfThisParameterX, xValue);
// x --> x^2.
DerivativeStructure x2 = x.pow(2);
//y = 2x^2 + 3x + 7
DerivativeStructure y = new DerivativeStructure(2.0, x2, 3.0, x).add(7);