Cartesian products

AUTHORS:

  • Nicolas Thiery (2010-03): initial version
class sage.sets.cartesian_product.CartesianProduct(sets, category, flatten=False)

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

A class implementing a raw data structure for cartesian products of sets (and elements thereof). See cartesian_product for how to construct full fledge cartesian products.

class Element(value, parent)

Bases: sage.structure.element_wrapper.ElementWrapper

summand_projection(i)

Returns the projection of self on the i-th summand of the cartesian product, as per Sets.CartesianProducts.ElementMethods.summand_projection().

INPUTS:

  • i – the index of a summand of the cartesian product

EXAMPLES:

sage: C = Sets().CartesianProducts().example(); C
The cartesian product of (Set of prime numbers (basic implementation), An example of an infinite enumerated set: the non negative integers, An example of a finite enumerated set: {1,2,3})
sage: x = C.an_element(); x
(47, 42, 1)
sage: x.summand_projection(1)
42
CartesianProduct.ElementWrapper
alias of ElementWrapper
CartesianProduct.an_element(*args, **kwds)

EXAMPLES:

sage: C = Sets().CartesianProducts().example(); C
The cartesian product of (Set of prime numbers (basic implementation), An example of an infinite enumerated set: the non negative integers, An example of a finite enumerated set: {1,2,3})
sage: C.an_element()
(47, 42, 1)
CartesianProduct.summand_projection(*args, **kwds)

Returns the natural projection onto the i-th summand of self as per Sets.CartesianProducts.ParentMethods.summand_projection().

INPUTS:

  • i – the index of a summand of self

EXAMPLES:

sage: C = Sets().CartesianProducts().example(); C
The cartesian product of (Set of prime numbers (basic implementation), An example of an infinite enumerated set: the non negative integers, An example of a finite enumerated set: {1,2,3})
sage: x = C.an_element(); x
(47, 42, 1)
sage: pi = C.summand_projection(1)
sage: pi(x)
42

Previous topic

ElementWrapper A class for wrapping Sage or Python objects as Sage elements

Next topic

Families

This Page