Space of homomorphisms between two rings#

sage.rings.homset.RingHomset(R, S, category=None)#

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
class sage.rings.homset.RingHomset_generic(R, S, category=None)#

Bases: 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
Element#

alias of RingHomomorphism

has_coerce_map_from(x)#

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
natural_map()#

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()
Natural morphism:
  From: Integer Ring
  To:   Rational Field
zero()#

Return the zero element of this homset.

EXAMPLES:

Since a ring homomorphism maps 1 to 1, there can only be a zero morphism when mapping to the trivial ring:

sage: Hom(ZZ, Zmod(1)).zero()
Ring morphism:
  From: Integer Ring
  To:   Ring of integers modulo 1
  Defn: 1 |--> 0
sage: Hom(ZZ, Zmod(2)).zero()
Traceback (most recent call last):
...
ValueError: homset has no zero element
class sage.rings.homset.RingHomset_quo_ring(R, S, category=None)#

Bases: 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)                                           # needs sage.libs.singular
sage: phi = S.hom([b,a]); phi                                                   # needs sage.libs.singular
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)                                                                    # needs sage.libs.singular
b
sage: phi(b)                                                                    # needs sage.libs.singular
a
Element#

alias of RingHomomorphism_from_quotient

sage.rings.homset.is_RingHomset(H)#

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))                                                        # needs sage.rings.real_mpfr
True
sage: is_RH(Hom(FreeModule(ZZ,1), FreeModule(QQ,1)))                            # needs sage.modules
False