4.9.1.1 FiniteField Objects

class FiniteField
FiniteField( )

Instances of class FiniteField have the following functions (in addition to inherited functions and special functions):

gen,$  $ is_field,$  $ is_finite,$  $ ngens,$  $ order,$  $ polynomial,$  $ polynomial_ring,$  $ prime_field,$  $ prime_subfield,$  $ random,$  $ unit_group_exponent,$  $ variable

Further documentation:

is_field( )

Returns whether or not the finite field is a field, i.e., always returns True.

sage: k = FiniteField(3**4)
sage: k.is_field()
True

ngens( )

The number of generators of the finite field. Always 1.

sage: k = FiniteField(3**4)
sage: k.ngens()
1

polynomial_ring( )

Returns the polynomial ring over the prime subfield in the same variable as this finite field.

sage: k = FiniteField(3**4, "alpha")
sage: k.polynomial_ring()
Univariate Polynomial Ring in alpha over Finite field of size 3

prime_field( )

Returns the prime subfield of this field.

sage: k = GF(9)
sage: k.prime_field()
Finite field of size 3

prime_subfield( )

Returns the prime subfield of this field.

sage: k = GF(9)
sage: k.prime_field()
Finite field of size 3

random( )

A random element of the finite field.

sage: k = GF(2**10)
sage: k.random()
a^9 + a

unit_group_exponent( )

The exponent of the unit group of the finite field. For a finite field, this is always the order minus 1.

sage: k = GF(2**10)
sage: k.order()
1024
sage: k.unit_group_exponent()
1023

Instances of class FiniteField also have the following special functions:

__cmp__,$  $ __contains__,$  $ __getitem__,$  $ __iter__

Further documentation:

__cmp__( other)

Compares this finite field with other. Two finite fields are equal if and only if they have the same cardinality *and* the defining polynomials are the same.

sage: FiniteField(3**2) == FiniteField(3**3)
False
sage: FiniteField(3**2) == FiniteField(3**2)
True
sage: FiniteField(3**2,'beta') == FiniteField(3**2,'alpha')
False
sage: FiniteField(3**2,'beta') == FiniteField(3**2,'beta')
True

__getitem__( n)

Returns the n-th element of the field. The elements of the field are $ a, a^2, a^3, \ldots , 0$ , where $ a$ is the generator for the multiplicative group returned by unit_gen().

sage: k = GF(8)
sage: k[0]
1
sage: k[1]
a
sage: k[7]
0

__iter__( )

Return iterator over elements of the finite field, ending with 0.

sage: k = GF(9)
sage: i = 0
sage: for x in k: print x, k[i]; i+= 1
1 1
a a
a + 1 a + 1
2*a + 1 2*a + 1
2 2
2*a 2*a
2*a + 2 2*a + 2
a + 2 a + 2
0 0

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