powerSet: Calculate a Set's Powerset

powersetR Documentation

Calculate a Set's Powerset

Description

Calculates and returns the powerset of a Set.

Usage

powerset(x, simplify = FALSE)

Arguments

x

Set

simplify

logical, if TRUE then tries to simplify the result to a Set otherwise creates an object of class PowersetSet.

Details

A powerset of a set, S, is defined as the set of all subsets of S, including S itself and the empty set.

Value

Set

See Also

Other operators: setcomplement(), setintersect(), setpower(), setproduct(), setsymdiff(), setunion()

Examples

# simplify = FALSE is default
powerset(Set$new(1, 2))
powerset(Set$new(1, 2), simplify = TRUE)

# powerset of intervals
powerset(Interval$new())

# powerset of powersets
powerset(powerset(Reals$new()))
powerset(powerset(Reals$new()))$properties$cardinality

xoopR/set6 documentation built on Sept. 2, 2023, 4:45 a.m.