Cartesian Product Constructor and Functions

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

car< R1, ..., Rk > : Str, ..., Str -> SetCart
Given a list of sets or algebraic structures R1, ..., Rk, construct the cartesian product set R1 x ... x Rk.
CartesianProduct(R, S) : Str, ..., Str -> SetCart
Given structures R and S, construct the cartesian product set R x 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 Rk.
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 Tuple_CartesianProduct (H12E1)

We create the product of Q and Z.
> C := car< RationalField(), Integers() >;
> C;
Cartesian Product<Rational Field, Ring of Integers>
V2.28, 13 July 2023