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

Questions tagged [permutation]

For questions about the functionality related to permutations in Mathematica.

4
votes
3answers
156 views

Find permutation index

Firstly I wanted to find all the non-negative integer solutions for the following equation given the value of $k_{max}$ $$ k_1 +k_2 +k_3+k_4 = k_{max} $$ For this I use the following code:- ...
5
votes
1answer
68 views

Generate list of tuples, modulo PermutationGroup

I have a permutation group, e.g. g=PermutationGroup[{Cycles[{{1, 2}}]}] but not necessarily limited to a single generating cycle. What I want is to create a ...
1
vote
1answer
51 views

Is there any functions to extract the combinations of sets [closed]

Suppose I have a function f which is depending on a,b,c (f[a_,b_,c_]). these a, b, c can take two value zero and infinity. How to have a combination of the function f when it takes zero and infinity ...
3
votes
0answers
19 views

Not too obsolete package extending the built-in functionality of Permutation Groups

Is there a modern package geared to permutation groups? With functions, for instance, for group-isomorphism (either w.r.t. permutation representation & w.r.t. group structure), direct, semidirect ...
2
votes
1answer
29 views

How to specify discrete group through permutation cycles

I would like to define a group of order 12 in Mathematica by giving a list of 12 elements in cycle notation, $$ S = \{(e), (123), (132), (12)(45), (13)(45), (23)(45), (13), (23), (12), (45), (123)(45)...
7
votes
2answers
321 views

How to represent a product of cycles in matrix form?

I have a permutation a in a product of disjoint cycles form as follows $a = {{(1,9,3,7)(2,11,6)(4,8,5,10)}}$ I want to represent it in a matrix form ...
1
vote
1answer
42 views

Generating a new list according to the values of the elements of a list

I want to use the command Permute to arrange the rows of a matrix. What I am looking to do is given a list I want to generate a new list which gives me the positions of the elements of the first list ...
1
vote
0answers
54 views

Sum over multiindex

I would like to calculate a sum over some multi-indices, that follow a specific pattern. $$\sum\limits_{1\le i_1<i_2<...<i_k\le N} A(k,i_1, i_2, ..., i_k).$$ $A$ is a fix expression of the ...
2
votes
0answers
158 views

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

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
54 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
44 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
49 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 ...
12
votes
4answers
348 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
33 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
183 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
45 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
140 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
76 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
31 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
539 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
758 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
48 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
79 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
268 views

making sub list from a list

I have a list ...
2
votes
1answer
80 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
285 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
91 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
209 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
125 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
96 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
858 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
488 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
118 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
220 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
151 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
294 views

Duplicate Permutations with Tuples

Permutations without repetition (in Italian: simple dispositions) Permutations[{a, b, c, d}, {3}] or ...
1
vote
1answer
157 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
83 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
368 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
293 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
427 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
277 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
335 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
227 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. ...