我有两组点(X,Y)。我想:
这是数据集:
X Y
-0.00001 5.400000e-08
-0.00001 5.700000e-08
0.67187 1.730000e-07
1.99997 9.150000e-07
2.67242 1.582000e-06
4.00001 3.734000e-06
4.67193 5.414000e-06
5.99998 9.935000e-06
6.67223 1.311300e-05
8.00000 2.102900e-05
我见过numpy有函数polyval。但这里你通过一个X得到一个y。我该如何反转它
正如我在评论中所说,你可以减去
y
值,拟合一个合适的多项式,然后找到它的根numpy
很容易就可以胜任这项任务。 下面是一个简单的例子:求根是一种数值算法,它产生实际根的数值近似值。这可能会产生非常小但非零的虚部。为了避免这种情况,需要一个小的阈值来区分实根和虚根。这就是为什么您不能真正使用
np.isreal
:具有3次多项式的可视示例:
相关问题 更多 >
编程相关推荐