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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
104 views

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

I have a list ...
minhthien_2016's user avatar
1 vote
2 answers
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. ...
hare's user avatar
  • 220
1 vote
1 answer
120 views

Fixing code for a combinatorics problem

The problem I am solving is: Determine all possible values of positive integer $n$, such that there are $n$ different $3$-element subsets $A_1,A_2,...,A_n$ of the set $\{1,2,...,n\}$, with $|A_i \cap ...
matrix42's user avatar
  • 6,744
1 vote
1 answer
251 views

Enumeration of a sequence involving closure operators

Let us call a collection $\mathcal{F} \subseteq \mathcal{P}(X)$ special if it satisfies the following two conditions: $\emptyset, X \in \mathcal{F}$ For all $U, V \in \mathcal{F}$, it holds that $U \...
user227351's user avatar
5 votes
3 answers
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 ...
John Paul Peter's user avatar
3 votes
2 answers
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: ...
Luxspes's user avatar
  • 918
4 votes
1 answer
142 views

Displaying Hasse diagram (directed edges in graph pointing upwards)

I use the following code to display a Hasse diagram of a graph. ...
Michel's user avatar
  • 1,596
8 votes
3 answers
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, <...
István Zachar's user avatar
1 vote
0 answers
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 ...
Trev's user avatar
  • 753
1 vote
1 answer
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 ...
Per Alexandersson's user avatar
3 votes
1 answer
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 ...
user227351's user avatar
2 votes
1 answer
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: ...
Emad kareem's user avatar
3 votes
4 answers
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 ...
CasperYC's user avatar
  • 1,460
6 votes
3 answers
156 views

How to define variables $a$,$b$,$c$,$d$ are all elements of set $\{2,3,5,7\}$?

I would appreciate it if somebody could help me with the following problem: I want to create a Wolfram Language expression that states that all $a$,$b$,$c$,$d$ variables are elements of the set $\{2,...
Young's user avatar
  • 259
5 votes
2 answers
571 views

Maps between finite sets

With SageMath, one can do FiniteSetMaps(["a", "b"], [3, 4, 5]) to get all maps from {a,b} to ...
Thrash's user avatar
  • 395
0 votes
0 answers
119 views

Global assumption non zero

I would like to define globally an assumption stating that I have a nonzero real vector $v$. For now, I put : $Assumptions = Element[v,Vectors[{100},Reals]] but $v$ ...
Smilia's user avatar
  • 592
4 votes
4 answers
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 ...
BeTDa's user avatar
  • 480
2 votes
2 answers
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 ...
wally's user avatar
  • 417
6 votes
1 answer
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 ...
Steven Black's user avatar
3 votes
1 answer
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 ...
d.y's user avatar
  • 143
0 votes
1 answer
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 ...
Lorenzo Bagnasacco's user avatar
7 votes
1 answer
137 views

What Does Compile`SetIterate Do?

The list of compilable functions (given by Compile`CompilerFunctions[] // Sort) shows one of the more interesting- and core-sounding functions: ...
Just Some Old Man's user avatar
3 votes
2 answers
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 ...
Filippo Scaramuzza's user avatar
1 vote
3 answers
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 ...
user avatar
3 votes
2 answers
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 ...
მამუკა ჯიბლაძე's user avatar
5 votes
1 answer
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.
Cassini's user avatar
  • 5,340
1 vote
0 answers
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\}$ ...
Amin's user avatar
  • 147
0 votes
1 answer
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
Veritas Lux's user avatar
4 votes
2 answers
189 views

Decompose set into elements?

Given a list of tuples where one element is a set: ...
user182917's user avatar
7 votes
2 answers
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 ...
Martin Leung's user avatar
3 votes
0 answers
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 ...
Epsilon's user avatar
  • 1,122
0 votes
1 answer
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 ...
Arbuja's user avatar
  • 29
1 vote
1 answer
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 ...
Arbuja's user avatar
  • 29
4 votes
3 answers
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$ ...
flinty's user avatar
  • 23.1k
1 vote
4 answers
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/...
Paul B. Slater's user avatar
0 votes
1 answer
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 ...
Paul B. Slater's user avatar
4 votes
3 answers
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 ...
skyfire's user avatar
  • 475
10 votes
5 answers
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 ...
user57467's user avatar
  • 2,304
3 votes
2 answers
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: ...
George's user avatar
  • 3,095
1 vote
1 answer
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 <...
Cryme's user avatar
  • 133
1 vote
1 answer
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}\...
Jan Eerland's user avatar
  • 1,941
3 votes
1 answer
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 ...
user3201's user avatar
  • 151
0 votes
2 answers
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 ...
Mavatanet's user avatar
  • 141
3 votes
2 answers
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 ...
Nikol Š's user avatar
2 votes
1 answer
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 ...
AlanZ's user avatar
  • 21
4 votes
1 answer
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 ...
apg's user avatar
  • 1,937
0 votes
1 answer
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}$...
MGK's user avatar
  • 565
7 votes
5 answers
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: ...
kirma's user avatar
  • 18.6k
2 votes
1 answer
93 views

Calculate plausibility in Dempster-Shafer theory

I want to use Mathematica to show which subsets of a power set are required to calculate the plausibility for a given set in a power set. This has lead me to compute a summation with a ...
Hefaestion's user avatar
0 votes
2 answers
571 views

Summation over an index and a set

I have an index CC and a set of values CM, and c is an element of CM and ...
Tugrul Temel's user avatar
  • 5,303