Finite Extension Fields implemented via PARI POLMODs (deprecated)¶
AUTHORS:
- William Stein: initial version
- Jeroen Demeyer (2010-12-16): fix formatting of docstrings (trac ticket #10487)
-
class
sage.rings.finite_rings.finite_field_ext_pari.
FiniteField_ext_pari
(q, name, modulus=None)¶ Bases:
sage.rings.finite_rings.finite_field_base.FiniteField
Finite Field of order
, where
is a prime power (not a prime), implemented using PARI
POLMOD
. This implementation is the default implementation for.
INPUT:
q
– integer, size of the finite field, not primename
– variable name used for printing elements of the finite fieldmodulus
– an irreducible polynomial to construct this field.
OUTPUT:
A finite field of order
with the given variable name
EXAMPLES:
sage: P.<x> = PolynomialRing(GF(3)) sage: from sage.rings.finite_rings.finite_field_ext_pari import FiniteField_ext_pari sage: k = FiniteField_ext_pari(9, 'a', modulus=(x^2 + 2*x + 2)) doctest:...: DeprecationWarning: The "pari_mod" finite field implementation is deprecated See http://trac.sagemath.org/17297 for details. sage: k Finite Field in a of size 3^2 sage: k.is_field() True sage: k.characteristic() 3 sage: a = k.gen() sage: a a sage: a.parent() Finite Field in a of size 3^2 sage: a.charpoly('x') x^2 + 2*x + 2 sage: [a^i for i in range(8)] [1, a, a + 1, 2*a + 1, 2, 2*a, 2*a + 2, a + 2]
Fields can be coerced into sets or list and iterated over:
sage: list(k) [0, 1, 2, a, a + 1, a + 2, 2*a, 2*a + 1, 2*a + 2]
The following is a native Python set:
sage: set(k) {0, 1, 2, a, 2*a, a + 1, 2*a + 1, a + 2, 2*a + 2}
And the following is a Sage set:
sage: Set(k) {0, 1, 2, a, a + 1, a + 2, 2*a, 2*a + 1, 2*a + 2} We can also make a list via comprehension: sage: [x for x in k] [0, 1, 2, a, a + 1, a + 2, 2*a, 2*a + 1, 2*a + 2]
Next we compute with the finite field of order 16, where the name is named
b
:sage: P.<x> = PolynomialRing(GF(2)) sage: from sage.rings.finite_rings.finite_field_ext_pari import FiniteField_ext_pari sage: k16 = FiniteField_ext_pari(16, "b", modulus=(x^4 + x + 1)) sage: z = k16.gen() sage: z b sage: z.charpoly('x') x^4 + x + 1 sage: k16.is_field() True sage: k16.characteristic() 2 sage: z.multiplicative_order() 15
Of course one can also make prime finite fields:
sage: k = FiniteField(7)
Note that the generator is 1:
sage: k.gen() 1 sage: k.gen().multiplicative_order() 1
Prime finite fields are implemented elsewhere, they cannot be constructed using
FiniteField_ext_pari
:sage: k = FiniteField_ext_pari(7, 'a', modulus=polygen(GF(7))) Traceback (most recent call last): ... ValueError: The size of the finite field must not be prime.
Illustration of dumping and loading:
sage: K = FiniteField(7) sage: loads(K.dumps()) == K True sage: K = FiniteField(7^10, 'b', impl='pari_mod') doctest:...: DeprecationWarning: The "pari_mod" finite field implementation is deprecated See http://trac.sagemath.org/17297 for details. sage: loads(K.dumps()) == K True sage: K = FiniteField(7^10, 'a', impl='pari_mod') sage: loads(K.dumps()) == K True
In this example
is large enough that Conway polynomials are not used. Note that when the field is dumped the defining polynomial
is also dumped. Since
is determined by a random algorithm, it’s important that
is dumped as part of
. If you quit Sage and restart and remake a finite field of the same order (and the order is large enough so that there is no Conway polynomial), then defining polynomial is probably different. However, if you load a previously saved field, that will have the same defining polynomial.
sage: K = GF(10007^10, 'a', impl='pari_mod') sage: loads(K.dumps()) == K True
Note
We do NOT yet define natural consistent inclusion maps between different finite fields.
-
characteristic
()¶ Returns the characteristic of the finite field, which is a prime number.
EXAMPLES:
sage: k = FiniteField(3^4, 'a', impl='pari_mod') sage: k.characteristic() 3
-
degree
()¶ Returns the degree of the finite field, which is a positive integer.
EXAMPLES:
sage: FiniteField(3^20, 'a', impl='pari_mod').degree() 20
-
gen
(n=0)¶ Return a generator of
self
over its prime field, which is a root ofself.modulus()
.INPUT:
n
– must be 0
OUTPUT:
An element
of
self
such thatself.modulus()(a) == 0
.Warning
This generator is not guaranteed to be a generator for the multiplicative group. To obtain the latter, use
multiplicative_generator()
or use themodulus="primitive"
option when constructing the field.EXAMPLES:
sage: FiniteField(2^4, "b", impl='pari_mod').gen() b sage: k = FiniteField(3^4, "alpha", impl='pari_mod') sage: a = k.gen() sage: a alpha sage: a^4 alpha^3 + 1
-
order
()¶ The number of elements of the finite field.
EXAMPLES:
sage: k = FiniteField(2^10, 'a', impl='pari_mod') sage: k Finite Field in a of size 2^10 sage: k.order() 1024