Skip to main content

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
0 votes
0 answers
20 views

How many unique count sets can be made from n variables? [migrated]

If I have n letters of the alphabet, how many unique sets of the letters can I make, where each unique set contains 1 to n letters? This is basically factorial arithmetic with the caveat that the set ...
David Wanjiru's user avatar
1 vote
2 answers
153 views

How can I express these two sets and find their intersection by Mathematica?

My code: M = Interval[{-1, 2}] N = Reduce[ForAll[{y, x}, x \[Element] M, y == 0.5*x^2 - 1], Reals] Intersection[M, N] Gives an error message : Set::wrsym: Symbol ...
neo742's user avatar
  • 45
1 vote
1 answer
86 views

Most efficient way of defining the following sets for every step $n$

For each $n\in\mathbb{N}$, how do we compute sets $A_n$ and $B_n$ below: Let $A_1=[0,2/3)$. Let $B_1=(2/3,1]$. If $A_n$ is a union of intervals, then for each interval cut out the middle $1/2^{n+1}$ ...
Arbuja's user avatar
  • 71
0 votes
0 answers
57 views

Removing a set of original assumptions from the result of Reduce

I am having trouble using set operations when applying them to lists which cme from the Reduce function. As an example, here is a list of assumptions and an expression for which I would like to know ...
tyogi's user avatar
  • 289
0 votes
1 answer
105 views

Generating the union of possible subsets

I want to calculate the union of possible subsets within each set of the family of sets. I use the following code: ...
Alyasaa Jasim's user avatar
4 votes
3 answers
257 views

How to plot this set of complex numbers?

I want to plot this set of complex numbers in Mathematica: $$ D := \left\{\frac{1}{z}: z \in \mathbb{C}, \text{Im}(z) \ge 1, \text{Re}(z) \le \text{Im}(z), |z-1-i| \le 1\right\} $$
Tim's user avatar
  • 43
2 votes
0 answers
47 views

NextSetPartition

I'm looking for a function similar to the one in the question below, but for the more general problem of set partitions without restricting the set size. NextKSizePartition, or how to partition a set ...
David's user avatar
  • 159
1 vote
2 answers
76 views

Can't use iterative variable as part specification [closed]

I've got the following mathematica code: ...
Sebastian 's user avatar
2 votes
1 answer
111 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
106 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
  • 436
1 vote
1 answer
128 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
  • 7,108
1 vote
1 answer
255 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
7 votes
5 answers
264 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
139 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
  • 930
4 votes
1 answer
200 views

Displaying Hasse diagram (directed edges in graph pointing upwards)

I use the following code to display a Hasse diagram of a graph. ...
ExpressionCoder's user avatar
8 votes
3 answers
226 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
37 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
  • 763
1 vote
1 answer
100 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
262 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
169 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
320 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,632
6 votes
3 answers
170 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
597 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
  • 405
0 votes
0 answers
186 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
828 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
  • 490
2 votes
2 answers
214 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
179 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
159 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
70 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
8 votes
1 answer
141 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
254 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
72 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
417 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
59 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,586
1 vote
0 answers
122 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
60 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
197 views

Decompose set into elements?

Given a list of tuples where one element is a set: ...
Pedro Sobota's user avatar
7 votes
2 answers
192 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
66 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
42 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
  • 71
1 vote
1 answer
134 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
  • 71
4 votes
3 answers
290 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
  • 25.5k
1 vote
4 answers
180 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
124 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
112 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
  • 477
11 votes
7 answers
737 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,728
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,145
1 vote
1 answer
364 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
150 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
  • 2,001
3 votes
1 answer
133 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
  • 161