import sympy as S
F = S.FiniteField(101)
当我调用
f = S.poly(y ** 2 - x ** 3 - x - 1,F)
时,出现以下错误:'FiniteField' object has no attribute 'is_commutative'
但是,根据定义,有限域是可交换的!所以我不太确定这个错误是什么意思!
有人遇到过这个吗?您如何在有限域上声明多项式?
最佳答案
is_commutative
通常是operators的属性。没有为domains实现(不同于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)
关于python - 有限域上的SymPy多项式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29980721/