powerset: Calculate a Set's Powerset

Description Usage Arguments Details Value See Also Examples

View source: R/operation_powerset.R

Description

Calculates and returns the powerset of a Set.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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

set6 documentation built on Oct. 18, 2021, 5:06 p.m.