相关疑难解决方法(0)

为什么我收到"没有为复数定义的排序关系"错误?

有些背景,请参阅此问题.我在这个问题上遇到的主要问题已经解决了,有人建议我再向另一个人提出我遇到的第二个问题:

print cubic(1, 2, 3, 4)  # Correct solution: about -1.65
...
    if x > 0:
TypeError: no ordering relation is defined for complex numbers
print cubic(1, -3, -3, -1)  # Correct solution: about 3.8473
    if x > 0:
TypeError: no ordering relation is defined for complex numbers
Run Code Online (Sandbox Code Playgroud)

具有一个实根和两个复根的三次方程式正在接收错误,即使我使用了cmath模块并定义了多维数据集根函数来处理复数.为什么是这样?

python math cubic

4
推荐指数
1
解决办法
1970
查看次数

标签 统计

cubic ×1

math ×1

python ×1