AUTHORS:
Create the set of endomorphisms of X in the category category.
INPUT:
OUTPUT: a set of endomorphisms in category
EXAMPLES:
sage: V = VectorSpace(QQ, 3)
sage: End(V)
Set of Morphisms from Vector space of dimension 3 over Rational
Field to Vector space of dimension 3 over Rational Field in
Category of vector spaces over Rational Field
sage: G = AlternatingGroup(3)
sage: S = End(G); S
Set of Morphisms from AlternatingGroup(3) to AlternatingGroup(3) in Category of finite permutation groups
sage: from sage.categories.homset import is_Endset
sage: is_Endset(S)
True
sage: S.domain()
Alternating group of order 3!/2 as a permutation group
To avoid creating superfluous categories, homsets are in the homset category of the lowest category which currently says something specific about its homsets. For example, S is not in the category of hom sets of the category of groups:
sage: S.category()
Category of hom sets in Category of sets
sage: End(QQ).category()
Category of hom sets in Category of rings
Create the space of homomorphisms from X to Y in the category category.
INPUT:
OUTPUT: a homset in category
EXAMPLES:
sage: V = VectorSpace(QQ,3)
sage: Hom(V, V)
Set of Morphisms from Vector space of dimension 3 over Rational
Field to Vector space of dimension 3 over Rational Field in
Category of vector spaces over Rational Field
sage: G = AlternatingGroup(3)
sage: Hom(G, G)
Set of Morphisms from AlternatingGroup(3) to AlternatingGroup(3) in Category of finite permutation groups
sage: Hom(ZZ, QQ, Sets())
Set of Morphisms from Integer Ring to Rational Field in Category of sets
sage: Hom(FreeModule(ZZ,1), FreeModule(QQ,1))
Set of Morphisms from Ambient free module of rank 1 over the principal ideal domain Integer Ring to Vector space of dimension 1 over Rational Field in Category of modules with basis over Integer Ring
sage: Hom(FreeModule(QQ,1), FreeModule(ZZ,1))
Set of Morphisms from Vector space of dimension 1 over Rational Field to Ambient free module of rank 1 over the principal ideal domain Integer Ring in Category of vector spaces over Rational Field
TODO: design decision: how much of the homset comes from the category of X and Y, and how much from the specific X and Y. In particular, do we need several parent classes depending on X and Y, or does the difference only lie in the elements (i.e. the morphism), and of course how the parent calls their constructors.
Bases: sage.structure.parent.Set_generic
The class for collections of morphisms in a category.
EXAMPLES:
sage: H = Hom(QQ^2, QQ^3)
sage: loads(H.dumps()) == H
True
sage: E = End(AffineSpace(2, names='x,y'))
sage: loads(E.dumps()) == E
True
A base class for elements of this homset which are also SetMorphism, i.e. implemented by mean of a Python function.
This is currently plain SetMorphism, without inheritance from categories.
Todo: refactor during the upcoming homset cleanup.
EXAMPLES:
sage: H = Hom(ZZ, ZZ)
sage: H.element_class_set_morphism
<type 'sage.categories.morphism.SetMorphism'>
Return the category that this is a Hom in, i.e., this is typically the category of the domain or codomain object.
EXAMPLES:
sage: H = Hom(AlternatingGroup(4), AlternatingGroup(7))
sage: H.homset_category()
Category of finite permutation groups
Return the corresponding homset, but with the domain and codomain reversed.
EXAMPLES:
sage: H = Hom(ZZ^2, ZZ^3); H
Set of Morphisms from Ambient free module of rank 2 over the principal ideal domain Integer Ring to Ambient free module of rank 3 over the principal ideal domain Integer Ring in Category of modules with basis over Integer Ring
sage: type(H)
<class 'sage.modules.free_module_homspace.FreeModuleHomspace_with_category'>
sage: H.reversed()
Set of Morphisms from Ambient free module of rank 3 over the principal ideal domain Integer Ring to Ambient free module of rank 2 over the principal ideal domain Integer Ring in Category of hom sets in Category of modules with basis over Integer Ring
sage: type(H.reversed())
<class 'sage.modules.free_module_homspace.FreeModuleHomspace_with_category'>
Return End(X)(f), where f is data that defines an element of End(X).
EXAMPLES:
sage: R, x = PolynomialRing(QQ,'x').objgen()
sage: phi = end(R, [x + 1])
sage: phi
Ring endomorphism of Univariate Polynomial Ring in x over Rational Field
Defn: x |--> x + 1
sage: phi(x^2 + 5)
x^2 + 2*x + 6
Return Hom(X,Y)(f), where f is data that defines an element of Hom(X,Y).
EXAMPLES:
sage: R, x = PolynomialRing(QQ,'x').objgen()
sage: phi = hom(R, QQ, [2])
sage: phi(x^2 + 3)
7