# Tag Info

Accepted

### Efficient deletion of specific list entries

This is a solution that reorders elements. ...
Accepted

### Maps between finite sets

alist = {3, 4, 5}; blist = {"a", "b"}; mapfs = Tuples@Outer[Rule, blist, alist] \begin{array}{l} \{\text{a}\to 3,\text{b}\to 3\} \\ \{\text{...
• 56.2k

### How can I define operators that implement the algebra of sets?

Here is one idea. Convert the set expression into an equivalent boolean expression, use BooleanMinimize to simplify the boolean expression, and then convert back to ...
• 131k
Accepted

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

There is probably a build-in command for this, but with over 6,000 commands, hard to search now. But you could try ...
• 149k

### How to stretch this Venn diagram?

I get a decent looking result with: ...
• 20.8k
Accepted

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

Select+ ContainsNone Select[Apply[ContainsNone]]@lis {{{a}, {b, c, d}}, {{b}, {d}}, {{a, b}...
• 400k
Accepted

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

The tedious part of this is writing all the equations ...
• 16.8k

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

I am sure there are many ways to do this. One possible way is to take the union of both sublists, and check if its length is same as sum of length of both sublists. Since when making union, duplicates ...
• 149k

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

Another method with DuplicateFreeQ, where @* is shorthand/infix notation for Composition. <...
• 7,880
Accepted

### What Does CompileSetIterate Do?

It sets an iterator: cfun = Compile[{{n, _Integer}}, Table[If[x == 2, CompileSetIterate[x, 4]]; x, {x, n}] ] Note that 2 ...
• 241k
Accepted

### Non-flat partitions of a set

Why not use Quotient to figure out what row each element belongs to, and then make sure there are no duplicates? For example: ...
• 131k

...
• 161k
Accepted

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

Edit According to the comment, we should divide the 8 element to 4 pairs. Select[list, And @@ (GCD @@@ Partition[#, 2] == 1 // Thread) &] Original ...
• 79.8k

### How to select minimal subsets?

Since @DanielLichtblau used Internal`ListMin in an answer to a recent question, I will use it in an answer to this question. Given the following partial order on ...
• 131k

### Efficient deletion of specific list entries

This will maintain order but is notably slower than the method provided by @HenrikSchumacher. The idea is to create down values of counts for the second list, then decrement said counts when they ...
• 59.9k

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

Position[MapThread[Greater, {a, b}], True] (* {{1}, {2}, {4}, {7}, {8}} *)
• 49.3k

### Mathematica code for q-Stirling numbers

On second thought, it is much more convenient to use Theorem 4.5 of the paper as a definition, so ...
• 3,535
Accepted

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

There is an answer about how to create Venn diagrams here: Create a Venn Diagram. I'm using VennDiagram[] function from Method 2. Let's firstly create the sets. <...
• 834

### Maps between finite sets

There's no built-in function but the following constructs the mappings: ...
• 241k
Accepted

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

There are two separate issues here: How to get Mathematica to choose the root properly? How to flip the plot so arrow point up? The default layout for trees is ...
• 236k
Accepted

### How to plot this set of complex numbers?

The domain of the mapping 1/z is ...
• 1,232
Accepted

### How to pick elements from a list with variable condition

How about: Pick[M, LessEqualThan[1] /@ Max /@ Abs[M.Transpose[A]]] {{0, 0, 0, 1}, {-(1/2), -(1/2), -(1/2), 1/2}, {-(1/2), 1/2, 1/2, 1/2}, {1/ 2, -(1/2), 1/...
• 131k

...
• 400k

### Efficient deletion of specific list entries

Short but not efficient: f = Fold[DeleteCases[##, 1, 1] &]; {a, b} = {{1, 2, 1, 3, 1, 3, 4, 5}, {6, 1, 3, 1, 5}}; f[a, b] {2, 1, 3, 4} Slightly longer ...
• 400k
Accepted

• 400k

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

You need to use DeleteDuplicates after you Flatten the list, otherwise it will not work properly (if duplicates are in different ...
• 34.4k
Accepted

...
• 161k

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

(1) Pick, IntersectingQ lis//Pick[#,MapApply[IntersectingQ,#],False]& (* {{{a}, {b, c, d}}, {{b}, {d}}, {{a, b}, {c, d}}} *) (2) Pick, Intersection Syed has ...
• 21k
Accepted

...
• 400k