多项式逆
我有一个五阶多项式:
y = ax5 + bx4 + cx3 + dx2 + ex + f
系数 af 是已知的,我需要计算给定 y 的 x 。我可能会使用牛顿拉夫森算法或类似算法,但如果可能的话更喜欢非迭代解决方案。
编辑:我想在发布我的问题之前我没有充分考虑这一点。我的多项式系数是根据采样数据计算出来的,在这种特殊情况下只有一个根。我没有想到,在一般情况下,当然可能有五个不同的根源。我想我也会将采样数据拟合到逆多项式,并用它从 y 计算 x。
I have a polynomial of the fifth order:
y = ax5 + bx4 + cx3 + dx2 + ex + f
The coefficients a-f are known and I need to calculate x for a given y. I could probably use the Newton-Raphson algorithm or similar, but would prefer a non-iterative solution if possible.
Edit: I guess I didn't think this through enough before posting my question. My polynomial coefficients have been calculated from sampled data and in this special case there is only one root. It didn't pass my mind that there, of course, might be five different roots in the general case. I think I will fit the sampled data to an inverse polynomial as well, and use that to calculate x from y.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
求多项式的根是困难且棘手的。获得稳定鲁棒的算法会让你头疼。牛顿+根去除似乎是一个好主意,但要使其正确工作确实很痛苦。
一个明显的问题是根部去除的稳定性。另一个问题是复杂的根源。一个更困难的问题是(数字上)多重根,您会损失很多精度。
最先进的黑盒算法是 Jenkins-Traub。但是,它很难实现,因此您必须在某个地方找到(或付费)实现。
然而,如果您可以访问线性 alebra 包,一种简单、稳健、稳定且高效的方法是计算伴生矩阵的特征值矩阵。这就是例如。 GSL 确实如此。
Finding roots of polynomials is difficult and tricky. Getting a stable robust algorithm will get you headache. Newton + root removal seems a great idea, but making this work correctly is really painful.
One obvious problem is the stability of the root removal. One other problem is complex roots. One more difficult problem is (numerically) multiple roots, where you lose a lot of precision.
The state-of-art black box algorithm is Jenkins-Traub. However, it is difficult to implement so you will have to find (or pay for) an implementation somewhere.
Nevertheless, if you have access to a linear alebra package, a simple, robust, stable, and efficient way is to compute the eigenvalues of the companion matrix. This is what eg. GSL does.
J Trana 已经回答了这个问题,但答案是你通常找不到一个算法来解决这个问题(这是使伽罗瓦出名的数学结果)。
另外,如果这不是家庭作业问题,那么您可能不希望算法以根式解决该问题,因为这在数值上会表现得很糟糕。
J Trana's sort of answered this already, but the answer is that you can't in general find an algorithm for this (this is the mathematical result that made Galois famous).
Also, if this is anything other than a homework problem, you probably don't want an algorithm to solve the thing in radicals anyway, since this will be numerically badly behaved.
牛顿-拉夫森只能为您提供一种解决方案。五次方程最多可以有 5 个。
如果你想要所有的解决方案
您要么需要将牛顿拉夫森与根去除配对,要么使用更强大的东西。
一种常见的方法是使用 Sturm 多项式
Newton-Raphson will only get you one solution. There could be up to 5 of them for a quintic.
If you want all the solutions
you either need to pair Newton-Raphson with root-removal or use something a little more robust.
One common method is using Sturm polynomials