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

Maps between finite sets

With SageMath, one can do FiniteSetMaps(["a", "b"], [3, 4, 5]) to get all maps from {a,b} to ...
user avatar
  • 225
0 votes
0 answers
24 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$ ...
user avatar
  • 442
4 votes
4 answers
386 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 ...
user avatar
  • 480
2 votes
2 answers
159 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 ...
user avatar
  • 417
6 votes
1 answer
167 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 ...
user avatar
2 votes
1 answer
86 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 ...
user avatar
  • 121
0 votes
1 answer
58 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 ...
user avatar
2 votes
0 answers
51 views

Defining new Domain for variables

I am trying to define a new Domain for variables to use with functions like FindInstance or Solve. For example, If I wanted to solve x+y+z=1 over the Reals, I'd get a large solution space. But If I ...
user avatar
7 votes
1 answer
124 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: ...
user avatar
3 votes
2 answers
223 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 ...
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
2 votes
2 answers
150 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 ...
user avatar
5 votes
1 answer
53 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.
user avatar
  • 5,280
1 vote
0 answers
54 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\}$ ...
user avatar
  • 147
0 votes
1 answer
52 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
user avatar
4 votes
2 answers
169 views

Decompose set into elements?

Given a list of tuples where one element is a set: ...
user avatar
7 votes
2 answers
149 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 ...
user avatar
3 votes
0 answers
46 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 ...
user avatar
  • 1,018
0 votes
1 answer
36 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 ...
user avatar
1 vote
1 answer
93 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 ...
user avatar
3 votes
3 answers
177 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$ ...
user avatar
  • 20.4k
1 vote
4 answers
158 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/...
user avatar
0 votes
1 answer
102 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 ...
user avatar
4 votes
3 answers
90 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 ...
user avatar
  • 465
9 votes
4 answers
542 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 ...
user avatar
  • 2,020
3 votes
2 answers
917 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: ...
user avatar
  • 2,975
1 vote
1 answer
211 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 <...
user avatar
  • 125
1 vote
1 answer
111 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}\...
user avatar
  • 1,723
3 votes
1 answer
118 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 ...
user avatar
  • 151
0 votes
2 answers
76 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 ...
user avatar
  • 141
3 votes
2 answers
206 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 ...
user avatar
2 votes
1 answer
95 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 ...
user avatar
  • 21
4 votes
1 answer
138 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 ...
user avatar
  • 1,505
0 votes
1 answer
47 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}$...
user avatar
7 votes
5 answers
490 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: ...
user avatar
  • 14.6k
2 votes
1 answer
73 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 ...
user avatar
0 votes
2 answers
370 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 ...
user avatar
  • 4,391
0 votes
1 answer
88 views

Why is Resolve not reducing my set?

I tried to run the following code to get the region where (v,b,r) satisfies some complicated set of inequalities. ...
user avatar
1 vote
0 answers
51 views

How to preserve braces in result

I have a result from equation, for example p={{0<=x<=1/5||x==9/10},{0<=x<=1/5||x==9/10}} and using Cases[p, z_?NumericQ -> z, Infinity] I get {0,1/5,9/10,0,1/5,9/10} But I ...
user avatar
1 vote
0 answers
712 views

How to add brackets to list [closed]

I have for example set of points p={1/5,1/2} and I would like to add brackets to the list, so I would like to get a set of points p2={{1/5},{1/2}} I know how to remove brackets, but I cant ...
user avatar
0 votes
0 answers
103 views

How to perform delayed evaluation containing function with Mathematica

I was wondering whether there is a way in Mathematica to evaluate an expression in the most simple form, without any simplifying. For example if we define: ...
user avatar
0 votes
0 answers
183 views

Mathematica complement of a region

I want to use Reduce Function to give me intersection of a region and complement of another region The first region is: ...
user avatar
0 votes
1 answer
80 views

Testing a description of the Cantor ternary set

The Cantor ternary set (aka the Cantor discontinuum) is, as usual, the set $K = \bigcap_{n=0}^{\infty} K_{n}$ where $K_{0} = [0, 1]$, the closed unit interval, and where for each $n \geq 1$ the set $...
user avatar
  • 11.3k
0 votes
0 answers
92 views

Iterating over pairs in a list

Take a look at this code: ...
user avatar
  • 101
-1 votes
1 answer
95 views

Operations between sets of integers [closed]

sorry it was impossible to put the code in Latex, he said that there were problems of indentation, I put the image
user avatar
  • 149
1 vote
0 answers
52 views

Defining an abstract multiplication over finite indices

I would like to define a map (a "multiplication" denoted $\otimes$) over the finite set of symbols $G=\{a,b,c,d,e,f,g,h\}$. I would like to define several rules like $$a \otimes b= \{b \} $$ $$a \...
user avatar
0 votes
1 answer
94 views

Delete duplicates and sort a list of sets separately? [closed]

I have a set where it has three subsets. I want to have each element of each subsets appears only once, sorted, but the order of subsets does not change. For example: I want to get from $$ \{\{5,2,2,3\...
user avatar
  • 798
6 votes
3 answers
1k views

Is there a simple way to perform the opposite of intersection on two lists?

By "opposite of intersection" I mean that if I have two lists like so: list1 = {1,2,4,7,9}; list2 = {1,4,9,10,11} And then we do the "Reverse Intersection" on ...
user avatar
1 vote
1 answer
75 views

How do I simplify operations on sets?

How would I use Mathematica to simplify: S'∩(S∪T')' The answer is S'∩T Edit: S' means Complement of S. Thanks! Solved with: BooleanConvert[! S && ! (S || ! T)]
user avatar
1 vote
1 answer
48 views

Set of order preserving functions

I have a partial order defined on a finite set, 13 elements, represented as a directed graph. I'm trying to work with the set of order preserving functions from this poset into a finite subset of the ...
user avatar
  • 33