简体   繁体   English

Apache Commons Math PolynomialSolver:如何获得所有根?

[英]Apache commons math PolynomialSolver: how to get all roots?

Hi basic question in trying to use commons-math's PolynomialSolver classes. 您好,尝试使用Commons-math的PolynomialSolver类的基本问题。

According to the documentation here http://commons.apache.org/math/userguide/analysis.html as well as the API the solving methods typically take the form 根据此处的文档http://commons.apache.org/math/userguide/analysis.html以及API,解决方法通常采用以下形式:

double c = solver.solve(100, function, 1.0, 5.0, AllowedSolution.LEFT_SIDE);

I'm obviously missing something, but given that the fundamental theorem of algebra is that there are n roots for a polynomial of n degree, how do I get all the roots? 我显然错过了一些东西,但是鉴于代数的基本定理是n次多项式有n个根,我如何得到所有根?

What good is a root solver returning one double? 根求解器返回双倍有什么好处?

I noticed in this thread Finding roots of polynomial in Java that the method offered in the solutions returns a complex array. 我在该线程中注意到, 在Java查找多项式的根时,解决方案中提供的方法返回了一个复杂的数组。 This is what I'd expect, so could someone kindly explain why the commons-math polynomial solvers are returning one double root? 这就是我所期望的,所以有人可以解释一下为什么公共数学多项式求解器返回一个双根吗?

most of these numerical algorithms operate on generic functions (ie not necessarily polynomials) and make few assumptions about them. 这些数值算法中的大多数都对通用函数(即不一定是多项式)进行运算,并且对它们进行很少的假设。 if we don't know what given function's nature exactly is, we can't even expect to infer how many roots it might have. 如果我们不知道给定函数的性质到底是什么,我们甚至无法期望推断出它可能有多少个根。

some algorithms there make additional assumptions that given functions are differentiable. 那里的某些算法做出了附加假设,即给定函数是可微的。 this makes them faster but require you to provide some additional info like derivate value so you can't use them for any function anymore. 这样可以使它们更快,但是需要您提供一些其他信息,例如微分值,这样您就不能再将它们用于任何功能了。

LaguerreSolver makes additional assumption that given function is a polynomial. LaguerreSolver进一步假设给定函数是多项式。 is this case it is possible to find all roots, hence solveAllComplex() method. 在这种情况下,有可能找到所有根,因此是resolveAllComplex()方法。 but it is the only algorithm there specialized in polynomials. 但这是唯一专门针对多项式的算法。 all the other algorithms are far more generic. 所有其他算法都更加通用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM