All Questions

Filter by
Sorted by
Tagged with
0
votes
3answers
65 views

More general permutation of lists

For some arbitrary $N$, I would like to construct all permutations of lists of length $n \leq N$ such that the sum of each permutation list adds to a value less than or equal to $N$. Specifically, ...
2
votes
1answer
31 views

$2+2+\dots+2$ cycle conjugation classes of the symmetric group $S_n$

Command GroupElements[SymmetricGroup[4]] gives me all cycles of all conjugation classes. But I'm only interested in the 2+2 class ($2+2$ being one of the integer ...
2
votes
2answers
69 views

Fixed points free permutations [duplicate]

How to generate a list of fixpoint free permutations of n elements in mathematica?
12
votes
1answer
406 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, ...
12
votes
2answers
327 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
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 ...
12
votes
4answers
404 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
45 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
228 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 ...
5
votes
1answer
889 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: ...
2
votes
1answer
86 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
283 views

making sub list from a list

I have a list ...
5
votes
3answers
356 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,...
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
100 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 ...
10
votes
3answers
538 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 ...
5
votes
4answers
226 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 ...
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: ...
-1
votes
1answer
84 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
493 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
332 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 & ...
2
votes
2answers
227 views

Changing the order of elements in a list

I have a list of the form list1 = {1, 3, 4, 2, 5, 6} and I would like to replace each of the elements in the position of represented by the previous number in the ...
4
votes
2answers
164 views

Interesting “Tuples” application

I want to start with: {a,b},{c,d},{e,f} and end up with: {a,c,e},{a,c,f},{a,d,e},{a,d,f},{b,c,e},{b,c,f},{b,d,e},{b,d,f} ...
5
votes
1answer
224 views

list of all permuations of sublists of a nested list

I've got a certain class of lists with, say, 4 elements, that are lists themselves. E.g. {{1, 2, 3}, {4}, {5, 6}, {7}}. I'd like to find a way to generate a list ...
3
votes
1answer
169 views

How can I optimize the search between two lists, one that is changing length?

I'm trying to identify unique arrays by comparing two lists, one which is growing in length. The number of elements in the list grows as 2^n^2, where ...
4
votes
3answers
151 views

Indexing all elements of permutations $S_n$

I have this Table that gives all elements of $S_n$, I would like to know how to improve efficiency. ...
20
votes
3answers
946 views

Generating Tuples with restrictions

I am interested in a certain subset of all tuples. Generating all with Tuples and then filtering is wasteful, and will "blow up" very quickly. For a concrete ...
8
votes
1answer
143 views

Duplicate-free results of permutations + constant list

Given a constant list const, e.g. const = {-(15/2), -(13/2), -(17/2), -(15/2), -(13/2), -(11/2)} of length ...
4
votes
2answers
157 views

Creating all permutations of list with “alignment”

I need to find all permutations of a list satisfying a condition but I'm lost about how to do so. Given a list I want a write a function to produce all permutations such that the list is "top aligned" ...
1
vote
1answer
75 views

Fast arithmetic on matrix elements

I have a square matrix $U$ of dimension $L\times L$, I am interested in the following quantity $U_{1,j}U_{2,k}U_{3,l}U_{4,m}\cdots U_{L,q}$ summed over all permutations of the letter indices, e.g.,...
3
votes
3answers
175 views

Seeking a way to generate sequential partitions of a list using built in or Combinatorica functions [duplicate]

This code generates all "sequential partitions" of a list: ...
2
votes
1answer
4k views

How to get all possible combinations of this list? [closed]

I'm trying to get all possible combinations of {0,-1} for a certain length. So let's say I want length 2. Then I want my output to be ...
4
votes
1answer
104 views

How can I “permute” an ordered pair over all the permutations of say $S_4$?

I want to make an action table of the symmetric group (say $S_4$) acting on the set of unordered pairs of distinct vertices of a square. I have the list of such pairs: ...
5
votes
1answer
120 views

How to get a new list by exchanging some elements?

Let's begin with a simple example. Now, we have a list, list0=Range[4]; k1 and k2 are some elements of the list0. If |k1-k2|==2, then the elements k1 and k2 can ...
3
votes
2answers
198 views

How can I filter a permutation list depending of a pattern? [closed]

I've created a permutation list Grid[Permutations[{a, e, q, r, t, u}], Frame -> All] and only want to see rows where the 5th element is a "t". I tried to do ...
2
votes
2answers
464 views

How to find the palindromic number I'm looking for?

I'm looking for a number which is the same when you read it reverse like 101 or 878. I have to get all numbers from 10 to 1000. There are 99 numbers. {11,...,99,101,...,191,...,202,...,292,...,909,......
6
votes
2answers
349 views

Nested permutations

I would like to compute all "nested permutations" (not sure if it's the right term) of a list consisting of simple elements (numbers, strings) and simple sublists (level 1 lists of simple elements). ...
5
votes
3answers
212 views

How to find the right permutation, which fits to the problem?

I'm new here and I hope I can find some help. I'm from Germany, so sorry for my English. I look for a number, whose digits are all different. It isn't known how many digits it has. But there is a rule:...
13
votes
2answers
890 views

What is the fastest way to get the nth distinct permutation of a list?

What is the fastest way to write a function nthPermutation[xs_List, n_Integer] which is equivalent to Permutations[xs][[n]] but ...
5
votes
4answers
337 views

Sort two lists at the same time, based on another

I am new to using Mathematica and I can not find a solution to what I am wanting to do. I want to take a list such as: x = {1,2,3,4,5,6,7,8} and a second list (...
10
votes
7answers
7k views

Check if two lists are equal in any order

Suppose I have two lists, how can I efficiently check if the two lists are identical up to permutations of the elements? For example I would like the function to output: ...
6
votes
2answers
434 views

How to define even permutations correctly?

I define even permutations as following, but there may be some error. I use it in two different way and get different output. ...
0
votes
0answers
71 views

Generate all strings of fixed length from an alphabet [duplicate]

I am trying to create all possible strings of length $8$ from the alphabet $\{+1,-1\}$. I am trying to get help from this question. But not sure where to start from. Any help?
2
votes
2answers
54 views

How to further process a 2 dimensional list created with tuples

I created with Tuples[{{USD, EUR, JPY}, {UP, DOWN}}] the following result: ...
3
votes
0answers
241 views

How to sequentially select, from a large set of tuples (of matrices), those with a certain property [closed]

I'm interested in finding a computationally efficient way for selecting all tuples of matrices which have a certain property. The property I'm interested in is that I want the column sum, of f[the ...
3
votes
2answers
717 views

Permuting elements within a list

I have s = {2, 3, 5, 7, 1, 4, 6} (* always with diffente elements in {1,2....7}*) l = Length[s] n = 3 and n tells us that we ...
2
votes
2answers
290 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 ...
2
votes
1answer
86 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 ...
3
votes
1answer
300 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 (so ...