polynomials_on_simplices.set_theory module¶
Basic set theoretic calculations.
-
cartesian_product
(s, t)[source]¶ Compute the Cartesian product of two finite sets, \(S \times T\).
Parameters: Returns: The Cartesian product of the two sets.
Return type: >>> prod = cartesian_product({1, 2}, {1, 2}) >>> prod == {(1, 1), (1, 2), (2, 1), (2, 2)} True
-
nfold_cartesian_product
(s, n)[source]¶ Compute the n-fold Cartesian product of a finite set, \(\underbrace{S \times S \times \ldots \times S}_{n \text{ times}}\).
Parameters: - s – Set we take the n-fold Cartesian product of.
- n (int) – Number of times we take the Cartesian product.
Returns: n-fold Cartesian product of the given set.
Return type: >>> prod = nfold_cartesian_product({1, 2}, 3) >>> prod == {(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)} True