sage: X = set([1,19,'a']); Y = set([1,1,1, 2/3]) sage: X set(['a', 1, 19]) sage: Y set([1, 2/3]) sage: 'a' in X True sage: 'a' in Y False sage: X.intersection(Y) set([1])
Sage also has its own set type that is (in some cases)
implemented using the built-in
Python set type, but has a little bit of extra Sage-related
functionality. Create a Sage set using Set(...). For example,
sage: X = Set([1,19,'a']); Y = Set([1,1,1, 2/3])
sage: X
{'a', 1, 19}
sage: Y
{1, 2/3}
sage: X.intersection(Y)
{1}
sage: print latex(Y)
\left\{1, \frac{2}{3}\right\}
sage: Set(ZZ)
Set of elements of Integer Ring
See About this document... for information on suggesting changes.