Module: sage.rings.morphism
We give a large number of examples of ring homomorphisms.
Natural inclusion
.
sage: H = Hom(ZZ, QQ) sage: phi = H([1]) sage: phi(10) 10 sage: phi(3/1) 3 sage: phi(2/3) Traceback (most recent call last): ... TypeError: 2/3 must be coercible into Integer Ring
There is no homomorphism in the other direction:
sage: H = Hom(QQ, ZZ) sage: H([1]) Traceback (most recent call last): ... TypeError: images (=[1]) do not define a valid homomorphism
Reduction to finite field.
sage: H = Hom(ZZ, GF(9)) sage: phi = H([1]) sage: phi(5) 2 sage: psi = H([4]) sage: psi(5) 2
Map from single variable polynomial ring.
sage: R, x = PolynomialRing(ZZ, 'x').objgen() sage: phi = R.hom([2], GF(5)) sage: phi Ring morphism: From: Univariate Polynomial Ring in x over Integer Ring To: Finite Field of size 5 Defn: x |--> 2 sage: phi(x + 12) 4
Identity map on the real numbers.
sage: f = RR.hom([RR(1)]); f Ring endomorphism of Real Field with 53 bits of precision Defn: 1.0000000000000000 |--> 1.0000000000000000 sage: f(2.5) 2.5000000000000000 sage: f = RR.hom( [2.0] ) Traceback (most recent call last): ... TypeError: images (=[2.0000000000000000]) do not define a valid homomorphism
Homomorphism from one precision of field to another.
From smaller to bigger doesn't make sense:
sage: R200 = RealField(200) sage: f = RR.hom( R200 ) Traceback (most recent call last): ... TypeError: Natural coercion morphism from Real Field with 53 bits of precision to Real Field with 200 bits of precision not defined.
From bigger to small does:
sage: f = RR.hom( RealField(5) ) sage: f(2.5) 2.50 sage: f(RR.pi()) 3.12
Inclusion map from the reals to the complexes:
sage: i = RR.hom([CC(1)]); i Ring morphism: From: Real Field with 53 bits of precision To: Complex Field with 53 bits of precision Defn: 1.0000000000000000 |--> 1.0000000000000000 sage: i(RR('3.1')) 3.1000000000000001
A map from a multivariate polynomial ring to itself:
sage: R, (x,y,z) = PolynomialRing(QQ, 3, 'xyz').objgens() sage: phi = R.hom([y,z,x^2]); phi Ring endomorphism of Polynomial Ring in x, y, z over Rational Field Defn: x |--> y y |--> z z |--> x^2 sage: phi(x+y+z) z + y + x^2
An endomorphism of a quotient of a multi-variate polynomial ring:
sage: R, (x,y) = PolynomialRing(Q, 2, 'xy').objgens() sage: S, (a,b) = (R/(1 + y^2)).objgens('ab') sage: phi = S.hom([a^2, -b]) sage: phi Ring endomorphism of Quotient of Polynomial Ring in x, y over Rational Field by the ideal (1 + y^2) Defn: a |--> a^2 b |--> -1*b sage: phi(b) -1*b sage: phi(a^2 + b^2) -1 + a^4
The reduction map from the integers to the integers modulo 8, viewed as a quotient ring:
sage: R = Z/(8*Z) sage: pi = R.cover() sage: pi Ring morphism: From: Integer Ring To: Ring of integers modulo 8 Defn: Natural quotient map sage: pi.domain() Integer Ring sage: pi.codomain() Ring of integers modulo 8 sage: pi(10) 2 sage: pi.lift() Set-theoretic ring morphism: From: Ring of integers modulo 8 To: Integer Ring Defn: Choice of lifting map sage: pi.lift(13) 5
Inclusion of GF(2) into GF(4).
sage: k = GF(2) sage: i = k.hom(GF(4)) sage: i Coercion morphism: From: Finite Field of size 2 To: Finite Field in a of size 2^2 sage: i(0) 0 sage: a = i(1); a.parent() Finite Field in a of size 2^2
We next compose the inclusion with reduction from the integers to GF(2).
sage: pi = ZZ.hom(k) sage: pi Coercion morphism: From: Integer Ring To: Finite Field of size 2 sage: f = i * pi sage: f Composite morphism: From: Integer Ring To: Finite Field in a of size 2^2 Defn: Coercion morphism: From: Integer Ring To: Finite Field of size 2 then Coercion morphism: From: Finite Field of size 2 To: Finite Field in a of size 2^2 sage: a = f(5); a 1 sage: a.parent() Finite Field in a of size 2^2
Inclusion from
to the 3-adic field.
sage: phi = Q.hom(pAdicField(3)) sage: phi Coercion morphism: From: Rational Field To: 3-adic Field sage: phi.codomain() 3-adic Field sage: phi(394) 1 + 2*3 + 3^2 + 2*3^3 + 3^4 + 3^5 + O(3^Infinity)
An automorphism of a quotient of a univariate polynomial ring.
sage: R, x = PolynomialRing(QQ).objgen() sage: S, sqrt2 = (R/(x^2-2)).objgen('sqrt2') sage: sqrt2^2 2 sage: (3+sqrt2)^10 993054*sqrt2 + 1404491 sage: c = S.hom([-sqrt2]) sage: c(1+sqrt2) -sqrt2 + 1
Note that SAGE verifies that the morphism is valid:
sage: (1 - sqrt2)^2 -2*sqrt2 + 3 sage: c = S.hom([1-sqrt2]) # this is not valid Traceback (most recent call last): ... TypeError: images (=[-sqrt2 + 1]) do not define a valid homomorphism
Endomorphism of power series ring.
sage: R, t = PowerSeriesRing(Q, 't').objgen() sage: R Power Series Ring in t over Rational Field sage: f = R.hom([t^2]); f Ring endomorphism of Power Series Ring in t over Rational Field Defn: t |--> t^2 sage: R.set_default_prec(10) sage: s = 1/(1 + t); s 1 - t + t^2 - t^3 + t^4 - t^5 + t^6 - t^7 + t^8 - t^9 + O(t^10) sage: f(s) 1 - t^2 + t^4 - t^6 + t^8 - t^10 + t^12 - t^14 + t^16 - t^18 + O(t^20)
Frobenious on a power series ring over a finite field.
sage: R, t = PowerSeriesRing(GF(5), 't').objgen() sage: f = R.hom([t^5]); f Ring endomorphism of Power Series Ring in t over Finite Field of size 5 Defn: t |--> t^5 sage: a = 2 + t + 3*t^2 + 4*t^3 + O(t^4) sage: b = 1 + t + 2*t^2 + t^3 + O(t^5) sage: f(a) 2 + t^5 + 3*t^10 + 4*t^15 + O(t^20) sage: f(b) 1 + t^5 + 2*t^10 + t^15 + O(t^25) sage: f(a*b) 2 + 3*t^5 + 3*t^10 + t^15 + O(t^20) sage: f(a)*f(b) 2 + 3*t^5 + 3*t^10 + t^15 + O(t^20)
Homomorphism of Laurent series ring.
sage: R, t = LaurentSeriesRing(Q, 't').objgen() sage: f = R.hom([t^3 + t]); f Ring endomorphism of Laurent Series Ring in t over Rational Field Defn: t |--> t + t^3 sage: R.set_default_prec(10) sage: s = 2/t^2 + 1/(1 + t); s 2*t^-2 + 1 - t + t^2 - t^3 + t^4 - t^5 + t^6 - t^7 + t^8 - t^9 + O(t^10) sage: f(s) 2*t^-2 - 3 - t + 7*t^2 - 2*t^3 - 5*t^4 - 4*t^5 + 16*t^6 + O(t^7) sage: f = R.hom([t^3]); f Ring endomorphism of Laurent Series Ring in t over Rational Field Defn: t |--> t^3 sage: f(s) 2*t^-6 + 1 - t^3 + t^6 - t^9 + t^12 - t^15 + t^18 + O(t^21) sage: s = 2/t^2 + 1/(1 + t); s 2*t^-2 + 1 - t + t^2 - t^3 + t^4 - t^5 + t^6 - t^7 + t^8 - t^9 + O(t^10) sage: f(s) 2*t^-6 + 1 - t^3 + t^6 - t^9 + t^12 - t^15 + t^18 + O(t^21)
Note that the homomorphism must result in a converging Laurent series, so the valuation of the image of the generator must be positive:
sage: R.hom([1/t]) Traceback (most recent call last): ... TypeError: images (=[t^-1]) do not define a valid homomorphism sage: R.hom([1]) Traceback (most recent call last): ... TypeError: images (=[1]) do not define a valid homomorphism
Complex conjugation on cyclotomic fields.
sage: K, z = CyclotomicField(7).objgen() sage: c = K.hom([1/z]); c Ring endomorphism of Cyclotomic Field of order 7 and degree 6 Defn: zeta7 |--> -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - zeta7 - 1 sage: a = (1+z)^5; a zeta7^5 + 5*zeta7^4 + 10*zeta7^3 + 10*zeta7^2 + 5*zeta7 + 1 sage: c(a) 5*zeta7^5 + 5*zeta7^4 - 4*zeta7^2 - 5*zeta7 - 4 sage: c(z + 1/z) # obviously fixed by inversion -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1 sage: z + 1/z -zeta7^5 - zeta7^4 - zeta7^3 - zeta7^2 - 1
Embedding a number field into the reals.
sage: x = PolynomialRing(QQ).gen() sage: K, a = NumberField(x^3 - 2, 'a').objgen() sage: alpha = RR(2)^(1/3); alpha 1.2599210498948732 sage: i = K.hom([alpha]); i Ring morphism: From: Number Field in a with defining polynomial x^3 - 2 To: Real Field with 53 bits of precision Defn: a |--> 1.2599210498948732 sage: i(a) 1.2599210498948732 sage: i(a^3) 2.0000000000000000 sage: i(a^2+1) 2.5874010519681994
Module-level Functions
phi) |
Class: RingHomomorphism
self, parent) |
Functions: inverse_image,
lift
self, I) |
Return the inverse image of the ideal
under this ring
homomorphism.
self, [x=None]) |
Return a lifting homomorphism associated to this homomorphism, if it has been defined.
If x is not None, return the value of the lift morphism on x.
Special Functions: _repr_type,
_set_lift
Class: RingHomomorphism_coercion
Class: RingHomomorphism_cover
sage: R, (x,y) = PolynomialRing(Q, 2, 'xy').objgens() sage: S, (a,b) = (R/(x^2 + y^2)).objgens('ab') sage: phi = S.cover(); phi Ring morphism: From: Polynomial Ring in x, y over Rational Field To: Quotient of Polynomial Ring in x, y over Rational Field by the ideal (y^2 + x^2) Defn: Natural quotient map sage: phi(x+y) b + a
self, ring, quotient_ring) |
Functions: kernel
Special Functions: _call_,
_repr_defn
Class: RingHomomorphism_from_quotient
INPUT: parent - a ring homset Hom(R,S) phi - a ring homomorphism C -> S, where C is the domain of R.cover() OUTPUT: a ring homomorphism
The domain
is a quotient object
, and
R.cover()
is the ring homomorphism
. The
condition on the elements
im_gens
of
is that they
define a homomorphism
such that each generator of the
kernel of
maps to 0
.
sage: R, (x, y, z) = PolynomialRing(Q, 3, 'xyz').objgens() sage: S, (a, b, c) = (R/(x^3 + y^3 + z^3)).objgens('abc') sage: phi = S.hom([b, c, a]); phi Ring endomorphism of Quotient of Polynomial Ring in x, y, z over Rational Field by the ideal (z^3 + y^3 + x^3) Defn: a |--> b b |--> c c |--> a sage: phi(a+b+c) c + b + a
Validity of the homomorphism is determined, when possible, and a TypeError is raised if there is no homomorphism sending the generators to the given images.
sage: S.hom([b^2, c^2, a^2]) Traceback (most recent call last): ... TypeError: images (=[b^2, c^2, a^2]) do not define a valid homomorphism
self, parent, phi) |
Functions: morphism_from_cover
Special Functions: _call_,
_repr_defn
Class: RingHomomorphism_im_gens
self, parent, im_gens, [check=True]) |
Functions: im_gens
Special Functions: _call_,
_repr_defn
Class: RingMap
self, parent) |
Special Functions: __call__,
_repr_type
Class: RingMap_lift
x.lift()
is an element that naturally coerces to x.lift()
.
sage: R, (x,y) = PolynomialRing(Q, 2, 'xy').objgens() sage: S = R/(x^2 + y^2, y) sage: S.lift() Set-theoretic ring morphism: From: Quotient of Polynomial Ring in x, y over Rational Field by the ideal (y, y^2 + x^2) To: Polynomial Ring in x, y over Rational Field Defn: Choice of lifting map
self, R, S) |
Special Functions: _call_,
_repr_defn
See About this document... for information on suggesting changes.