Finite fields¶
- class sage.categories.finite_fields.FiniteFields(base_category)[source]¶
Bases:
CategoryWithAxiom_singletonThe category of finite fields.
EXAMPLES:
sage: K = FiniteFields(); K Category of finite enumerated fields
>>> from sage.all import * >>> K = FiniteFields(); K Category of finite enumerated fields
A finite field is a finite monoid with the structure of a field; it is currently assumed to be enumerated:
sage: K.super_categories() [Category of fields, Category of finite commutative rings, Category of finite enumerated sets]
>>> from sage.all import * >>> K.super_categories() [Category of fields, Category of finite commutative rings, Category of finite enumerated sets]
Some examples of membership testing and coercion:
sage: FiniteField(17) in K True sage: RationalField() in K False sage: K(RationalField()) Traceback (most recent call last): ... TypeError: unable to canonically associate a finite field to Rational Field
>>> from sage.all import * >>> FiniteField(Integer(17)) in K True >>> RationalField() in K False >>> K(RationalField()) Traceback (most recent call last): ... TypeError: unable to canonically associate a finite field to Rational Field
- class ParentMethods[source]¶
Bases:
object- is_perfect()[source]¶
Return whether this field is perfect, i.e., every element has a \(p\)-th root. Always returns
Truesince finite fields are perfect.EXAMPLES:
sage: GF(2).is_perfect() True
>>> from sage.all import * >>> GF(Integer(2)).is_perfect() True
- zeta(n=None)[source]¶
Return an element of multiplicative order
nin this finite field. If there is no such element, raiseValueError.Warning
In general, this returns an arbitrary element of the correct order. There are no compatibility guarantees:
F.zeta(9)^3may not be equal toF.zeta(3).EXAMPLES:
sage: k = GF(7) sage: k.zeta() 3 sage: k.zeta().multiplicative_order() 6 sage: k.zeta(3) 2 sage: k.zeta(3).multiplicative_order() 3 sage: k = GF(49, 'a') sage: k.zeta().multiplicative_order() 48 sage: k.zeta(6) 3 sage: k.zeta(5) Traceback (most recent call last): ... ValueError: no 5th root of unity in Finite Field in a of size 7^2
>>> from sage.all import * >>> k = GF(Integer(7)) >>> k.zeta() 3 >>> k.zeta().multiplicative_order() 6 >>> k.zeta(Integer(3)) 2 >>> k.zeta(Integer(3)).multiplicative_order() 3 >>> k = GF(Integer(49), 'a') >>> k.zeta().multiplicative_order() 48 >>> k.zeta(Integer(6)) 3 >>> k.zeta(Integer(5)) Traceback (most recent call last): ... ValueError: no 5th root of unity in Finite Field in a of size 7^2
Even more examples:
sage: GF(9,'a').zeta_order() 8 sage: GF(9,'a').zeta() a sage: GF(9,'a').zeta(4) a + 1 sage: GF(9,'a').zeta()^2 a + 1
>>> from sage.all import * >>> GF(Integer(9),'a').zeta_order() 8 >>> GF(Integer(9),'a').zeta() a >>> GF(Integer(9),'a').zeta(Integer(4)) a + 1 >>> GF(Integer(9),'a').zeta()**Integer(2) a + 1
This works even in very large finite fields, provided that
ncan be factored (see Issue #25203):sage: k.<a> = GF(2^2000) sage: p = 8877945148742945001146041439025147034098690503591013177336356694416517527310181938001 sage: z = k.zeta(p) sage: z a^1999 + a^1996 + a^1995 + a^1994 + ... + a^7 + a^5 + a^4 + 1 sage: z ^ p 1
>>> from sage.all import * >>> k = GF(Integer(2)**Integer(2000), names=('a',)); (a,) = k._first_ngens(1) >>> p = Integer(8877945148742945001146041439025147034098690503591013177336356694416517527310181938001) >>> z = k.zeta(p) >>> z a^1999 + a^1996 + a^1995 + a^1994 + ... + a^7 + a^5 + a^4 + 1 >>> z ** p 1
- zeta_order()[source]¶
Return the order of the distinguished root of unity in
self.EXAMPLES:
sage: GF(9,'a').zeta_order() 8 sage: GF(9,'a').zeta() a sage: GF(9,'a').zeta().multiplicative_order() 8
>>> from sage.all import * >>> GF(Integer(9),'a').zeta_order() 8 >>> GF(Integer(9),'a').zeta() a >>> GF(Integer(9),'a').zeta().multiplicative_order() 8