diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index 8da5d0bdbba..b7bbd417273 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -24,6 +24,8 @@ Construction of an embedding:: sage: f(t) # random T^20 + 2*T^18 + T^16 + 2*T^13 + T^9 + 2*T^8 + T^7 + T^6 + T^5 + T^3 + 2*T^2 + T + sage: f(t) == f.im_gens()[0] + True The map `f` has a method ``section`` which returns a partially defined map which is the inverse of `f` on the image of `f`:: @@ -33,8 +35,9 @@ map which is the inverse of `f` on the image of `f`:: From: Finite Field in t of size 3^7 To: Finite Field in T of size 3^21 Defn: t |--> T^20 + 2*T^18 + T^16 + 2*T^13 + T^9 + 2*T^8 + T^7 + T^6 + T^5 + T^3 + 2*T^2 + T - sage: g(f(t^3+t^2+1)) - t^3 + t^2 + 1 + sage: a = k.random_element() + sage: g(f(a)) == a + True sage: g(T) Traceback (most recent call last): ... @@ -130,8 +133,9 @@ cdef class SectionFiniteFieldHomomorphism_generic(Section): sage: K. = GF(3^21) sage: f = FiniteFieldHomomorphism_generic(Hom(k, K)) sage: g = f.section() - sage: g(f(t^3+t^2+1)) - t^3 + t^2 + 1 + sage: a = k.random_element() + sage: g(f(a)) == a + True sage: g(T) Traceback (most recent call last): @@ -207,6 +211,10 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): From: Finite Field in t of size 3^7 To: Finite Field in T of size 3^21 Defn: t |--> T^20 + 2*T^18 + T^16 + 2*T^13 + T^9 + 2*T^8 + T^7 + T^6 + T^5 + T^3 + 2*T^2 + T + sage: a = k.random_element() + sage: b = k.random_element() + sage: f(a) + f(b) == f(a + b) + True sage: k. = GF(3^6) sage: K. = GF(3^9) @@ -373,8 +381,10 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): From: Finite Field in t of size 3^7 To: Finite Field in T of size 3^21 Defn: t |--> T^20 + 2*T^18 + T^16 + 2*T^13 + T^9 + 2*T^8 + T^7 + T^6 + T^5 + T^3 + 2*T^2 + T - sage: g(f(t^3+t^2+1)) - t^3 + t^2 + 1 + sage: a = k.random_element() + sage: b = k.random_element() + sage: g(f(a) + f(b)) == a + b + True sage: g(T) Traceback (most recent call last): ... @@ -421,7 +431,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): sage: k. = GF(5^3) sage: Frob = k.frobenius_endomorphism() sage: embed = Frob.fixed_field()[1] - sage: hash(embed) # random + sage: hash(embed) # random -2441354824160407762 """ return Morphism.__hash__(self) @@ -760,6 +770,8 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): sage: tfixed = kfixed.gen() sage: embed(tfixed) # random 4*t^5 + 2*t^4 + 4*t^2 + t + sage: embed(tfixed) == embed.im_gens()[0] + True """ if self._degree_fixed == 1: k = FiniteField(self.domain().characteristic()) diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx index 078c1f57a41..eebd20056e7 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx @@ -64,6 +64,10 @@ cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_ From: Finite Field in t of size 3^2 To: Finite Field in T of size 3^4 Defn: t |--> 2*T^3 + 2*T^2 + 1 + sage: a = k.random_element() + sage: b = k.random_element() + sage: g(f(a) + f(b)) == g(f(a)) + g(f(b)) == a + b + True """ if not isinstance(inverse, FiniteFieldHomomorphism_givaro): raise TypeError("The given map is not an instance of FiniteFieldHomomorphism_givaro") @@ -145,6 +149,10 @@ cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic): From: Finite Field in t of size 3^2 To: Finite Field in T of size 3^4 Defn: t |--> 2*T^3 + 2*T^2 + 1 + sage: a = k.random_element() + sage: b = k.random_element() + sage: f(a) + f(b) == f(a + b) + True sage: k. = GF(3^10) sage: K. = GF(3^20) @@ -184,6 +192,8 @@ cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic): sage: f = FiniteFieldHomomorphism_givaro(Hom(k, K)) sage: f(t) # random 2*T^3 + 2*T^2 + 1 + sage: f(t) == f.im_gens()[0] + True """ if x.parent() != self.domain(): raise TypeError("%s is not in %s" % (x, self.domain()))