Space of homomorphisms between two rings#

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

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
>>> from sage.all import *
>>> Hom(ZZ, QQ) # indirect doctest
Set of Homomorphisms from Integer Ring to Rational Field
class sage.rings.homset.RingHomset_generic(R, S, category=None)[source]#

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
>>> from sage.all import *
>>> Hom(ZZ, QQ)
Set of Homomorphisms from Integer Ring to Rational Field
>>> QQ.Hom(ZZ)
Set of Homomorphisms from Rational Field to Integer Ring
Element[source]#

alias of RingHomomorphism

has_coerce_map_from(x)[source]#

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
>>> from sage.all import *
>>> H = Hom(ZZ, QQ)
>>> H2 = Hom(QQ, ZZ)
>>> H.has_coerce_map_from(H2)
False
natural_map()[source]#

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
>>> from sage.all import *
>>> H = Hom(ZZ, QQ)
>>> H.natural_map()
Natural morphism:
  From: Integer Ring
  To:   Rational Field
zero()[source]#

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
>>> from sage.all import *
>>> Hom(ZZ, Zmod(Integer(1))).zero()
Ring morphism:
  From: Integer Ring
  To:   Ring of integers modulo 1
  Defn: 1 |--> 0
>>> Hom(ZZ, Zmod(Integer(2))).zero()
Traceback (most recent call last):
...
ValueError: homset has no zero element
class sage.rings.homset.RingHomset_quo_ring(R, S, category=None)[source]#

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
>>> from sage.all import *
>>> R = PolynomialRing(QQ, Integer(2), names=('x', 'y',)); (x, y,) = R._first_ngens(2)
>>> S = R.quotient(x**Integer(2) + y**Integer(2), names=('a', 'b',)); (a, b,) = S._first_ngens(2)# needs sage.libs.singular
>>> 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
>>> phi(a)                                                                    # needs sage.libs.singular
b
>>> phi(b)                                                                    # needs sage.libs.singular
a
Element[source]#

alias of RingHomomorphism_from_quotient

sage.rings.homset.is_RingHomset(H)[source]#

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))
doctest:warning...
DeprecationWarning: the function is_RingHomset is deprecated;
use 'isinstance(..., RingHomset_generic)' instead
See https://github.com/sagemath/sage/issues/37922 for details.
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
>>> from sage.all import *
>>> from sage.rings.homset import is_RingHomset as is_RH
>>> is_RH(Hom(ZZ, QQ))
doctest:warning...
DeprecationWarning: the function is_RingHomset is deprecated;
use 'isinstance(..., RingHomset_generic)' instead
See https://github.com/sagemath/sage/issues/37922 for details.
True
>>> is_RH(ZZ)
False
>>> is_RH(Hom(RR, CC))                                                        # needs sage.rings.real_mpfr
True
>>> is_RH(Hom(FreeModule(ZZ,Integer(1)), FreeModule(QQ,Integer(1))))                            # needs sage.modules
False