Cartesian Product Constructor and Functions#

The special constructor car< ... > is used for the creation of cartesian products of structures.

car< R₁, ..., Rₖ >: Str, ..., Str -> SetCart#

Given a list of sets or algebraic structures \(R_1, \ldots, R_k\), construct the cartesian product set \(R_1 \times \cdots \times R_k\).

CartesianProduct(R, S): Str, ..., Str -> SetCart#

Given structures \(R\) and \(S\), construct the cartesian product set \(R \times S\). This is the same as calling the car constructor with the two arguments \(R\) and \(S\).

CartesianProduct(L): [Str] -> SetCart#
CartesianProduct(L): <Str> -> SetCart#

Given a sequence or tuple \(L\) of structures, construct the cartesian product of the elements of \(L\).

CartesianPower(R, k): Str, RngIntElt -> SetCart#

Given a structure \(R\) and an integer \(k\), construct the cartesian power set \(R^{k}\).

Flat(C): SetCart -> SetCart#

Given a cartesian product \(C\) of structures which may themselves be cartesian products, return the cartesian product of the base structures, considered in depth-first order (see Flat for the element version).

NumberOfComponents(C): SetCart -> RngIntElt#

Given a cartesian product \(C\), return the number of components of \(C\).

Component(C, i): SetCart, RngIntElt -> Str#
C[i]: SetCart, RngIntElt -> Str#

The \(i\)-th component of \(C\).

Components(C): SetCart -> List#

The list of components of a cartesian product.

# C: SetCart -> RngIntElt#

Given a cartesian product \(C\), return the cardinality of \(C\).

Rep(C): SetCart -> Elt#

Given a cartesian product \(C\), return a representative of \(C\).

Random(C): SetCart -> Elt#

Given a cartesian product \(C\), return a random element of \(C\).

Example: Cartesian Product (ex-c2f16a)#

We create the product of \({\mathbb{Q}}\) and \({\mathbb{Z}}\).

> C := car< RationalField(), Integers() >;
> C;
Cartesian Product<Rational Field, Ring of Integers>

Run in calculator