Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
1answer
29 views

How to generate all the combinations with repetition?

I have $K$ variables. Each variable can take any value form a set with $N$ elements. We have $N^K$ possible solutions (permutations with repetition, when at each time slot we can choose among $N$ ...
3
votes
1answer
35 views

The product of two symmetric groups acting on a function

Considering the rational function $$ \small \begin{align*} f&(x_1,x_2,x_3;y_1,y_2,y_3)\\ &=\frac{\left(1-\frac{y_1}{x_1}\right)\left(1-\frac{y_2}{x_1}\right)\left(1-\frac{y_3}{x_1}\right)\...
0
votes
1answer
23 views

Listing Permutations of Two Elements

Let $S_{k}^{(n)}$ be the set of all possible lists of length $n$ containing exactly $k$-times $\sigma$ and $(n-k)$-times $\Delta$. For instance, $S_{2}^{(4)}=\bigl\{\{\sigma,\sigma,\Delta,\Delta\},\{\...
2
votes
2answers
55 views

Fixed points free permutations [duplicate]

How to generate a list of fixpoint free permutations of n elements in mathematica?
12
votes
1answer
377 views

ls Ordering[Ordering[list]] optimal?

Given a list list with unique elements, the task is to replace each element by its position in Sort[list]. For example, ...
1
vote
0answers
55 views

Sum over cyclic permutation of indices

To define the Schouten bracket I need to be able to sum over a cyclic permutation of the indices: $$ [\Phi,\Xi]_S=\mathfrak S_{i,j,k} \left(\Phi^{is}\partial_s\Xi^{jk}+ \Xi^{is}\partial_s\Phi^{jk}\...
12
votes
2answers
325 views

Terse Method to Swap Lowest for Highest?

I have built a solution to swap the lowest values with the highest values in a list. With ...
1
vote
0answers
39 views

Permute using symmetric vs alternating groups

Why does this happen? Permute[{0, 0, 0}, SymmetricGroup[3]] (* {{0, 0, 0}} *) Permute[{0, 0, 0}, AlternatingGroup[3]] (* {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}} *)
2
votes
1answer
44 views

Incorporating Signature with Permute for symmetric groups

Let $$f(x_1, x_2, x_3, x_4) := \frac{x_1^{-3} x_2^{-2} x_3^{-1}}{(1 - x_1^2) (1 -x_1^2 x_2^2) (1 - x_1^2 x_2^2 x_3^2) (1 - x_1^2 x_2^2 x_3^2 x_4^2)}.$$ I am trying to compute $$\sum_{w\in S_4} (-1)^{\...
2
votes
0answers
25 views

How to iterate over Orbit of PermutationGroup?

Another day, another permutation group question. I'm given a g=PermutationGroup[...], and a list l={1, 3, 3, 2, ...}. I know I ...
7
votes
1answer
633 views

Can we turn this for loop into a more elegant Mathematica code?

I am coding stuff manipulating indirection arrays and I have some code like: ...
4
votes
2answers
81 views

The set of polynomials under the action by a symmetric group

Let $$f(x_1,x_2,x_3)=\frac{x_1^r x_2^r \left(1-x_1 x_3\right) \left(1-x_2 x_3\right)}{\left(1-\frac{x_2}{x_1}\right) \left(1-\frac{x_3}{x_1}\right)\left(1-\frac{x_3}{x_2}\right)},$$ where $r$ is a ...
1
vote
1answer
37 views

Combinations of a matrix

I want to compute all combinations of a given matrix. I came up with ...
5
votes
4answers
338 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:- ...
6
votes
1answer
104 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
54 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
20 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
30 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
327 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
47 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
114 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
286 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
55 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
47 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
64 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
389 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
40 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
218 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
50 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
164 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
2answers
91 views
0
votes
1answer
84 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
33 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
87 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
548 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
863 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
49 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
85 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
280 views

making sub list from a list

I have a list ...
2
votes
1answer
91 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
338 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
93 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
242 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
136 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
98 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 ...
16
votes
7answers
887 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}$: ...
30
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
520 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 ...