Finite fields implemented via PARI’s FFELT type

AUTHORS:

  • Peter Bruin (June 2013): initial version, based on finite_field_ext_pari.py by William Stein et al.
class sage.rings.finite_rings.finite_field_pari_ffelt.FiniteField_pari_ffelt(p, modulus, name=None)

Bases: sage.rings.finite_rings.finite_field_base.FiniteField

Finite fields whose cardinality is a prime power (not a prime), implemented using PARI’s FFELT type.

INPUT:

  • p – prime number
  • modulus – an irreducible polynomial of degree at least 2 over the field of \(p\) elements
  • name – string: name of the distinguished generator (default: variable name of modulus)

OUTPUT:

A finite field of order \(q = p^n\), generated by a distinguished element with minimal polynomial modulus. Elements are represented as polynomials in name of degree less than \(n\).

Note

  • Direct construction of FiniteField_pari_ffelt objects requires specifying a characteristic and a modulus. To construct a finite field by specifying a cardinality and an algorithm for finding an irreducible polynomial, use the FiniteField constructor with impl='pari_ffelt'.
  • Two finite fields are considered equal if and only if they have the same cardinality, variable name, and modulus.

EXAMPLES:

Some computations with a finite field of order 9:

sage: k = FiniteField(9, 'a', impl='pari_ffelt')
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]
sage: TestSuite(k).run()

Next we compute with a finite field of order 16:

sage: k16 = FiniteField(16, 'b', impl='pari_ffelt')
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

Illustration of dumping and loading:

sage: K = FiniteField(7^10, 'b', impl='pari_ffelt')
sage: loads(K.dumps()) == K
True

sage: K = FiniteField(10007^10, 'a', impl='pari_ffelt')
sage: loads(K.dumps()) == K
True
Element

alias of FiniteFieldElement_pari_ffelt

characteristic()

Return the characteristic of self.

EXAMPLE:

sage: F = FiniteField(3^4, 'a', impl='pari_ffelt')
sage: F.characteristic()
3
degree()

Returns the degree of self over its prime field.

EXAMPLE:

sage: F = FiniteField(3^20, 'a', impl='pari_ffelt')
sage: F.degree()
20
gen(n=0)

Return a generator of the finite field.

INPUT:

  • n – ignored

OUTPUT:

A generator of the finite field.

This generator is a root of the defining polynomial of the finite field.

Warning

This generator is not guaranteed to be a generator for the multiplicative group. To obtain the latter, use multiplicative_generator().

EXAMPLE:

sage: R.<x> = PolynomialRing(GF(2))
sage: FiniteField(2^4, 'b', impl='pari_ffelt').gen()
b
sage: k = FiniteField(3^4, 'alpha', impl='pari_ffelt')
sage: a = k.gen()
sage: a
alpha
sage: a^4
alpha^3 + 1
order()

The number of elements of the finite field.

EXAMPLE:

sage: k = FiniteField(2^10, 'a', impl='pari_ffelt')
sage: k
Finite Field in a of size 2^10
sage: k.order()
1024
polynomial()

Return the minimal polynomial of the generator of self in self.polynomial_ring().

EXAMPLES:

sage: F = FiniteField(3^2, 'a', impl='pari_ffelt')
sage: F.polynomial()
a^2 + 2*a + 2

sage: F = FiniteField(7^20, 'a', impl='pari_ffelt')
sage: f = F.polynomial(); f
a^20 + a^12 + 6*a^11 + 2*a^10 + 5*a^9 + 2*a^8 + 3*a^7 + a^6 + 3*a^5 + 3*a^3 + a + 3
sage: f(F.gen())
0

Previous topic

Finite Fields of Characteristic 2

Next topic

Finite Prime Fields

This Page