Re: [sage-support] How do I define a morphism/function/map of sets?

2016-04-18 Thread John H Palmieri
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]) >

Re: [sage-support] How do I define a morphism/function/map of sets?

2016-04-18 Thread Vincent Delecroix
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

[sage-support] How do I define a morphism/function/map of sets?

2016-04-18 Thread John H Palmieri
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)