For questions about the functionality related to permutations in Mathematica.

learn more… | top users | synonyms

9
votes
2answers
530 views

How to represent a list as a cycle

I want to select distinct cycles (represented by List). The cycle {a, b, c, d} must be the same as {b, c, d, a} or ...
0
votes
1answer
104 views

Set conditions at a permutation

I need to find all permutations of 3 elements from {a,b,c,d,e} with this condition: These must include element d maximum once, and a must be before c. I'm using the following code and I don't know how ...
3
votes
3answers
163 views

Permutations on elements a>b && b>c

A={1, 2, 3, 4, 5} Permutations[A, {3}] I need to print all permutations where the first number is bigger than the second and the second number is bigger than the ...
9
votes
4answers
1k views

How to remove repeated permutations?

I want to get the Permutations on the elements of a list. Then I'm doing this: ...
9
votes
2answers
375 views

What is the fastest way to get the nth distinct permutation of a list?

What is the fastest way to write a function nthPermutation[xs_List, n_Integer] which is equivalent to Permutations[xs][[n]] but ...
8
votes
3answers
317 views

Reduce the output from tuples by including symmetry?

I need all the possible 3x3 binary tensors, but I'd like to have this account for symmetries. I've started by using the Tuples command. Tuples[{1, 0}, {3, 3}] ...
8
votes
0answers
254 views

Using Compile to speed up Function with PermutationProduct

I have the following fairly simple routine dot involving PermutationProduct that I wish to speed up using ...
10
votes
1answer
1k views

How to apply a permutation to a symmetric square matrix?

Given a symmetric square matrix, how can I apply a permutation to the rows and columns (i.e. the same permutation to both the rows and the columns) such a way that the new structure of the matrix ...
5
votes
4answers
192 views

Sort two lists at the same time, based on another

I am new to using Mathematica and I can not find a solution to what I am wanting to do. I want to take a list such as: x = {1,2,3,4,5,6,7,8} and a second list ...
5
votes
2answers
198 views

How to define even permutations correctly?

I define even permutations as following, but there may be some error. I use it in two different way and get different output. ...
5
votes
4answers
439 views

How can I generate permutations of bit strings with repetition?

How can I write a function which has two parameters and it should generate combination of arbitrary range bits, for example: function[n, k], with ...
2
votes
2answers
110 views

Generating a permutation of elements in chunks

Is there a way for me to generate a list of permutations in "chunks" such that I needn't store everything on RAM all at once? Consider that (WARNING: DO NOT RUN! --- Will generate a list with 13! = ...
2
votes
2answers
212 views

Permuting elements within a list

I have s = {2, 3, 5, 7, 1, 4, 6} (* always with diffente elements in {1,2....7}*) l = Length[s] n = 3 and n tells us that we ...
12
votes
4answers
385 views

Equivalent Nested Loop Structure

Consider the following examples: ...
9
votes
6answers
417 views

Performing Computations on Sets

I would like to find a permutation of $\quad S=\{\frac{1}{10}, \frac{1}{2}, \frac{4}{7}, \frac{3}{5}, \frac{2}{3} \}\quad$ that maximizes the sum of theses elements raised to unique powers: ...
3
votes
2answers
292 views

Need to create a function to generate all permutations of Range[$n$] [duplicate]

Basically I need a function that takes a list and gives all the possible permutations of it. The reason I can't use Permutations is that I have to apply another ...
0
votes
1answer
45 views

Permutation with a condition [duplicate]

I need to create a set A={“a”, “b”, “c”, “d” “e”} and print all the permutations of the set with lenght 3 that satisfy the condition:element "a" has to be ahead of "c" and "d" has to occur atleas ...