在sympy be中,为什么get_field因有限场GF(9)而失败(定义为GF(3)的有限扩展)?

发布于 2025-02-04 02:54:55 字数 1603 浏览 3 评论 0原文

我正在尝试使用Sympy中的groebner函数来求解GF(9)= GF(3)[G]/(G ** 2 + 1)中的多元多项式系统。当我这样做时,我会得到错误

文件 “/applications/spyder.app/contents/resources/lib/python3.9/sympy/polys/groebnertools.py”, 第37行,格罗布纳 orig,ring = ring,ring.clone(domain = domain.get_field())

文件 “/applications/spyder.app/contents/resources/lib/python3.9/sympy/polys/domains/domains/domain.py”, 第846行,在get_field 提高域名('没有与%s'%self相关的字段)

domainerror:没有与gf(3)[g]/(g ** 2 + 1)

没有的字段

我将代码减少到最低限度get_field()失败。我还看了IS_FIELD ...这是真的! 我知道非prime有限字段的GF和类似机制失败了,但是如果我使用有限的扩展定义了自己的GF(9),我认为一切都会很好。 我是否缺少某些内容,或者Get_field()没有意识到GF9是一个领域?

我的最小代码

from sympy import Symbol, Poly
from sympy.polys.agca.extensions import FiniteExtension


g = Symbol('g')
gf9 = FiniteExtension(Poly(g**2 + 1, g, modulus=3))  # correct GF(9)
print('gf9 = ', gf9, 'type =', type(gf9), 'is_field?', gf9.is_Field)
print()
print('field associated with', gf9, '=', gf9.get_field())

响应

gf9 = gf(3)[g]/(g ** 2 + 1)is_field? true

追溯(最近的最新电话):

文件 “/applications/spyder.app/contents/resources/lib/python3.9/spyder_kernels/py3compat.py”, 第356行,在compat_exec中 exec(代码,全球,当地人)

file“/users/rick/.spyder-py3/temp.py”,第17行,in print(与',gf9,'='相关的'字段

文件 “/applications/spyder.app/contents/resources/lib/python3.9/sympy/polys/domains/domains/domain.py”, 第846行,在get_field 提高域名('没有与%s'%self相关的字段)

domainerror:没有与gf(3)[g]/(g ** 2 + 1)

没有的字段

任何

domainerror:与gf(3)[g] / 领域我从未问过我的真正问题:如何将Sympy的Groebner函数与GF(3)[G]/(G ** 2 + 1)一起使用?

I'm trying to use the groebner function in Sympy to solve a system of multivariate polynomials in GF(9) = GF(3)[g]/(g**2 + 1). When I do this I get the error

File
"/Applications/Spyder.app/Contents/Resources/lib/python3.9/sympy/polys/groebnertools.py",
line 37, in groebner
orig, ring = ring, ring.clone(domain=domain.get_field())

File
"/Applications/Spyder.app/Contents/Resources/lib/python3.9/sympy/polys/domains/domain.py",
line 846, in get_field
raise DomainError('there is no field associated with %s' % self)

DomainError: there is no field associated with GF(3)[g]/(g**2 + 1)

I reduced the code to the minimum that gives this get_field() failure. I also looked at is_field ... which was True!?
I know that GF and similar mechanisms fail for non-prime finite fields, but I thought that all would be well, if I defined my own GF(9) using a finite extension.
Am I missing something, or does get_field() not realize that gf9 is a field?

My minimal code

from sympy import Symbol, Poly
from sympy.polys.agca.extensions import FiniteExtension


g = Symbol('g')
gf9 = FiniteExtension(Poly(g**2 + 1, g, modulus=3))  # correct GF(9)
print('gf9 = ', gf9, 'type =', type(gf9), 'is_field?', gf9.is_Field)
print()
print('field associated with', gf9, '=', gf9.get_field())

Response

gf9 = GF(3)[g]/(g**2 + 1) is_field? True

Traceback (most recent call last):

File
"/Applications/Spyder.app/Contents/Resources/lib/python3.9/spyder_kernels/py3compat.py",
line 356, in compat_exec
exec(code, globals, locals)

File "/Users/rick/.spyder-py3/temp.py", line 17, in
print('field associated with', gf9, '=', gf9.get_field())

File
"/Applications/Spyder.app/Contents/Resources/lib/python3.9/sympy/polys/domains/domain.py",
line 846, in get_field
raise DomainError('there is no field associated with %s' % self)

DomainError: there is no field associated with GF(3)[g]/(g**2 + 1)

Any help appreciated :)

Addendum: I just noticed that I never asked my real question: How can I use Sympy's groebner function with GF(3)[g]/(g**2 + 1)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文