6.7.1.2 FiniteField_generic Objects

class FiniteField_generic
FiniteField_generic( )

Instances of class FiniteField_generic have the following methods (in addition to inherited methods and special methods):

gen,$  $ is_field,$  $ is_finite,$  $ ngens,$  $ order,$  $ polynomial,$  $ polynomial_ring,$  $ random_element,$  $ unit_group_exponent,$  $ vector_space

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

random_element( [bound=None])

A random element of the finite field.

INPUT:
    bound -- ignored

sage: k = GF(2**10, 'a')
sage: k.random_element()
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_generic also have the following special methods:

__cmp__,$  $ __getitem__,$  $ __iter__,$  $ _latex_

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 $ n$ -th element of the field. There is no guarantee regarding how the elements of the field are ordered.

sage: k = GF(8, 'a')
sage: k[0]
0
sage: k[1]
1
sage: k[7]
a^2 + a + 1

__iter__( )

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

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

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