Questions on the use of Mathematica in combinatorics, including the Combinatorica add-on package.

learn more… | top users | synonyms

-1
votes
0answers
35 views

Drop elements in Permutations [duplicate]

I have a problem with one excersise. I have a set of {x,y,z,w,u,t}. Then i want to print all possible permutations of the set with length 3 that commits this condition: element "u" not to occur after ...
5
votes
1answer
182 views

Find exponential generating function from the first few terms

The function FindGeneratingFunction computes the ordinary generating function of a sequence, given a sufficient number of initial terms. I have two questions in ...
3
votes
3answers
166 views

Permutations on elements a>b && b>c

A={1, 2, 3, 4, 5} Permutations[A, {3}] I need to print all permutations where the first number is bigger than the second and the second number is bigger than the ...
-1
votes
0answers
52 views

Combinatorial exercise: Permutations in which a appears before c

i need to calculate something in Mathematica; We have the list A = {a,b,c,d,e} I need to find all permutations which will contain exactly 3 elements from A in which: a) element b appears only once ...
2
votes
2answers
73 views

Permutations and recurrence equation

First problem: I need to show all Permutations with length 4 of this elements {x, y, z, w, t} but with this condition: the element z mustn't be after element t. I ...
1
vote
1answer
32 views

series combinations

is there any possibility of displaying all possible series of the form: "1+/-2^2+/-3^2+/-...+/-n^2", where one can choose the sign before the each term and knows the numbers of the terms in the ...
6
votes
2answers
160 views

Subsets or Outer?

How do I generate all possible subsets of a list of positive numbers (with at least 1 of them), given that each of these positive numbers subvariates itself on its input value and its multiplicative ...
5
votes
2answers
144 views

Combinatorics: Placed errors

Consider a vector of length n where each element can take one of the values U, X, ...
2
votes
2answers
68 views

Arrangements (?) from permutations of rows in a triangle, is there a simpler way to program this?

I am generally confused about integer valued polynomials, and how to count them. Trying to learn the subject I started by listing permutations of the rows in a lower triangular table: $$\displaystyle ...
1
vote
1answer
70 views

Computational Complexity of HypergeometricPFQ

What is the computational complexity of HypergeometricPFQ? I got a result of a product of a multinomial and HypergeometricPFQ and I was wondering if that would be considered a closed form solution ...
-1
votes
1answer
47 views

Create a list of all functions given a set of arguments

I'm trying to examine some patterns on the permutation of elements in finite element functions. I'd like to create a list of all functions (256 of them) on ...
6
votes
2answers
140 views

Checking if one partition is a subpartition of another

Say I've got two partitions of an list (not necessarily containing numbers, and not necessarily distinct), and I want to check that one is a subpartition of the other. Let's look at some examples: ...
4
votes
2answers
154 views

How to check whether elements of a list meet a condition without generating the whole list first?

I have to find the number of elements satisfying a given condition from the set: Tuples[Tuples[Tuples[{0,1},n],n],m] The condition for $n=3,m=3$ is: ...
6
votes
3answers
308 views

Finding all sublists or substrings of a given list/string

Given a list or string, how do I get a list of all (contiguous) sublists/substrings? The order is not important. Example for lists: ...
2
votes
2answers
166 views

Partition a range of integers into triples

Some time ago, I was asked to look at a simple to formulate puzzle. Consider the list of numbers {1,2, ..., 33}. Try to split this list in 11 triples, such that in ...
15
votes
3answers
185 views

Partitioning with constraints on subsets

Given the following data: constraints = {{11, 2}, {11, 3}, {11, 4}, {11, 6}, {11, 9}, {1, 6}, {5, 6}, {2, 5}}; weights = {3, 7, 3, 2, 4, 2, 2, 2, 3, 2, 1}; I ...
0
votes
2answers
106 views

Finding permuations in a specific order

I would like to find the following permutations, but need an elegant way of computing it. Ideally I would like to have a variable determine the highest number in the last element and find all ...
1
vote
0answers
80 views

Is there a minor bug in Neal Alexander's TopologicalSortAll[]?

There is an amazing answer to this question: All possible topological orderings of a graph By Neal Alexander. However, as user "dark blue" (I am not this user) notes: ...
4
votes
4answers
208 views

Partition list into a given number of sub-lists

I'm having quite a hard time with the following. I would like to partition a list into a list of sub-lists, in such a way that the number n of sub-lists is fixed. ...
3
votes
2answers
120 views

Can I generate matrices with a constraint?

Say I want a way to generate matrices with the following properties, All non-diagonal elements are either $0,1,-1$ The diagonals are either $k$ or $k+1$ for some $k \in \mathbb{Z}^+$ for some $k$ ...
16
votes
7answers
594 views

Enumerating tuples from a larger space such that all pairs of values are present at least once

I am trying to write a function that will accept a list of N lists and returns a list of N-tuples that represent all pairs of values from the original N lists at least once. To illustrate with an ...
2
votes
1answer
112 views

defining Associated Stirling numbers of the Second Kind

First, I'm new to Mathematica. Spent my undergraduate programming with Maple and my computer crashed and I lost it. Fortunately, my university offers free Mathematica downloads to students, so here ...
3
votes
2answers
215 views

Constructing a list of Cartesian coordinates of the Icosahedron

I’m learning Mathematica and I need the coordinates of the Icosahedron vertices. This is my attempt at writing a program for it. The vertex coordinates are simply all cyclic permutations and ...
5
votes
2answers
198 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
1answer
129 views

Inclusion-Exclusion Principle Implementation

