Ask Your Question
0

Where is the Inverse feature in FiniteSetMaps??

asked 2012-10-30 10:59:19 -0500

SLOtoSF gravatar image

Say I have defined a map f within the set of maps FiniteSetMaps....

It's great that I can do things like: f.domain(), f.codomain(), f.image_set(), f.getimage().

But how do I take the inverse? Is that feature not present? Is it in the roadmap?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-10-30 19:19:00 -0500

SLOtoSF gravatar image

I am posting this as what I'm using in the meanwhile, but ideally it would be a method attribute of the class. The fibers() method is quite helpful here. It gives a dictionary of preimages of each element. Since we have singletons we just pop() and we know it's the inverse element.

Obviously we would want to check for bijectivity here...

> def inverse(func):
>     dic = func.fibers()
>     for i in func.codomain():
>         dic[i] = set(dic[i]).pop()
>     return FiniteSetMaps(func.codomain(),func.domain()).from_dict(dic)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-10-30 10:59:19 -0500

Seen: 86 times

Last updated: Oct 30 '12