Finite prime fields#
AUTHORS:
William Stein: initial version
Martin Albrecht (2008-01): refactoring
- class sage.rings.finite_rings.finite_field_prime_modn.FiniteField_prime_modn(p, check=True, modulus=None)[source]#
Bases:
FiniteField
,IntegerModRing_generic
Finite field of order \(p\) where \(p\) is prime.
EXAMPLES:
sage: FiniteField(3) Finite Field of size 3 sage: FiniteField(next_prime(1000)) # needs sage.rings.finite_rings Finite Field of size 1009
>>> from sage.all import * >>> FiniteField(Integer(3)) Finite Field of size 3 >>> FiniteField(next_prime(Integer(1000))) # needs sage.rings.finite_rings Finite Field of size 1009
- characteristic()[source]#
Return the characteristic of code{self}.
EXAMPLES:
sage: k = GF(7) sage: k.characteristic() 7
>>> from sage.all import * >>> k = GF(Integer(7)) >>> k.characteristic() 7
- construction()[source]#
Returns the construction of this finite field (for use by sage.categories.pushout)
EXAMPLES:
sage: GF(3).construction() (QuotientFunctor, Integer Ring)
>>> from sage.all import * >>> GF(Integer(3)).construction() (QuotientFunctor, Integer Ring)
- degree()[source]#
Return the degree of
self
over its prime field.This always returns 1.
EXAMPLES:
sage: FiniteField(3).degree() 1
>>> from sage.all import * >>> FiniteField(Integer(3)).degree() 1
- gen(n=0)[source]#
Return a generator of
self
over its prime field, which is a root ofself.modulus()
.Unless a custom modulus was given when constructing this prime field, this returns \(1\).
INPUT:
n
– must be 0
OUTPUT:
An element \(a\) of
self
such thatself.modulus()(a) == 0
.Warning
This generator is not guaranteed to be a generator for the multiplicative group. To obtain the latter, use
multiplicative_generator()
or use themodulus="primitive"
option when constructing the field.EXAMPLES:
sage: k = GF(13) sage: k.gen() 1 sage: # needs sage.rings.finite_rings sage: k = GF(1009, modulus="primitive") sage: k.gen() # this gives a primitive element 11 sage: k.gen(1) Traceback (most recent call last): ... IndexError: only one generator
>>> from sage.all import * >>> k = GF(Integer(13)) >>> k.gen() 1 >>> # needs sage.rings.finite_rings >>> k = GF(Integer(1009), modulus="primitive") >>> k.gen() # this gives a primitive element 11 >>> k.gen(Integer(1)) Traceback (most recent call last): ... IndexError: only one generator
- is_prime_field()[source]#
Return
True
since this is a prime field.EXAMPLES:
sage: k.<a> = GF(3) sage: k.is_prime_field() True sage: # needs sage.rings.finite_rings sage: k.<a> = GF(3^2) sage: k.is_prime_field() False
>>> from sage.all import * >>> k = GF(Integer(3), names=('a',)); (a,) = k._first_ngens(1) >>> k.is_prime_field() True >>> # needs sage.rings.finite_rings >>> k = GF(Integer(3)**Integer(2), names=('a',)); (a,) = k._first_ngens(1) >>> k.is_prime_field() False