Questions tagged [permutation]
For questions about the functionality related to permutations in Mathematica.
273
questions
2
votes
1
answer
145
views
Permutations with inequalities constraint
In how many ways can I arrange the first $6$ positive integers such that this inequalities chain will hold?
$a < b > c < d < e > f$
One of these arrangements is $\{5, 6, 1, 2, 4, 3\}$, ...
1
vote
1
answer
67
views
Permutations of Dataset
I have data with missing values. I need all permutations which follow the two rules: Every year must be represented in each draw; and each draw must contain a minimum of two elements for each year. ...
4
votes
3
answers
343
views
Find all sets whose index is divisible by the elements
Suppose I have such a set $S=\{3,4,5,...n+2\}, n\in \mathbb{Z}_{>\, 0} $, $a_n$ is any permutation of $S$ such that $n|a_n$, I want to know how many such $a_n$. The easy but inefficient way to do ...
1
vote
1
answer
92
views
KSetPartitions function with fixed points
I'm trying to develop a function that computes some numerators for scattering amplitudes and I need to generate a collection of tree diagrams that contain a set of particles (effectively numbers) <...
8
votes
1
answer
460
views
Evaluating Pfaffian
The Pfaffian of an even-dimensional anti-symmetric matrix $A$ is defined as:
$$\mathrm{Pf}[A] = \frac{1}{2^{n}n!}\sum_{\pi\in S_{2n}}(-1)^{\pi}
a_{i_{1}i_{2}}a_{i_{3}i_{4}}\cdots a_{i_{2n-1}i_{2n}...
2
votes
1
answer
130
views
Accelerating sum over permutations of matrix elements
I am trying to short-cut the use of a CoefficientArrays call by manually calculating the resulting matrix of coefficients myself (this avoids using symbolic arrays ...
1
vote
2
answers
208
views
Generating Lyndon words modulo mirroring operation and substituion
I have two letters A,B. I want to generate all words say up to length 22 with the following properties. There is no "canonical" list so any such list will suffice, though there are many ...
4
votes
1
answer
146
views
17
votes
12
answers
4k
views
Fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from {a,b,c}
What is the fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from l={a,b,c}? I've tried
...
2
votes
1
answer
134
views
How to convert a PermutationGroup to a named group
We can convert any built-in named group into PermutationGroup by this code(such as AlternatingGroup[5]):
...
1
vote
0
answers
88
views
Find Max Instance Over Permutations
I would like to find the maximum of some objective function over all possible permutations
...
7
votes
3
answers
453
views
Is there a function to generate “subsets” allowing duplicates?
I allow them to be chosen more than once (e.g. allow {1,1}).
(A subset means every element is chosen once or less)
Also I neglect the order (e.g. ...
4
votes
3
answers
139
views
How to find the cycle type vector of a random permutation
Given a random permutation $\pi$ of {1,2,...,n}, I want to produce a list {a1,a2,...,an} of nonnegative integers so that ai is the number of cycles in $\pi$ of length i for each i=1,2,...,n. For ...
2
votes
1
answer
57
views
Range permutations, treating given runs of consecutive element as they were identical
Given a positive integer $n$ and a list of disjoint intervals in the form $\{\{i_1,i_1+1,i_1+2,\ldots,i_1+n_1\},\{i_2,i_2+1,i_2+2,\ldots i_2+n_2\},\ldots\}$ all contained in $[1,n]$, I want to ...
4
votes
3
answers
604
views
Generating signed permutation matrices
As most people (on here at least) know a permutation matrix is a square binary matrix that has exactly one entry of 1 in each row and each column and 0s elsewhere. For the $n \times n$ case there are $...