[GAP Forum] Permutation of n objects taken r at a time
Erik Postma
e.j.postma+gap at gmail.com
Tue Apr 21 13:54:57 BST 2009
Hi Levi,
What you're looking for is called an *ordered tuple* in GAP; it's
described in chapter 17 of the reference manual, which you can find
here: http://www.gap-system.org/Manuals/doc/htm/ref/CHAP017.htm. You
could get the result you're looking for by asking for
myTuples := Tuples(2cyc, 3);;
This will compute all tuples at once, which is still easily feasible
for these particular parameters; if you expect to have to deal with a
*really* large number of tuples where memory size may be a constraint,
I'd recommend generating the tuples yourself, on the fly, and
processing them one by one.
Erik.
2009/4/21 Levie Bicua <lee_bkua at yahoo.com>:
> Dear GAP forum,
> Suppose I wish to get the list of all permutations of n objects taken r at a time
> where repetition of elements is allowed? For example from the set
> S:=[(1,2), (1,3),(2,3)] , If I will get the permutations of the 3 elements taken 2 at a time with repetition I obtain
> T:=[[(1,2),(1,2)], [(1,3),(1,3)], [(2,3),(2,3)], [(1,2),(1,3)], [(1,3),(1,2)], [(1,3),(2,3)], [(2,3),(1,3)], [(1,2),(2,3)], [(2,3), (1,2)]].
> I intend to do this for the set
> 2cyc:=[(),(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5),(1,2)(3,4),(1,3)(2,4),(1,4)(2,3),
> (1,2)(3,5),(1,3)(2,5),(1,5)(2,3),(1,2)(4,5),(1,4)(2,5),(1,5)(2,4),(2,3)(4,5),(2,4)(3,5),(2,5)(3,4),
> (1,3)(4,5),(1,4)(3,5),(1,5)(3,4)] with r = 3.
> Is there any way GAP can do this especially for a larger set? thanks.
>
> Levi
>
>
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>
More information about the Forum
mailing list