# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `combinat`::`powerset`

Subsets of a set

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```combinat::powerset(`S`)
```

## Description

If `S` is a set, `combinat::powerset(S)` returns the set of all subsets of `S`. If `l` is a list, `combinat::powerset(l)` returns the set of all sublists of `l`.

The powerset of a list `l` is the set of all lists that can be obtained by deleting some elements of `l` and leaving the others in order.

`combinat::powerset` has been overloaded for multisets of type `Dom::Multiset`. The powerset of a multiset `S` consists of all multisets that contain only elements occurring also in `S`, each of them at most as many times as it occurs in `S`.

## Examples

### Example 1

Given a finite set, `combinat::powerset` returns the powerset (set of all subsets) of the input:

`combinat::powerset({a, b, c})`

The same works for multisets:

`combinat::powerset(Dom::Multiset(a, a, b))`

### Example 2

The powerset of a list `l` of pairwise different elements is the same as the powerset of the set of these elements, except that it consists of lists in which the order of elements is the same as in `l`:

`combinat::powerset([c, a, b])`

In general, the powerset of a list `l` is the same as the powerset of the multiset of its elements, except that it consists of lists in which the original order is preserved:

`combinat::powerset([a, b, a])`

## Parameters

 `S` Set `l` List