For questions about the functionality related to permutations in Mathematica.

learn more… | top users | synonyms

3
votes
2answers
83 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 ...
1
vote
0answers
23 views

(Counting problem) very interesting Modular N algebraic eqs - for combinatorics experts [migrated]

We have some attempt to numerically solve this math problem, which means that we like to count the number of independent solutions of this set of six of modular N algebraic equations: $$ (1) x_1 ...
7
votes
1answer
73 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
50 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
57 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
42 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
40 views

Error while transponsing a tensor [closed]

I am trying to execute following: TensorTranspose[Outer[D, metric, x], {2, 3}]. And Mathematica says me ...
0
votes
2answers
116 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
49 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
45 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
130 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
53 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
218 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
107 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
107 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
218 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
337 views

Equivalent Nested Loop Structure

Consider the following examples: ...
4
votes
2answers
142 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
256 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
170 views

Replace Do loop with Nest

...
5
votes
4answers
197 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
136 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 ...
9
votes
6answers
390 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: ...
1
vote
2answers
169 views

Apply confusion in Do loop

I am trying to apply InversePermutation on a list of sublists of selected permutation elements. First I am trying to see if I am able to reach every element, ...
2
votes
1answer
97 views

PermuteSubgraph not working? (Combinatorica)

I am trying to write a code to perform the QAP partialling analysis (here's a paper to know more) but the part in which I "scramble" the graph with PermuteSubgraph does nothing, I am actually not ...
4
votes
2answers
133 views

How to enumerate multisets?

Given the eight-element set {1,2,3,4,5,6,7,8}, I would like to enumerate all multisets (subsets with repetition) of size n, ...
6
votes
2answers
267 views

Find all permutations with a condition

How can I find all the permutations of {a, b, c} where a + b + c = n? For instance: if ...
8
votes
3answers
257 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}] ...
9
votes
2answers
398 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 ...
9
votes
2answers
239 views

Combining nested lists that meet certain criteria for a permutation

I have the following list representing a permutation on 26 characters: ...
7
votes
0answers
224 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 ...
1
vote
1answer
206 views

How can I permute a multiset?

I have a multiset {1, 3, 3, 1, 2} and would like to randomly permute the classes like so: {2, 1, 1, 2, 3} or {3, 2, 2, 3, 1}, what is the simplest and most efficient way to do this? In reality the ...
8
votes
1answer
327 views

Mathematica function/package for shuffle permutations

Does anyone knows a way to compute a list of all (p,q)-shuffles in mathematica? For a definition of the shuffle permutations see for example http://ncatlab.org/nlab/show/shuffle I'm dreaming of a ...
2
votes
1answer
402 views

Adding rules to permutations

How can I calculate only those permutations of Range[n], that satisfy certain rules? I don't want to filter the result after calculating all the permutations but ...
8
votes
3answers
644 views

How to remove repeated permutations?

I want to get the Permutations on the elements of a list. Then I'm doing this: ...
7
votes
1answer
679 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 ...
9
votes
4answers
228 views

Efficient way to turn a subset into a permutation

For an input vector $\{a_1,a_2,\ldots,a_n,b_{1},b_2,\ldots,b_{m}\}$ and a list of ordered positions $\{k_1,k_2,\ldots, k_n\}$, such that $1\leqslant k_1 < k_2 < \ldots < k_n \leqslant ...