setPowerset

setPowerset(set)

Try it yourself:


Generate all subsets with setPowerset

setPowerset returns the power set: every possible subset of an input set, including the empty set and the full set.

Example

A three-member set has eight subsets. This is useful for exhaustive feature choices and small combinatorial searches. Compare combinations when only subsets of one size are needed, and setCartesian for ordered cross-combinations.

Growth caveat

A set of n members produces 2^n subsets, so output becomes enormous quickly. Check setSize first and deduplicate with setDistinct. Avoid powerset for large inputs unless a constrained search is intended.

Try Set Powerset in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions