# Poor Man’s map¶

class sage.categories.poor_man_map.PoorManMap(function, domain=None, codomain=None, name=None)

A class for maps between sets which are not (yet) modeled by parents

Could possibly disappear when all combinatorial classes / enumerated sets will be parents

INPUT:

• function – a callable or an iterable of callables. This represents the underlying function used to implement this map. If it is an iterable, then the callables will be composed to implement this map.
• domain – the domain of this map or None if the domain is not known or should remain unspecified
• codomain – the codomain of this map or None if the codomain is not known or should remain unspecified
• name – a name for this map or None if this map has no particular name

EXAMPLES:

sage: from sage.categories.poor_man_map import PoorManMap
sage: f = PoorManMap(factorial, domain = (1, 2, 3), codomain = (1, 2, 6))
sage: f
A map from (1, 2, 3) to (1, 2, 6)
sage: f(3)
6


The composition of several functions can be created by passing in a tuple of functions:

sage: i = PoorManMap((factorial, sqrt), domain= (1, 4, 9), codomain = (1, 2, 6))


However, the same effect can also be achieved by just composing maps:

sage: g = PoorManMap(factorial, domain = (1, 2, 3), codomain = (1, 2, 6))
sage: h = PoorManMap(sqrt, domain = (1, 4, 9), codomain = (1, 2, 3))
sage: i == g*h
True

codomain()

Returns the codomain of self

EXAMPLES:

sage: from sage.categories.poor_man_map import PoorManMap
sage: PoorManMap(lambda x: x+1, domain = (1,2,3), codomain = (2,3,4)).codomain()
(2, 3, 4)

domain()

Returns the domain of self

EXAMPLES:

sage: from sage.categories.poor_man_map import PoorManMap
sage: PoorManMap(lambda x: x+1, domain = (1,2,3), codomain = (2,3,4)).domain()
(1, 2, 3)