Message Boards Message Boards


Calculating Powersets

Posted 8 years ago
1 Reply
0 Total Likes

I have to sets A={1,2,3} and B={a,b,c,d,e}. I want the set of subsets of elements from both A and B that contain at least one element of A and one element of B. I wanted to calculate it using the following formula:


I tried the following query:

Subsets[{1,2,3} union {a,b,c,d,e}]/(Subsets[{1,2,3}] union Subsets[{a,b,c,d,e}])

But, unfortunately, Wolframalpha doesn't understand my query.

Is there any other way?

POSTED BY: dolbik

Try explicitly using the named Wolfram language functions Union and Complement with square brackets.

In Mathematica the following works (dropping the empty set):

Complement[Subsets[{1, 2, 3, a, b, c, d, e}], {#} & /@ {1, 2, 3, a, b, c, d, e}]
POSTED BY: David Gathercole
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract