【问题标题】:Computation of polynomial coefficients [closed]多项式系数的计算
【发布时间】:2013-11-26 18:44:20
【问题描述】:

我需要数学库来解决 3 个方程的简单系统,例如 (ax2 + bx + c = y) 并得到 a, b, c,我知道 3 对夫妇 (x,y)。

我正在寻找一些东西,但没有找到对我有用的东西。

【问题讨论】:

标签: java algorithm polynomial-math


【解决方案1】:

这是一个由 3 个方程组成的线性系统,而不是二阶方程! x 和 y 是已知的值!要解决线性系统,请参见: https://code.google.com/p/efficient-java-matrix-library/wiki/SolvingLinearSystems

【讨论】:

  • 我使用了 Common Math,它可以工作,谢谢!
【解决方案2】:

问题解决了,感谢Zong Zheng Li和Pavlos Fragkiadoulakis

RealMatrix coefficients = new Array2DRowRealMatrix(new double[][] { { px1*px1, px1, 1 }, { px2*px2, px2, 1 },
            { x*x, x, 1 } }, false);
DecompositionSolver solver = new LUDecomposition(coefficients).getSolver();
RealVector constants = new ArrayRealVector(new double[] { py1, py2, y }, false);
RealVector solution = solver.solve(constants);
double a = solution.getEntry(0);
double b = solution.getEntry(1);
double c = solution.getEntry(2);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多