# Questions tagged [sets]

For questions pertaining to sets in the set-theoretical sense. Use "assignment" for questions about the use of the Mathematica functions Set or SetDelayed.

121 questions
Filter by
Sorted by
Tagged with
104 views

### How to to divide this list into the sets with four elements? [closed]

I have a list ...
1 vote
100 views

### How to make a list be skipped if it is an empty set when it is being iterated over

Could you give me some advice? There is a box[a,b] in which the number and number of lists are randomly generated. For example as follows. ...
1 vote
120 views

201 views

### How can I remove and keep the elements of this set?

I have a list list = {{1, 3, 7, 1, 2, 1, 4, 7}, {6, 2, 7, 9, 4, 3, 6, 7}, {2, 8, 8, 2, 3, 2, 4, 6}, {5, 7, 7, 5, 2, 1, 2, 4}, {8, 10, 10, 8, 2, 1, 2, 4}} Consider ...
125 views

### How to create a GroupBy function that is better aligned with relational algebra?

I want a GroupBy function that behaves more in alignment with relational algebra principles. I can get what I want if I do it in 2 steps: Preparation: ...
142 views

### Displaying Hasse diagram (directed edges in graph pointing upwards)

I use the following code to display a Hasse diagram of a graph. ...
188 views

### How to do integer interval arithmetic?