I would like to know how I can write a Mathematica code for the Inclusion–exclusion principle. The formulas governing it are: $ P(\bigcup_{i=1}^n A_i)=\sum_{k=1}^n (-1)^{k-1} ...
1
vote
0answers
134 views

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

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 ...
4
votes
2answers
139 views

How to obtain all the distinct De Bruijn sequences?

In combinatorial mathematics, a $k$-ary De Bruijn sequence $B(k, n)$ of order $n$ is a cyclic sequence of a given alphabet $A$ with size $k$ for which every possible subsequence of length $n$ in $A$ ...
4
votes
1answer
121 views

The algorithm of ListGraphs[n,m]

I'm not sure if this is a Mathematica problem, math problem or a CS problem, so if this is off-topic please transfer it. In the package Combinatorica there is a ...
2
votes
2answers
325 views

Making a flag with six vertical stripes

A flag is to be made with six vertical stripes by using colours yellow, blue, green and red in such a way that no two adjacent stripes should have the same colour. In how many ways is this possible? ...
1
vote
2answers
90 views

Numbering of cases implied by a subset of Boolean vectors

In the course of a programming problem I stumbled upon the following sub-problem. Given an arbitrary, but fixed, number of Boolean variables, I would like to be able to pick a subset of the ...
2
votes
1answer
103 views

Symbolic multiplicative partitions

Let $p_n\#\equiv\prod_{k=1}^{n}p_k$ (primorial): p[n_] := Times @@ Prime[Range[n]] then the multiplicative partitions of $p_{1,2,3,4}\#$ are $$ \{\{2\}\},$$$$ ...
2
votes
1answer
134 views

How to compute the `Automorphisms` of graphs with multiple edges?

I try to compute the Automorphisms of graphs with multiple edges from its AdjacencyMatrix but failed. The following code shows ...
0
votes
1answer
59 views

How should my data be formatted for use with BetweennessCentrality?

A few weeks ago I asked this question. I am trying to upload my data which is an adjacency list for an undirected, unweighed graph and find the betweenness centrality. At the time I tried to use the ...
0
votes
1answer
357 views

Generating all “from n choose k” configurations of a simple list [closed]

Suppose that I have a 1-D list called myList. Here's an example: myList = {"A", "B", "C", "D"}; I want to write (or find ...
0
votes
1answer
176 views

How do I upload a graph as an adjacency list and find the betweenness centrality?

I have an undirected simple graph in a .txt file formatted as an adjacency list like this: 100 200 200 300 300 400 500 600 700 800 900 ... Every number is a node ...
6
votes
2answers
282 views

Binomial[-1,-1]

According to various sources e.g. http://www.proofwiki.org/wiki/Definition:Binomial_Coefficient and Wolfram themselves http://functions.wolfram.com/GammaBetaErf/Binomial/02/ , the binomial ...
1
vote
2answers
210 views

Mathematica can't minimize a function

Mathematica seems not to be able to minimize this univariate function over integer arguments, $r>2, r \in \mathbb{Z}$. ...
6
votes
3answers
234 views

Enumerate the 1-factors (perfect matchings) of $K_n$

Introduction I would like to enumerate the 1-factors, or (near-)perfect matchings, of the complete graph Kn. The adjacency list representation for Kn is basically { (x, y) | 1 ≤ x < y ≤ n }. For ...
2
votes
1answer
148 views

Using IntegerPartitions for distinct integers

What I would like to do is to find a way to test how many ways m distinct integers from the set {1,..., n} where ...
1
vote
2answers
170 views

Permutations with restrictions

I have a problem that can be modeled as: there are 8 boxes in total, and 60 different items. I want to put all items into boxes (all of them can be put into a single box). Now I want to find: 1) ...
6
votes
1answer
238 views

Young Tableaux Miscellanea

I have a problem which is mostly neatly described by using Young Tableaux. Mathematica seems to have these Tableaux built in, except that the Tableaux function is ...
13
votes
2answers
487 views

Generating Gelfand-Tsetlin patterns

I am doing some research on some combinatorial object called GT-patterns. They are generated from three parts of data. Two integer, partitions (sequences of weakly decreasing numbers), $\lambda = ...
2
votes
2answers
88 views

Checking connectedness of a graph

I am trying to use the Combinatorica package in a Mathematica version 8 in the following code: ...
6
votes
1answer
214 views

Better way to get Fisher Exact?

I want to perform a Pearson's $\chi^2$ test to analyse contingency tables; but because I have small numbers, it is recommended to perform instead what is called a Fisher's Exact Test. This requires ...
4
votes
3answers
166 views

Permutation count for sets with multiplicities

I am able to do a permutation counr for the set {a, a, b} which gives me 3 groups. I am happy with that result. However, if the set is ...
6
votes
1answer
233 views

Shortest polygonal path

I'd like to find the shortest distance between some points (every point must be visited), such as between these 3 points: ...
0
votes
1answer
107 views

How can I find the derivative of a combinatorial expression? [closed]

I want to differentiate the following equation: n = (nchoosek)*p*(1 - p)^(n - k) After differentiating my result is: ...
1
vote
0answers
72 views

The number of real values assumed by combinations of complex roots of a decic

Define complex conjugate as the pair of complex numbers $a+bi,a-bi$. Assume you have 5 such pairs and they are the 10 roots $x_i$ of a 10th-deg equation with integer coefficients. In general, how many ...
2
votes
0answers
193 views

Tools for finding minimal or almost-minimal graph vertex colorations in Mathematica v9?

I'm looking to compute minimum vertex colorations (s.t. no two vertices of the same color share an edge: http://en.wikipedia.org/wiki/Graph_coloring) for graphs in Mathematica v9 with potentially up ...
12
votes
4answers
385 views

Equivalent Nested Loop Structure

Consider the following examples: ...