Construct a space of homomorphisms between the rings R and S.
For more on homsets, see Hom().
EXAMPLES:
sage: Hom(ZZ, QQ) # indirect doctest
Set of Homomorphisms from Integer Ring to Rational Field
Bases: sage.categories.homset.HomsetWithBase
A generic space of homomorphisms between two rings.
EXAMPLES:
sage: Hom(ZZ, QQ)
Set of Homomorphisms from Integer Ring to Rational Field
sage: QQ.Hom(ZZ)
Set of Homomorphisms from Rational Field to Integer Ring
The default for coercion maps between ring homomorphism spaces is very restrictive (until more implementation work is done).
Currently this checks if the domains and the codomains are equal.
EXAMPLES:
sage: H = Hom(ZZ, QQ)
sage: H2 = Hom(QQ, ZZ)
sage: H.has_coerce_map_from(H2)
False
Returns the natural map from the domain to the codomain.
The natural map is the coercion map from the domain ring to the codomain ring.
EXAMPLES:
sage: H = Hom(ZZ, QQ)
sage: H.natural_map()
Ring Coercion morphism:
From: Integer Ring
To: Rational Field
Bases: sage.rings.homset.RingHomset_generic
Space of ring homomorphisms where the domain is a (formal) quotient ring.
EXAMPLES:
sage: R.<x,y> = PolynomialRing(QQ, 2)
sage: S.<a,b> = R.quotient(x^2 + y^2)
sage: phi = S.hom([b,a]); phi
Ring endomorphism of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2)
Defn: a |--> b
b |--> a
sage: phi(a)
b
sage: phi(b)
a
TESTS:
We test pickling of a homset from a quotient.
sage: R.<x,y> = PolynomialRing(QQ, 2)
sage: S.<a,b> = R.quotient(x^2 + y^2)
sage: H = S.Hom(R)
sage: H == loads(dumps(H))
True
We test pickling of actual homomorphisms in a quotient:
sage: phi = S.hom([b,a])
sage: phi == loads(dumps(phi))
True
Return True if H is a space of homomorphisms between two rings.
EXAMPLES:
sage: from sage.rings.homset import is_RingHomset as is_RH
sage: is_RH(Hom(ZZ, QQ))
True
sage: is_RH(ZZ)
False
sage: is_RH(Hom(RR, CC))
True
sage: is_RH(Hom(FreeModule(ZZ,1), FreeModule(QQ,1)))
False