有限域上的SymPy多项式

Kev*_*son 5 python sympy finite-field polynomials

import sympy as S 
F = S.FiniteField(101)
Run Code Online (Sandbox Code Playgroud)

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

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

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

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

uke*_*emi 1

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'
Run Code Online (Sandbox Code Playgroud)

因此,poly将你的位置参数解释为域之外的东西。要获得预期的行为polyfactor等),您必须使用domain(或等效的)kwarg,即:

f = sympy.poly(y ** 2 - x ** 3 - x - 1, domain=F)
Run Code Online (Sandbox Code Playgroud)