How to calculate union, intersection and complement of integer intervals without actually generating all integers in the range and perform set-arithmetic (Union, <...
1 vote
35 views

### Is there a nice way to deal with sets in an abstract/symbolic way?

For instance, if I wanted to declare $A$ to be the set of all finite subsets of $\mathbb{Z}$, and declare $B$ to be a set comprising all finite subsets of $\mathbb{Z^{-}}$, and then declare $C$ to be ...
1 vote
94 views

### Speed up random set partition code

I have managed to construct code for randomly generating a set partition of size n with k parts. Note that the total number of such objects is counted by a Stirling number of the second kind. The code ...
260 views

### Enumeration of a certain sequence III

Let’s call a collection $\mathcal{F} \subseteq \mathcal{P}(X)$ satisfying: $\emptyset, X \in \mathcal{F}$ For all $U, V \in \mathcal{F}$ it holds that $U \cap V \in \mathcal{F}$. special. We can ...
140 views

### formations of union of sets

How do I get the formations generated by the union of sets? Practical example As an example of this calculation,if we denote the four sets: ...
304 views

### Verifying a combination problem using subsets

The question is shown below. The handwritten answer is one of the methods of the mark scheme. This method "seemed" ok, but we are not so convinced about the Total of 140 ways. Also, there is ...
156 views

686 views

### How to generate Venn diagram from a universe and 3 random sets?

Given a universe u with random numbers between 1 and 50 and three sets a,b,c, that have random numbers a between 3 and 30, b between 2 and 40 and c between 4 and 49 How can I represent the sets a, b ...
199 views

### How can I subtract and calculate the complement of a pair of sets? [closed]

I cannot properly implement these operations. How can I do it? This is a reduced example: A={2,3,4} B={2,4,6} C={1,2,3,4} Find ...
175 views

### Can Solve[...] be used for set math? If so, how? If not, how else?

I'm a recreational user who loves using the product. I'm looking for a strategy to solve the following question using Mathematica. The question is from a sample actuarial exam. I can solve this with ...
140 views

### Mathematica code for q-Stirling numbers

In the paper [A new $q$-Analog of Stirling Numbers],(https://hal.archives-ouvertes.fr/hal-01372920/document)[PDF] J. Cigler defined $q$-Stirling numbers of the second kind as the following: He ...
60 views

### Part of array as a blank variable [duplicate]

I have a little question. Let me define the function: f[k_]:=k So 'k' in the argument of 'f' is a blank variable. Is there a way to define a part of array as a ...
137 views

### What Does CompileSetIterate Do?

The list of compilable functions (given by CompileCompilerFunctions[] // Sort) shows one of the more interesting- and core-sounding functions: ...
235 views

### How to draw 3D sets in Mathematica given inqualities

I would like to draw a 3D set ($E$) given the following conditions: $E=\{(x, y, z)\in\mathbb R^3: x, y, z \in [0, 1], x+2y-1\leq z\}$ I have seen in the Mathematica documentation that there are ...
1 vote
70 views

### How to ask Mathematica to do the given operation for a set of parameters?

I have a set of numbers like this s = {a, b, c, d, e, f, ..., g, h} and I would like to ask Mathematica to do the following operation (to sum the subtractions of ... 323 views

### Most efficient way to find equivalence classes of an equivalence relation

This is a most basic thing and is probably just built-in but I am ignorant of it, so... I've got some set S={a,b,c,...} and a function ...
58 views

### Is there an argument to MemberQ so that it will always return TRUE?

Is there an argument for the first input to MemberQ which will result in MemberQ always returning TRUE? It would basically be a constant for the set of everything, I suppose.
1 vote
106 views

### How to determine the domain (intersection and disjoint set) of two functions define on a set? [closed]

Suppose I have two multivariate functions $f(x,y,z)$ and $g(x,y,z)$ such that $0<x<1,0<y<1,0<z<1$. $f(x,y,z)$ is defined on values satisfying $\{0<x<1,0<y<1/2, z>y\}$ ...
56 views

### How do we express set theoretic extensionality in Mathematica for instance I want it to see {2,1} as equal to {1,2)

I think the title pretty much covers it
189 views

### Decompose set into elements?

Given a list of tuples where one element is a set: ...
167 views

### How to decompose a list of n-tuples into a union of Cartesian products

I have a list with all elements at the same level { {a, d}, {a, e}, {a, f}, {b, d}, {b, e}, {b, f}, {c, d}, {c, e}, {c, f}, {x, t}, {x, q} } How ...
63 views

### Symbolic Set Difference

Suppose I have two symbolic set containing 2-points like A={(m,n)| for m,n belonging to whole numbers}. So m,n=0,1,2,... and I have another set containing 2-points ...
39 views

### Generalizing previous question: Partition $[a,b]$ into $m$ sub-intervals and count number of sub-interval intersecting $A_1\subseteq[a,b]$?

In my previous question, How to partition $[a,b]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with a subset of $[a,b]$?, I was given an answer to my specific ...
1 vote
112 views

### How to partition $[a,b]$ into $m$ equal sub-intervals and count the number of sub-intervals that intersect with a subset of $[a,b]$?

Suppose we have a subset of $[a,b]$, where $a=0$ and $b=1$, such as $$A_1=\left\{\frac{1}{2^x}+\frac{1}{2^y}+\frac{1}{2^z}:x,y,z\in\mathbb{Z}\right\}\cap[0,1]$$ Which is a subset of $[0,1]$ If we ...
246 views

### How can I solve a Set Cover problem in Mathematica

I have $n$ non-empty possibly non-disjoint sets $S_i$, each having a cost $c_i$, and the union $\Omega=\bigcup_{i=1}^{n}S_i$. How can I find a selection of $S_i$ such that the union is also $\Omega$ ...
1 vote
178 views

### How can one expand an arbitrary boolean combination into the $2^n$ atoms of the associated boolean algebra of size $2^{2^n}$?

The answer of user250938 to Can one usefully apply the Boolean functions of Mathematica to measurable Boolean sets? and the second comment of Monroe Eskew to the answer to https://mathoverflow.net/...
121 views

### Can one usefully apply the Boolean functions of Mathematica to measurable Boolean sets?

This is something of an attempted succinct/pointed rephrasing of an earlier question Given measures on sets and on certain Boolean combinations of the sets, can one check their consistency and/or ...
103 views

### every set intersection for every set in a family with another family of sets

I want to find for each list within a list of lists what intersections occur when taking set intersection for each list in another list of lists. Hopefully that makes sense. I have tried ...
700 views

### Delete sublist when sub-sublists contain same element

Given lis={{{a},{b,c,d}},{{a,b},{b,c}},{{b,c},{a,b,c}},{{b},{d}},{{a,b},{c,d}}} I want to delete sublists which have one or more elements in common. So that I ...
1k views

### How to stretch this Venn diagram?

I am trying to duplicate (approximately) the following Venn diagram in Mathematica: I have used the top of this page as a guide, which showcases the following Venn diagram triplet: ...
1 vote
299 views

### ArgMin over intervals and discrete sets

I was playing with ArgMin but I'm not sure how to use it for constrained optimization. For example, ArgMin[x^2, x] returns <...
1 vote
137 views

### Possible way to plot the solution density of diophantine equations

Well, I'm trying to investigate the density of solutions to Diophantine equations. What is a general method to describe that density? I've two functions: \varphi\left(\text{a},\text{b},\text{c}\...
130 views

### Why doesn't DeleteDuplicates do what I want

First off. I am not a mathematician I am a linguist, a syntactician who is trying to say something about semantics, which in the case at hand can be largely understood to reduce to set theory. That ...
89 views

### Making a function that takes as an input a list not care about the order of the elements of the list

I would like a function f, that takes as input a list, not care about the order of elements of the list. So,for example: f[{3,2}]=f[{2,3}] Is this possible? Or is it necessary to convert the list ...
211 views

### How to find the positions of replaced elements in a list

I have two sets of elements a={3, 4.8, 5, 4.2, 3.6, 2.3, 4.5, 3.7} b={2.8, 4.7, 5.3, 3.5, 4.7, 2.8, 4.2, 3.4} and I create ...
115 views

### Creating pairs of non-intersecting set from a given set

Let's say I have a set {a,b,c,d} and I want to create a list of pairs {{a,b,c,d},{}},{{a,b,c},{d}},{{a,b,c},{}},... such that there is no intersection between each pair, and they do not need to use ...
167 views

### Non-flat partitions of a set

A non-flat partition of a set is one where, when the elements of the set are on a grid, the partition does not contain subsets with elements from the same row. When the set is more irregular the same ...
76 views

### How to find disjoint subsets such that union of the sets give the motherset or main set?

Let us define a set $\mathcal{S}=\{1,2, 3,\cdots,67\}$. I have a list of 132 subsets. I want to obtain 16(or 17) mutually exclusive subsets such that union of such 16(or 17) is equal to $\mathcal{S}$...
499 views

### Efficient deletion of specific list entries

It is sometimes useful to remove exactly the amount of specific entries on one list from another. Consider: ...