### The Maxima on-line user's manual

Algebra Calculator

#### Subset

Function: subset (<a>, <f>) Returns the subset of the set <a> that satisfies the predicate <f>.

`subset` returns a set which comprises the elements of <a> for which <f> returns anything other than `false`. `subset` does not apply `is` to the return value of <f>.

`subset` complains if <a> is not a literal set.

See also `partition_set`.

Examples:

```          (%i1) subset ({1, 2, x, x + y, z, x + y + z}, atom);
(%o1)                     {1, 2, x, z}
(%i2) subset ({1, 2, 7, 8, 9, 14}, evenp);
(%o2)                      {2, 8, 14}```

There are also some inexact matches for `subset`. Try `?? subset` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### subset

subset;

{20000, 47650, 54000...

Calculate

subset;

{1,2,3,4};

Calculate

subset;

{2,3,4,5};

Calculate

subset;

{1,2,3,4,5,6};

Calculate

? subset;

Calculate

##### subset

subset;

{1,2,3,4,5,6,7,8,9,1...

{2,7,11};

Calculate

##### subset

subset;

{1,2,3,4,5,6,7,8,9,1...

{2,7,11};

Calculate

##### subset

subset;

{18897109, 12828837,...

Calculate

subset;

{1,2,3};

Calculate

subset;

{8,1,2};

Calculate