4.8.1 rings.finite_field - A finite field

The module rings.finite_field defines the following classes:

class FiniteField

class FiniteField_ext_pari
Finite field of order q, where q is a nontrivial prime power. (Implemented using PARI mod's.)

Create with the command FiniteField(modulus)

INPUT: q - int, prime power, order of the finite field OUTPUT: FiniteField - finite field of order q.

sage: k = FiniteField(9)
sage: k
Finite field 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 of size 3^2
sage: a.charpoly()
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)
[1, a, a + 1, 2*a + 1, 2, 2*a, 2*a + 2, a + 2, 0]
sage: set(k)
set([a, 2*a + 1, a + 2, a + 1, 0, 1, 2*a + 2, 2, 2*a])
sage: [x for x in k]
[1, a, a + 1, 2*a + 1, 2, 2*a, 2*a + 2, a + 2, 0]

Next we compute with the finite field of order 16, where the variable is named b.

sage: k16 = FiniteField(16, "b")
sage: z = k16.gen()
sage: z
b
sage: z.charpoly()
x^4 + x + 1
sage: k16.is_field()
True
sage: k16.characteristic() 
2
sage: z.order()
15

Of course one can also make prime finite fields.

sage: k = FiniteField(7)

Note that the generator is a primitive root of unity.

sage: k.gen()
3
sage: k.gen().order()
6

class FiniteField_prime_modn

The module rings.finite_field defines the following methods:

conway_polynomial( p, n)

Return the Conway polynomial of degree n over GF(p), which is loaded from a table.

If the requested polynomial is not known, this function raises a RuntimeError exception.

INPUT:
    p -- int
    n -- int
    
OUTPUT:
    Polynomial -- a polynomial over the prime finite field
GF(p).

NOTE: The first time this function is called a table is read from disk, which takes a fraction of a second. Subsequent calls do not require reloading the table.

See also the ConwayPolynomials() object, which is a table of Conway polynomials. For example, if c=ConwayPolynomials, then c.primes() is a list of all primes for which the polynomials are known, and for a given prime p, c.degree(p) is a list of all degrees for which the Conway polynomials are known.

sage: conway_polynomial(2,5)
x^5 + x^2 + 1
sage: conway_polynomial(101,5)
x^5 + 2*x + 99
sage: conway_polynomial(97,101)
Traceback (most recent call last):
...
RuntimeError: Conway polynomial over F_97 of degree 101 not in
database.

exists_conway_polynomial( p, n)

Return True if the Conway polynomial over F_p of degree n is in the database and False otherwise.

If the Conway polynomial is in the database, to obtain it use the command conway_polynomial(p,n).

sage: exists_conway_polynomial(2,3)
True
sage: exists_conway_polynomial(2,-1)
False
sage: exists_conway_polynomial(97,200)
False
sage: exists_conway_polynomial(6,6)
False



Subsections
See About this document... for information on suggesting changes.