import sympy as S
F = S.FiniteField(101)
当我调用f = S.poly(y ** 2 - x ** 3 - x - 1,F)
时,出现以下错误:
"有限字段"对象没有属性"is_commutative"
但是根据定义,有限域是可交换的!所以我不太确定这个错误应该是什么意思!
以前有人遇到过这种情况吗?如何在有限域上声明多项式?
is_commutative
通常是运算符的属性。它不是为域实现的(与is_numeric
等不同)。
例如
>>> F = sympy.RealField() #returns the same error
>>> f = sympy.poly(y ** 2 - x ** 3 - x - 1, F)
AttributeError: 'RealField' object has no attribute 'is_commutative'
<小时 />因此,poly
将您的立场论点解释为域之外的东西。要获得poly
(和factor
等)的预期行为,您必须使用domain
(或等效的)kwarg,即:
f = sympy.poly(y ** 2 - x ** 3 - x - 1, domain=F)