Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

For questions about the functionality related to permutations in Mathematica.

2
votes
0answers
64 views

How do I iterate through all permutations of a list? [on hold]

I need to generate all permutation of a list of integers, but doing so (the list has around 60 elements, is not practical. Is there a way to iterate through all permutations of a list, without first ...
0
votes
1answer
51 views

Given a data set, how to do the following

Please help in executing the following problem in Mathematica: I have the following set:$A=\{1, 2,3,4,5,6,7,8,9,10\}$ (my actual data has more than 10 points). I need to do the following three steps: ...
4
votes
1answer
40 views

How to determine computationally the set of linear independent permutations of a tensor with known symmetries?

I have a tensor $t$ with components $t_{i_1 i_2 \dots i_n}$. The tensor $t$ has some index symmetries $\{s_i\}_{i=1}^m$. Consider now all index permutations $p = \{\{1,2,3,\dots,n\},\{2,1,3,\dots,n\},\...
-1
votes
1answer
47 views

Given the permutation, permute the indices a function

How can we permute the indices of a function? Like in my case I have the permutation of three indices and I am using this code but it isn't working. I have to permute the indices of a. Thanks in ...
9
votes
4answers
287 views

How to generate all involutive permutations?

Take a finite set $S$ (i.e., a list). An involutive permutation is one that squares to the identity. How can we generate all such permutations efficiently, that is, without generating all permutations ...
1
vote
0answers
31 views

Generating list of binomial outcomes [closed]

As an example, imagine if I have a set of 3 coins and I want to generate a list of possible coin states. I know I can brutishly execute: ...
4
votes
2answers
142 views

Scramble matrix under some condition

Assume I have a matrix. (mat = Partition[Range@9, 3]) // MatrixForm mat$=\left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & ...
2
votes
0answers
63 views

Permutations of times that an element appear in a list [duplicate]

I have a list: lis={{a,b},{b,b},{a,a}} This could be a list of types of something, 3 types: the type {a,b}, the type {b,b} and the type {a,a}.Then, I have ten ...
1
vote
1answer
43 views

Permute a list of elements given a pattern

I have this function f and a pattern pattern = f[h[x]]f[h[y]] where h is a generic ...
1
vote
1answer
128 views

Group table for permutation group

I have got a permutation group: $(\{(e,((1, 4),(2,6),(3,5)),((1, 6),(2,5),(3,4)),((1, 5),(2,4),(3,6)),((1, 3,2),(4,6,5)),((1,2,3),(4,5,6)),((1, 4),(2,5),(3,6)),((1, 3),(4,6)),((2, 3),(5,6)),((1, 2),(...
0
votes
1answer
74 views

Sum over permuted and unpermuted indices

I would like to write a code to evaluate the following (up to $N=20$) $\sum_{s_1,...,s_N=\pm 1;s_1 \cdot \cdot \cdot s_N=1}\sum_{\sigma\in S_N}\prod_{i=1}^N x_{\sigma(i)}^{s_i \lambda_i}$ There are ...
2
votes
0answers
30 views

Apply all possible permutations into a function [duplicate]

I need to create a function that returns all possible trebles of integers that sum up to a given number. For example, is n=2 then I need something like this: ...
4
votes
2answers
86 views

Improve quality of my code to generating list

I need to write a function that constructs a set of certain permutations of a list of an even number of entries. Below, you can see my program that gives the correct result. ...
6
votes
3answers
532 views

Programming challenge: restricted Permutations

I need to generate the set of all inequivalent permutations for a collection of objects of the form {symbol, integer}. Here is an example collection from which I ...
5
votes
1answer
578 views

Combinations of two lists of lists

I have two sets set1 = {2, 3, 4, 5}; set2 = {1, 3, 4, 5}; and I make permutations of them: ...
0
votes
0answers
46 views

How to rename the output in operations?

The problem is the following, i have 23 Cycles, every cycle have a name: ...
2
votes
1answer
76 views

Sort list but keeping the number of swaps required

I have a set of lists that I want to put into ordered form, but I need to know how many swaps are required to put them into order - these are indexes for minors of a determinant, so each swap gives a ...
5
votes
3answers
257 views

making sub list from a list

I have a list ...
2
votes
1answer
68 views

Sorting of permutations

I would like to output the list of possible permutations of 4 indices but sorted in a certain way. I know that I can the list of possible permutations with ...
5
votes
3answers
263 views

List of the combinations of more lists via permutations

I would like to generate a list of all the possible combinations of two lists. As for instance, given L=3; list={0,1,2}; I would like to obtain the list {{0,...
2
votes
2answers
81 views

Find all permutations with a condition (part 2) [closed]

This question (21008) asks to find all permutations of {a, b, c} subject to a + b + c = n. The answer was provided by Dr. ...
2
votes
2answers
162 views

Sum over permuted indices

Consider this rank 6 tensor: $g_{ab}g_{cd}g_{ef}$. Now I'd like to have a code to sum over all possible $6!$ permutations of the six indices with some coefficient $f[i]$, where $1 \leq i \leq 720$... ...
3
votes
2answers
112 views

How can I output list of permutation products?

I have A = Permutations[{1, 2, 3, 4}]. And c = Cycles[{{1, 2, 3, 4}}]. And I need to output for all $a \in A: a \cdot с \cdot a^{...
17
votes
5answers
1k views

Delete duplicates from list of lists as if on a necklace

Given a list of lists of integers, all of the same length, I want to regard two elements as equivalent if one is the rotated and/or reflected version of another (that is, if the two lists are the same ...
2
votes
2answers
90 views

All Possibilities to skip up to n numbers between a range of numbers

I want to get every possibility to skip up to n numbers between a range of numbers from 0 to m+n-1, whereby m is a self-chosen number. The length of the list should stay constant and should always ...
15
votes
7answers
839 views

Permutations of nested parentheses (Dyck words)

How would I construct a function that outputs Dyck Words? e.g. - there are 14 words in $\mathcal{D}_{8}$: ...
29
votes
9answers
2k views

Faster derangements?

I wonder what is the fastest method to generate derangements? Both the Combinatorica function and Martin Ender's answer to Permutations of lists of fixed even numbers are based on filtering the ...
10
votes
3answers
448 views

Permutations of lists of fixed even numbers

Let's say we have this list list={3,6,5,21,23,76,1,28,96,54,77} I would like to know the number of permutations when every even number stays where it is and ...
2
votes
1answer
110 views

Calculating partial binary `Permutations`

I would like MMA to only calculate some of the permutations of a set. I am currently doing something along the lines of ...
5
votes
4answers
218 views

Construct a list from another list

Given a list, lst, of length 2n, I want to construct a new one that results from the exchange of the fist half of lst with the ...
6
votes
3answers
143 views

dictionary lookups of words composed of specified characters

I am trying to find all English words composed of specified characters. For example, all words composed of one or more of the following: ...
7
votes
3answers
1k views

List all possible license plate numbers

The length of license plate numbers is 6, with 2 letters and 4 numbers. The first two characters are letters and the last four are numbers. Example: AA1234. This is the code I have so far: ...
5
votes
3answers
247 views

Duplicate Permutations with Tuples

Permutations without repetition (in Italian: simple dispositions) Permutations[{a, b, c, d}, {3}] or ...
1
vote
1answer
122 views

Print all permutations containing exactly k elements

In Wolfram Mathematica, writing: Permutations[{a, b, c, d}] or writing: Permutations[{a, b, c, d}, {4}] I get: ...
-1
votes
1answer
82 views

Print to video permutations [closed]

You want to print vectors with $n$ elements, where: the first element can have the values: $e1.1, \, e1.2, \, e1.3$; the second element can assume the values: $e2.1, \, e2.2, \, e2.3$; ...; ...; the $...
10
votes
2answers
285 views

Conditional permutation of combining multiple lists

Let's say I have two lists: l1={1,2} l2={a,b} I want to find legal permutations of combining these two list in a way that the ordering of the members of each ...
2
votes
1answer
262 views

Connectivity in a molecule and permutations

What am I trying to do is to make a script that calculates all chemically reasonable torsion angles in any molecule. For one torsional angle I need 4 CONNECTED atoms, 1-2-3-4, 1-2-3 defining one ...
4
votes
2answers
379 views

Permutations: any implementation of the Cayley distance?

The Caley distance measures the distance between two permutations (see this question for a definition https://math.stackexchange.com/questions/1932991/catalan-number-and-cayley-distance-inequality-in-...
3
votes
1answer
272 views

How to get all combinations of length 3 [closed]

My problem is to get the list of all combinations of length 3 where the first place can be 1,2; second place could be a,b; third place could be 1,2,3,4. So the output is should be like this: $\{\{1,a,...
7
votes
2answers
309 views

Symmetrization of a Function

Suppose we have a function $f(x_1, \cdots, x_n)$ where $n$ is determined from outside (i.e. our function defined via a double blank f(x__):=...) I'm looking for a ...
2
votes
1answer
182 views

Automorphism group of a cycle graph in Mathematica

From this lecture note, it is known that the automorphism group of the $n$-cycle $C_n$ is the dihedral group $D_n$ with $2 n$ elements. I use the following code to create a cycle graph of $6$ nodes. ...
1
vote
1answer
83 views

Calculate coefficients of permutations

Let's say $a=(12345)+(41235)-(51234)-(54123)$ $b=(12345)+(21345)-(31245)-(32145)$ And i need to calculate coefficients of $\sum_{\pi\in S_5}\lambda_{\pi}*\pi$ multiplied by a*b (from the left). ...
6
votes
2answers
210 views

Why does Arrays interpret lists as Cycles?

I entered the command: Arrays[{4, 4, 4, 4}, Reals, {{{2, 1, 3, 4}, -1}, {{3, 4, 1, 2}, 1}} ] whose third argument is a list of lists, and got the result: ...
5
votes
1answer
139 views

GraphAutomorphismGroup bug or my misunderstanding?

Bug introduced in 10.3.1 or earlier and fixed in 11.2.0 This bug was specific to the Raspberry Pi version. I am using Mathematica 10.3.1.0 on a Raspberry Pi 3. The following input: ...
2
votes
1answer
188 views

General way to permute rows in a matrix (tensor)

I have a matrix: $m=\begin{bmatrix} a & b & c & d\\ e & f & g & h\\ i & j & k & l\\ m & n & o & p\\ q & r & s & t\\ u & v & w & ...
1
vote
1answer
87 views

How to extract the cycle lengths from a permutation [closed]

I want to input: Cycles[{{1, 3, 5}, {2, 4, 6}, {7,8}}] and get something like: {3,3,2}, that is, a list of the cycle lengths in ...
8
votes
4answers
644 views

Cyclic and Non-cyclic Permutations

Mathematica has a built in function to generate all permutations of a given list of elements; Permutations I can't find an equivalent function to generate cyclic ...
4
votes
2answers
150 views

Generating all permutations of labels in an expression

I have some very long and complex expressions which involve a set of $n$ variables, and I want to be able to permute the labels of the variables. I will give a simple example, instead of my awful ...
2
votes
1answer
76 views

Antrisymmetrized product of matrices

Let $X_{1},...,X_{N}$ be $N$ matrices. I want to compute an antisymmetrized product of $X_{i}$'s in mathematica: $X_{[a_{1}...a_{N}]} \equiv \tfrac{1}{N!}\sum_{\sigma}(-1)^{P}X_{\sigma(a_{1})}X_{\...