Message Boards Message Boards

2 Replies
0 Total Likes
View groups...
Share this post:

Finding if two systems match

Posted 10 years ago


I'm am very new to Mathematica. I would like to use it to first solve a simple problem.

I have two sets containing set of elements of constant size (say 5 elements). For example: Set 1 : {{ 1,2,3,4,5}, { 2,3,4,5,6}, { 1,4,5,6,7}} Set 2 : {{ 2,3,4,5,8}, { 1,2,4,5,6}, { 2,3,5,6,8}}

I want to know if there exists a permutation of elements from 1 to 8 (in that example) that maps Set 1 to Set 2 ? Sometimes the answer is yes, sometimes it is no.

I am not interested in this permutation if it exists. Only the answer to the question matters to me.

Can someone give me hints for doing this with Mathematica ?

Thank you.

POSTED BY: montardon
2 Replies
Posted 10 years ago


POSTED BY: Bill Simpson
Posted 10 years ago

Since you asked for hints, I am not going to blurt out the answer.

Look at the documentation for Permutations. That is probably a key part of this.

Look at the documentation for Rule. Mathematica uses Rule to do transformations and that might be very helpful.

If you can figure out how to do that then you might be able to see if Set1 and Set2 are the same after having transformed Set1 (or Set2)..

After you can test this with one of them then you might start thinking about doing this test on all of them. It might a little too advanced for a very new user, but there are functions like Map and MapThread that might be very helpful.

If you can do all that then you may get a long list of False,False,False,True,False... or maybe it would be False,False,False... Look up the documentation for Apply. That might let you use the Or function to get your answer.

If you get stuck, there are lots of things for a very new user to learn to be able to assemble all this, then describe what kind and how small a hint is needed to get you to be able to figure out the next step in the learning process.

It is often very helpful to try out ideas on small example cases to see how they work before throwing everything together and hoping it all works.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract