# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Get a list of subsets of a list along with their complements

Contributed by:
Seth J. Chandler

ResourceFunction["SubsetsWithComplements"][ gives a List of all possible subsets of | |

ResourceFunction["SubsetsWithComplements"][ gives all subsets containing at most | |

ResourceFunction["SubsetsWithComplements"][ gives all subsets containing exactly | |

ResourceFunction["SubsetsWithComplements"][ gives all subsets containing between | |

ResourceFunction["SubsetsWithComplements"][ limits the result to the first | |

ResourceFunction["SubsetsWithComplements"][ gives, if possible, the |

The permissible argument specifications are exactly the same as for Subsets.

Get all the subsets of a List of characters, paired with their complements:

In[1]:= |

Out[1]= |

Take a List of three characters and get all the one-element subsets thereof and their complements:

In[2]:= |

Out[2]= |

Get all subsets from a List of five characters with at most two elements, along with their complements:

In[3]:= |

Out[3]= |

Take a List of five characters and get all subsets with between two and three elements and their complements:

In[4]:= |

Out[4]= |

Get the first three two-element subsets and complements from a list with six elements:

In[5]:= |

Out[5]= |

Get the seventh two-element subset and complements of a list with six elements:

In[6]:= |

Out[6]= |

Find and show conditions under which each expression in a List will have a value greater than that of any other expression in the list:

In[7]:= |

In[8]:= |

Out[8]= |

In[9]:= |

In[10]:= |

Out[10]= |

In[11]:= |

Out[11]= |

Do similarly for the lowest value of any expression in the List:

In[12]:= |

In[13]:= |

Out[13]= |

A certain classifier predicts the probabilities that a person will be in each of three possible classes. A misclassification results in a utility of –1, except when a person is really in the first class but is misclassified as being a member of the second class. This latter case results in a utility of –*u*, where *u* is some non-negative number. For each value of *u*, find and show the set of classifier probabilities {*p*_{1},(1–*p*_{1})*p*_{2},1–(*p*_{1}+(1–*p*_{1})*p*_{2})} that result in each prediction being the one that maximizes expected utility:

In[14]:= |

Out[14]= |

In[15]:= |

Out[15]= |

In[16]:= |

Out[16]= |

- 1.0.0 – 19 October 2020

This work is licensed under a Creative Commons Attribution 4.0 International License