Thanks, FiniteSetMaps might be what I want, but I'll keep both approaches
in mind.
John
On Monday, April 18, 2016 at 3:51:27 PM UTC-7, vdelecroix wrote:
>
> I read the end of your mail too late. The following works with lambda
> functions.
>
> sage: S = FiniteEnumeratedSet([1,2,3])
>
I read the end of your mail too late. The following works with lambda
functions.
sage: S = FiniteEnumeratedSet([1,2,3])
sage: T = FiniteEnumeratedSet([4,5,6,7])
sage: d = {1:5, 2:7, 3:5}
sage: f = S.hom(lambda x: d[x], T)
sage: f(1)
5
sage: f(2)
7
sage: f(3)
5
Otherwise you should have a look
How do I define a function between finite sets within the category
framework? Should the following work?
sage: S = Set([1,2,3])
sage: T = Set([4,5,6,7])
sage: f = S.hom(lambda x: 3+x, T)
sage: f
Generic morphism:
From: {1, 2, 3}
To: {4, 5, 6, 7}
sage: f(2)