当前位置: 首页>>代码示例>>Java>>正文


Java DifferentiableUnivariateFunction类代码示例

本文整理汇总了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);
}
 
开发者ID:reatkin2,项目名称:karyotyper,代码行数:24,代码来源:RegressionLibTest.java

示例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();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:10,代码来源:AbstractDifferentiableUnivariateSolver.java

示例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);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:18,代码来源:NewtonSolverTest.java

示例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;
}
 
开发者ID:reatkin2,项目名称:karyotyper,代码行数:13,代码来源:RegressionLib.java

示例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);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Identity.java

示例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);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Minus.java

示例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);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Constant.java

示例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();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Sinh.java

示例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();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Cosh.java

示例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();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:8,代码来源:Sin.java

示例11: derivative

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
    return new Constant(1);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Identity.java

示例12: derivative

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
    return new Constant(-1);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Minus.java

示例13: derivative

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
    return new Constant(0);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Constant.java

示例14: derivative

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
    return new Cosh();
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Sinh.java

示例15: derivative

import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction; //导入依赖的package包/类
/** {@inheritDoc} */
public DifferentiableUnivariateFunction derivative() {
    return new Sinh();
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:5,代码来源:Cosh.java


注:本文中的org.apache.commons.math3.analysis.DifferentiableUnivariateFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。