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


Java PolynomialFunction.getCoefficients方法代码示例

本文整理汇总了Java中org.apache.commons.math3.analysis.polynomials.PolynomialFunction.getCoefficients方法的典型用法代码示例。如果您正苦于以下问题:Java PolynomialFunction.getCoefficients方法的具体用法?Java PolynomialFunction.getCoefficients怎么用?Java PolynomialFunction.getCoefficients使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.analysis.polynomials.PolynomialFunction的用法示例。


在下文中一共展示了PolynomialFunction.getCoefficients方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPolynomialFunctionAST

import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; //导入方法依赖的package包/类
/**
 * Creates the polynomial function AST that encodes the give polynomial function.
 * 
 * @param pf     polynomial function. The starting knot corresponds to zero for this function.
 * @param knot   starting knot for this function
 * 
 * @return AST node representing the function
 */
private static ASTNode createPolynomialFunctionAST(PolynomialFunction pf, double knot) {
    double[] coefficients = pf.getCoefficients();
    
    ASTNode sum = new ASTNode(ASTNode.Type.PLUS);
    
    // Coefficients start with the constant then x^1, x^2 and so on
    sum.addChild(new ASTNode(coefficients[0]));
    for (int i=1; i<coefficients.length; ++i) {
        sum.addChild(
                ASTNode.times(
                        new ASTNode(coefficients[i]),
                        ASTNode.pow(createTimeMinusOffsetAST(knot), i)));
    }
    return sum;
}
 
开发者ID:allyhume,项目名称:SBMLDataTools,代码行数:24,代码来源:PolynomialInterpolator.java

示例2: exactIntegration

import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; //导入方法依赖的package包/类
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;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:11,代码来源:IterativeLegendreGaussIntegratorTest.java

示例3: checkPolynomial

import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; //导入方法依赖的package包/类
private void checkPolynomial(PolynomialFunction expected, PolynomialFunction result) {
    Assert.assertTrue(result.degree() >= expected.degree());
    double[] cE = expected.getCoefficients();
    double[] cR = result.getCoefficients();
    for (int i = 0; i < cE.length; ++i) {
        Assert.assertEquals(cE[i], cR[i], 1.0e-8 * FastMath.abs(cE[i]));
    }
    for (int i = cE.length; i < cR.length; ++i) {
        Assert.assertEquals(0.0, cR[i], 1.0e-9);
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:12,代码来源:HermiteInterpolatorTest.java


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