Ask Your Question

dragomang87's profile - activity

2024-04-14 08:11:56 +0200 received badge  Popular Question (source)
2022-02-14 14:25:03 +0200 marked best answer prime field element constructor does not accept lists of size one

Let p be prime. Elements of

field = GF(p)

can be constructed as

field(x)

If n>1, elements of

field = GF(p**n)

can be constructed as

field([x1, x2, ..., xn])

This would suggest that for n=1

field([x1])

should work and return the same as

field(x1)

However Sage replies with the following traceback

>>> GF(5)([3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218)
  File "sage/structure/coerce_maps.pyx", line 161, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4556)
  File "sage/structure/coerce_maps.pyx", line 156, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4448)
  File "/usr/lib/python3/dist-packages/sage/rings/finite_rings/integer_mod_ring.py", line 1162, in _element_constructor_
    return integer_mod.IntegerMod(self, x)
  File "sage/rings/finite_rings/integer_mod.pyx", line 199, in sage.rings.finite_rings.integer_mod.IntegerMod (build/cythonized/sage/rings/finite_rings/integer_mod.c:4669)
  File "sage/rings/finite_rings/integer_mod.pyx", line 389, in  sage.rings.finite_rings.integer_mod.IntegerMod_abstract.__init__ (build/cythonized/sage/rings/finite_rings/integer_mod.c:6214)
  File "sage/rings/finite_rings/integer_mod.pyx", line 378, in sage.rings.finite_rings.integer_mod.IntegerMod_abstract.__init__ (build/cythonized/sage/rings/finite_rings/integer_mod.c:5963)
  File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218)
  File "sage/structure/coerce_maps.pyx", line 161, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4556)
  File "sage/structure/coerce_maps.pyx", line 156, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4448)
  File "sage/rings/integer.pyx", line 742, in sage.rings.integer.Integer.__init__ (build/cythonized/sage/rings/integer.c:6946)
TypeError: unable to coerce <class 'list'> to an integer

Is this intentional or a bug? (tested on SageMath version 9.0, Release Date: 2020-01-01 on Kubuntu 20.04)

2021-04-02 17:42:35 +0200 asked a question prime field element constructor does not accept lists of size one

prime field element constructor does not accept lists of size one Let p be prime. Elements of field = GF(p) can be c

2021-03-29 08:07:56 +0200 marked best answer large finite fields with modulus='primitive' do not satisfy equality

I found the following discrepancy

>>> q=2**152; GF(q) == GF(q), GF(q,'a',modulus='primitive') == GF(q,'a',modulus='primitive')
(True, False)
>>> q=2**151; GF(q) == GF(q), GF(q,'a',modulus='primitive') == GF(q,'a',modulus='primitive')
(True, True)

Is this intentional? and if yes why? It seems to happen within the same library:

>>> type(GF(2**152))
<class 'sage.rings.finite_rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e_with_category'>
>>> type(GF(2**151))
<class 'sage.rings.finite_rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e_with_category'>

(tested on SageMath version 9.0, Release Date: 2020-01-01 on Kubuntu 20.04 and SageMath version 9.2, Release Date: 2020-10-24 on Arch linux with kernel 5.11.2-arch1-1)

2021-03-29 08:07:56 +0200 received badge  Scholar (source)
2021-03-24 16:47:42 +0200 received badge  Student (source)
2021-03-24 14:39:56 +0200 asked a question large finite fields with modulus='primitive' do not satisfy equality

large finite fields with modulus='primitive' do not satisfy equality I found the following discrepancy >>> q=2