First time here? Check out the FAQ!

Ask Your Question
0

Where is the Inverse feature in FiniteSetMaps??

asked 12 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

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)
Preview: (hide)
link

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: 12 years ago

Seen: 283 times

Last updated: Oct 31 '12