For questions about the functionality related to permutations in Mathematica.

learn more… | top users | synonyms

-3
votes
0answers
45 views

How to create all possible permutations of length 3 from a set 'A', with some conditions? [closed]

If we have a set A={a,b,c,d,e}, how to print all possible permutations of length 3, such that, "a" appears before "c", and "d" appears at most once.
0
votes
0answers
31 views

I have trouble in sorting a matrix in wolfram mathematica [duplicate]

I have an array of five elements, I have to make permutations of 3 elements. I have my code: A = {1, 2, 3, 4, 5}; n = Permutations[A, {3}]; Now I have to sort ...
-1
votes
0answers
35 views

Drop elements in Permutations [duplicate]

I have a problem with one excersise. I have a set of {x,y,z,w,u,t}. Then i want to print all possible permutations of the set with length 3 that commits this condition: element "u" not to occur after ...
0
votes
1answer
54 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 ...
3
votes
3answers
166 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 ...
-1
votes
0answers
52 views

Combinatorial exercise: Permutations in which a appears before c

i need to calculate something in Mathematica; We have the list A = {a,b,c,d,e} I need to find all permutations which will contain exactly 3 elements from A in which: a) element b appears only once ...
0
votes
1answer
115 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 ...
0
votes
0answers
115 views

Constructing and Reducing Tuples in a Memory Efficient Manner

