Message Boards Message Boards

0
|
5546 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Any built function for this permutation?

Posted 9 years ago

Hi All, I am looking for a built function in Mathematica for this kind of permutation.. Any idea?

In[9]:= list = Table[i, {i, 1, 3}]

Out[9]= {1, 2, 3}

In[10]:= Flatten[
 Table[{list[[i]], list[[j]], list[[k]]}, {i, Length@list}, {j, 
   Length@list}, {k, Length@list}], 2]

Out[10]= {{1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 2, 1}, {1, 2, 2}, {1, 
  2, 3}, {1, 3, 1}, {1, 3, 2}, {1, 3, 3}, {2, 1, 1}, {2, 1, 2}, {2, 1,
   3}, {2, 2, 1}, {2, 2, 2}, {2, 2, 3}, {2, 3, 1}, {2, 3, 2}, {2, 3, 
  3}, {3, 1, 1}, {3, 1, 2}, {3, 1, 3}, {3, 2, 1}, {3, 2, 2}, {3, 2, 
  3}, {3, 3, 1}, {3, 3, 2}, {3, 3, 3}}
POSTED BY: Okkes Dulgerci
2 Replies
Posted 9 years ago

Thanks!!

POSTED BY: Okkes Dulgerci
Posted 9 years ago

Try this

g = Range[3];
Tuples[g, 3]

And the output is

{{1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 2, 1}, {1, 2, 2}, {1, 2, 3}, {1,
   3, 1}, {1, 3, 2}, {1, 3, 3}, {2, 1, 1}, {2, 1, 2}, {2, 1, 3}, {2, 
  2, 1}, {2, 2, 2}, {2, 2, 3}, {2, 3, 1}, {2, 3, 2}, {2, 3, 3}, {3, 1,
   1}, {3, 1, 2}, {3, 1, 3}, {3, 2, 1}, {3, 2, 2}, {3, 2, 3}, {3, 3, 
  1}, {3, 3, 2}, {3, 3, 3}}

I hope tihs help you.

POSTED BY: Luis Ledesma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract