Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error generating finite field

I have the following error while creating finite fields:

sage: F1.<x> = GF(2**8, modulus=x^8 + x^6 + x^5 + x^4 + x^3 + x + 1)
sage: F2.<x> = GF(2**8, modulus=x^8 + x^4 + x^3 + x^2 + 1)
ValueError                                Traceback (most recent call last)
<ipython-input-2-bb7f80049a89> in <module>
----> 1 F2 = GF(Integer(2)**Integer(8), modulus=x**Integer(8) + x**Integer(4) + x**Integer(3) + x**Integer(2) + Integer(1),   

    names=('x',)); (x,) = F2._first_ngens(1)

~/software/sage/local/lib/python3.8/site-packages/sage/structure/factory.pyx in sage.structure.factory.UniqueFactory.__call__ (build/cythonized/sage/structure/factory.c:2179)()
    365             False
    366         """
--> 367         key, kwds = self.create_key_and_extra_args(*args, **kwds)
    368         version = self.get_version(sage_version)
    369         return self.get_object(version, key, kwds)

~/software/sage/local/lib/python3.8/site-packages/sage/rings/finite_rings/finite_field_constructor.py in create_key_and_extra_args(self, order, name, modulus, names, impl, proof, check_irreducible, prefix, repr, elem_cache, **kwds)
    585 
    586                     if modulus.degree() != n:
--> 587                         raise ValueError("the degree of the modulus does not equal the degree of the field")
    588                     if check_irreducible and not modulus.is_irreducible():
    589                         raise ValueError("finite field modulus must be irreducible but it is not")

ValueError: the degree of the modulus does not equal the degree of the field

This is annoying when you attach a script, the error happens each time you change the file. It does not happen if the variable name is different that the variable used in the modulus expression. For example:

sage: F1.<a> = GF(2**8, modulus=x^8 + x^6 + x^5 + x^4 + x^3 + x + 1)
sage: F2.<b> = GF(2**8, modulus=x^8 + x^4 + x^3 + x^2 + 1)

Is there a reason for this behavior ?