Home | Trees | Index | Help |
|
---|
Package sage :: Package rings :: Module finite_field :: Class FiniteField |
|
Gens
--+ |Ring
--+ |object
--+ | | |_uniqFiniteField
--+ | FiniteField
Finite field of order q, where q is a prime power. Create with the command FiniteField(modulus) INPUT: q -- int, prime power, order of the finite field OUTPUT: FiniteField -- finite field of order q. EXAMPLES: >>> k = FiniteField(9) >>> k Finite field of size 3^2 >>> k.is_field() True >>> k.characteristic() 3 >>> a = k.gen() >>> a a >>> a.parent() Finite field of size 3^2 >>> a.charpoly() x^2 + x + 2 >>> [a**i for i in range(8)] [1, a, 2*a + 1, 2*a + 2, 2, 2*a, a + 2, a + 1] Fields can be coerced into sets or list and iterated over: >>> list(k) [1, a, 2*a + 1, 2*a + 2, 2, 2*a, a + 2, a + 1, 0] >>> set(k) set([a, 2*a + 1, a + 2, a + 1, 0, 1, 2*a + 2, 2, 2*a]) >>> for x in k: print x," ", 1 a 2*a + 1 2*a + 2 2 2*a a + 2 a + 1 0 Next we compute with the finite field of order 16, where the variable is named b. >>> k16 = FiniteField(16, "b") >>> z = k16.gen() >>> z b >>> z.charpoly() x^4 + x + 1 >>> k16.is_field() True >>> k16.characteristic() 2 >>> z.order() 15 Of course one can also make prime finite fields. >>> k = FiniteField(7) >>> k.gen() 3 >>> k.gen().order() 6
Method Summary | |
---|---|
Create finite field of order q with variable var. | |
Coerce x into the finite field. | |
Compares this finite field with other. | |
__contains__(self,
x)
| |
Returns the n-th element of the field. | |
Return iterator over elements of the finite field, ending with 0. | |
The number of elements of the finite field. | |
__repr__(self)
| |
Returns the characteristic of the finite field, which is a prime int. | |
Returns the degree of the finite field, which is a positive integer. | |
Return chosen generator of the finite field. | |
Returns whether or not the finite field is a field, i.e., always returns True. | |
Return the modulus of this finite field, i.e., the polynomial f(x) so elements of the finite field as elements modulo f. | |
Short description string that determines the finite field. | |
The number of generators of the finite field. | |
The number of elements of the finite field. | |
Return the modulus of this finite field, i.e., the polynomial f(x) so elements of the finite field as elements modulo f. | |
Returns the polynomial ring over the prime subfield in the same variable as this finite field. | |
Returns the prime subfield of this field. | |
Returns the prime subfield of this field. | |
A random element of the finite field. | |
The exponent of the unit group of the finite field. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from Ring | |
True if the elements have atomic string representations, in the sense that they print if they print at s, then -s means the negative of s. | |
| |
Inherited from Gens | |
| |
| |
| |
|
Instance Method Details |
---|
__init__(self,
q,
var='a')
|
__call__(self,
x)
|
__cmp__(self,
other)
|
__getitem__(self,
n)
|
__iter__(self)Return iterator over elements of the finite field, ending with 0. EXAMPLES:>>> k = GF(9) >>> i = 0 >>> 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 |
__len__(self)
|
characteristic(self)Returns the characteristic of the finite field, which is a prime int. EXAMPLES:>>> k = FiniteField(3**4) >>> k.characteristic() 3
|
degree(self)Returns the degree of the finite field, which is a positive integer. EXAMPLES:>>> FiniteField(3).degree() 1 >>> FiniteField(3**20).degree() 20 |
gen(self, n=0)Return chosen generator of the finite field. This generator is a root of the defining polynomial of the finite field, and is guaranteed to be a generator for the multiplicative group. INPUT: nothing OUTPUT: FiniteFieldElement -- field generator of finite field EXAMPLES: >>> FiniteField(2**4, "b").gen() b >>> k = FiniteField(3**4, "alpha") >>> a = k.gen() >>> a alpha >>> a**4 2*alpha + 1 |
is_field(self)Returns whether or not the finite field is a field, i.e., always returns True. EXAMPLES:>>> k = FiniteField(3**4) >>> k.is_field() True
|
modulus(self)Return the modulus of this finite field, i.e., the polynomial f(x) so elements of the finite field as elements modulo f. EXAMPLES:>>> k = FiniteField(17) >>> k.modulus() x + 14 >>> k = FiniteField(9) >>> k.modulus() x^2 + 2*x + 2 |
name(self)Short description string that determines the finite field. EXAMPLES:>>> FiniteField(3**4).name() 'GF3_4'
|
ngens(self)The number of generators of the finite field. Always 1. EXAMPLES:>>> k = FiniteField(3**4) >>> k.ngens() 1 |
order(self)The number of elements of the finite field. EXAMPLES:>>> k = GF(2**10) >>> k Finite field of size 2^10 >>> k.order() 1024 |
polynomial(self)Return the modulus of this finite field, i.e., the polynomial f(x) so elements of the finite field as elements modulo f. EXAMPLES:>>> k = FiniteField(17) >>> k.modulus() x + 14 >>> k = FiniteField(9) >>> k.modulus() x^2 + 2*x + 2 |
polynomial_ring(self)Returns the polynomial ring over the prime subfield in the same variable as this finite field. EXAMPLES:>>> k = FiniteField(3**4, "alpha") >>> k.polynomial_ring() Univariate Polynomial Ring in alpha over Finite field of size 3 |
prime_field(self)Returns the prime subfield of this field. EXAMPLES:>>> k = GF(9) >>> k.prime_field() Finite field of size 3 |
prime_subfield(self)Returns the prime subfield of this field. EXAMPLES:>>> k = GF(9) >>> k.prime_field() Finite field of size 3 |
random(self)A random element of the finite field. EXAMPLES: >> k = GF(2**10) >> k.random() a^9 + a |
unit_group_exponent(self)The exponent of the unit group of the finite field. For a finite field, this is always the order minus 1. EXAMPLES:>>> k = GF(2**10) >>> k.order() 1024 >>> k.unit_group_exponent() 1023 |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon May 9 17:57:02 2005 | http://epydoc.sf.net |