最佳实践numpy roots

2024-06-16 14:12:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我想知道这两种使用numpy计算多项式根的方法有什么区别。在

import numpy
polynom = [1,2,3,4]
print(sorted(numpy.roots(polynom)))
>>[(-1.6506291914393885+0j), (-0.17468540428030543-1.5468688872313967j), (-0.17468540428030543+1.5468688872313967j)]

以及

^{pr2}$

我使用的是python3.5btw


Tags: 方法importnumpysortedprint区别btwroots