本文整理汇总了Java中org.apache.commons.math3.analysis.DifferentiableUnivariateFunction类的典型用法代码示例。如果您正苦于以下问题:Java DifferentiableUnivariateFunction类的具体用法?Java DifferentiableUnivariateFunction怎么用?Java DifferentiableUnivariateFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DifferentiableUnivariateFunction类属于org.apache.commons.math3.analysis包,在下文中一共展示了DifferentiableUnivariateFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testApproxByPolynomial
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
public void testApproxByPolynomial() {
RegressionLib testObj = new RegressionLib();
double testVal = 0;
ArrayList<Point> linearInput = new ArrayList<Point>(Arrays.asList(new Point(0, 0),
new Point(1, 1)));
DifferentiableUnivariateFunction linearFunc = testObj.approxByPolynomial(1, linearInput);
assertEquals(2.0, linearFunc.value(2));
assertEquals(0.0, testObj.getFitError());
ArrayList<Point> cubicInput = new ArrayList<Point>(Arrays.asList(new Point(-2, -8),
new Point(-1, -1), new Point(0, 0), new Point(2, 8)));
DifferentiableUnivariateFunction cubicFunc = testObj.approxByPolynomial(3, cubicInput);
assertEquals(-27.0, cubicFunc.value(-3));
assertEquals(0.0, testObj.getFitError());
ArrayList<Point> dirtyInput = new ArrayList<Point>(Arrays.asList(new Point(-200, -10),
new Point(-1, -100), new Point(0, 30), new Point(10, 9)));
DifferentiableUnivariateFunction approxFunc = testObj.approxByPolynomial(3, dirtyInput);
testVal = approxFunc.value(-3);
assertTrue(String.format("Actual value: %f", testVal), Math.abs(-427.351 - testVal) < 0.001);
assertTrue(String.format("Actual value: %f", testObj.getFitError()), testObj.getFitError() < 0.001);
}
示例2: setup
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void setup(int maxEval, DifferentiableUnivariateFunction f,
double min, double max, double startValue) {
super.setup(maxEval, f, min, max, startValue);
functionDerivative = f.derivative();
}
示例3: testSinZero
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/**
*
*/
@Test
public void testSinZero() {
DifferentiableUnivariateFunction f = new Sin();
double result;
NewtonSolver solver = new NewtonSolver();
result = solver.solve(100, f, 3, 4);
Assert.assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy());
result = solver.solve(100, f, 1, 4);
Assert.assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy());
Assert.assertTrue(solver.getEvaluations() > 0);
}
示例4: approxByPolynomial
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
public DifferentiableUnivariateFunction approxByPolynomial(int degree, ArrayList<Point> points) {
LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
PolynomialFitter fitter = new PolynomialFitter(degree, optimizer);
for (Point pt : points) {
fitter.addObservedPoint(pt.x, pt.y);
}
PolynomialFunction approximation = new PolynomialFunction(fitter.fit());
this.setFitError(optimizer.getRMS());
return approximation;
}
示例5: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Constant(1);
}
示例6: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Constant(-1);
}
示例7: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Constant(0);
}
示例8: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Cosh();
}
示例9: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Sinh();
}
示例10: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc}
* @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
*/
@Deprecated
public DifferentiableUnivariateFunction derivative() {
return new Cos();
}
示例11: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
return new Constant(1);
}
示例12: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
return new Constant(-1);
}
示例13: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
return new Constant(0);
}
示例14: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
return new Cosh();
}
示例15: derivative
import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
return new Sinh();
}