9
import sympy as S 
F = S.FiniteField(101)

当我打电话时,f = S.poly(y ** 2 - x ** 3 - x - 1,F)我收到以下错误:

'FiniteField' 对象没有属性 'is_commutative'

但是根据定义,有限域是可交换的!所以我不太确定这个错误应该是什么意思!

有没有人遇到过这个?如何在有限域上声明多项式?

4

1 回答 1

0

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将您的位置参数解释为域以外的东西。要获得polyfactor等)的预期行为,您必须使用domain(或等效的)kwarg,即:

f = sympy.poly(y ** 2 - x ** 3 - x - 1, domain=F)
于 2021-04-06T11:24:33.033 回答