This question is extension of a question I started here: Reduce the output from tuples by including symmetry? and will focus on higher order arrays and issues of optimization (similar to what I've ...
2
votes
3answers
146 views

How can I get from a list of characters representing a permutation to graphics showing the cycles?

I am trying to graphically represent cycles in various permutations of the alphabet, and have a question in two parts. I have ...
-1
votes
2answers
154 views

Want to compute the permutations of {1, 2, …, 11} with only 3 GB of memory [duplicate]

There is another way to calculate Permutations [{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}] without triggering an error, I have 3 GB of RAM with WIN 7 Edit: This ...
9
votes
2answers
377 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 ...
3
votes
1answer
81 views

How do I create a logical permutation expression automatically

How can I create a permutation automatically with logical expressions ? For example (2 logical variables): ...
2
votes
3answers
112 views

How to merge permutations obtained from Solve on multiple variables?

When I compute the following expression to find integer solutions of the equation (x^2 + y^2 + z^2 == 14^2) ...
5
votes
4answers
193 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 ...
0
votes
2answers
106 views

Finding permuations in a specific order

I would like to find the following permutations, but need an elegant way of computing it. Ideally I would like to have a variable determine the highest number in the last element and find all ...
3
votes
2answers
112 views

Generating permutations of at most 'n' elements, and where a specific subset of elements always appears

I often run into a situation where I'd like to generate a set of permutations with at most $n$ elements (here $n = 5$): ...
2
votes
2answers
111 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! = ...
0
votes
0answers
38 views

Permute indices of a large sparse array

I'm starting with a very large rank 3 tensor, F, that is stored as a SparseArray, and I need to permute its indices. I first tried using ArrayRules to get the positions of the non-zero elements, to ...
7
votes
5answers
986 views

Check if two lists are equal in any order

Suppose I have two lists, how can I efficiently check if the two lists are identical up to permutations of the elements? For example I would like the function to output: ...
8
votes
4answers
295 views

Using Permutations to create numbers

I'm a high school math teacher working on a simple high school math problem involving permutations. I like to try to check answers to some of these problems since it helps "convince" the students ...
5
votes
2answers
199 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. ...
2
votes
2answers
139 views

The i-th element of a permutation [duplicate]

I am trying to run something of the form ...
0
votes
0answers
50 views

Generate all strings of fixed length from an alphabet [duplicate]

I am trying to create all possible strings of length $8$ from the alphabet $\{+1,-1\}$. I am trying to get help from this question. But not sure where to start from. Any help?
2
votes
2answers
47 views

How to further process a 2 dimensional list created with tuples

I created with Tuples[{{USD, EUR, JPY}, {UP, DOWN}}] the following result: ...
1
vote
0answers
134 views

How to sequentially select, from a large set of tuples (of matrices), those with a certain property

I'm interested in finding a computationally efficient way for selecting all tuples of matrices which have a certain property. The property I'm interested in is that I want the column sum, of f[the ...
0
votes
1answer
67 views

Any command for group products?

Is there any Mathematica command or well known technique to take the direct product between two symmetric/permutation groups?
1
vote
2answers
146 views

Test if a list is a permutation of another list

This question may have a simple answer, but I can't find it anywhere in the documentation. I'm trying to find a function that tells me whether a list is a permutation of another list. So the function ...
2
votes
2answers
216 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 ...
2
votes
2answers
111 views

Counting the permuted forms of a list with repeated members under a permutation group

DeleteDuplicates[Permute[{g, g, g, g, g, e, r}, AlternatingGroup[7]]] How to count number of lists automatically?
3
votes
2answers
300 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 ...
7
votes
1answer
136 views

Equivalence under common permutations

I have lists which consists of sublists of equal length. The outer list is regarded as a multiset (that is, permutations of the sublists don't matter, but repetitions do), but the order in the ...
0
votes
2answers
75 views

How to obtain all the partitions in a set $A$ such that the union of these partitions equals $A$?

I'm trying to make a visual proof on the irrationality of $\sqrt{2}$. At the moment, I've created a figure to show that $b^2$ elements always constitute a square: And I want to show that it's not ...
0
votes
1answer
86 views

Why do Permute and PermutationReplace not invert one another? [closed]

Why do Permute and PermutationReplace not invert one another, as stated in the documentation? If we have an identity ...
1
vote
0answers
67 views

Challenge: Creating Compilable Permutations Function

As Mathematica's implemented Permuations function is not compilable I tried to write my very own Permutations implementation, called ...
0
votes
1answer
56 views

Error while transponsing a tensor [closed]

I am trying to execute following: TensorTranspose[Outer[D, metric, x], {2, 3}]. And Mathematica says me ...
1
vote
2answers
170 views

Permutations with restrictions

I have a problem that can be modeled as: there are 8 boxes in total, and 60 different items. I want to put all items into boxes (all of them can be put into a single box). Now I want to find: 1) ...
0
votes
1answer
58 views

Optimise CPU-intensive list combining function

I have a list of numbers list1 from which I want to create another list (list2) consisting of only those numbers that are equal ...
1
vote
1answer
77 views

How to get all permutation of k-partition

If I want to get the list of k-partition, and the rule are below: here are k partitions all elements of partition are in the range of 1 to 30. the total of ...
2
votes
1answer
259 views

Finding the optimal teams ranking based on the table of match results

My original question was this: So my task is to score all the possible rankings of the 14 SEC football teams and find the best one, using who won in head-to-head games as the sole criterion ...
0
votes
1answer
65 views

How to find all subsets which the total of elements is the same?

I want to find all subsets which the total of elements is the same. For example, Subsets[Range[30], {5}] means all 5-element subsets and the range of each element ...
6
votes
3answers
753 views

neighbor swapping distance between two strings

Updated Problem Description I have a collection of strings $S$ that only contain two (or $m$ in general) kinds of elements: in this case C and D. For all $s\in S$, the length is the same, the number ...
4
votes
3answers
166 views

Permutation count for sets with multiplicities

I am able to do a permutation counr for the set {a, a, b} which gives me 3 groups. I am happy with that result. However, if the set is ...
1
vote
0answers
197 views

Efficient submatrix swaps for large sparse matrix

I am implementing the 'swap' algorithm for a binary matrix to generate matrix permutations that maintain row and column totals. My problem is that my matrices are large and sparse (e.g., 19774 x 942, ...
5
votes
4answers
258 views

How to split a list with respect to its nested sublists?

I have a problem with the following task: having some nested list list = {{k6},{k1,k3,k5},{k7}} I would like to replace all sublists by their permutations and ...
12
votes
4answers
385 views

Equivalent Nested Loop Structure

Consider the following examples: ...
4
votes
2answers
152 views

Permutations: selecting reviewers without conflicts of interest

I would like to automate the process of selecting a number of proposal reviewers that fit a conflict of interest criterion. Let's say I have 5 reviewers and 5 applicants from 5 departments. The ...
1
vote
2answers
1k views

Create simple table with function of column values

I just want to create a simple table: Three input columns, one output column Call the inputs {x,y,z}, each can take values ...
0
votes
2answers
253 views

Replace Do loop with Nest

...
5
votes
4answers
443 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 ...
1
vote
1answer
207 views

Maximize over permutations

I have a set $S=\{s_1,\ldots,s_k\}$ and would like to maximize a fixed expression over permutations of $S$: $\max f(x_1,\ldots,x_k)$ with $x_i\in S$ and $x_i=x_j\Rightarrow i=j$. Is there a ...