ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 19 Oct 2011 03:55:48 +0200Enumerate elements of a set built using propertieshttps://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/How can I enumerate all the elements of a set?
For example (I'll use latex to describe the desired set) if the set is:
$$ W = \{ u_{i}[j], \overline{u}_{i}[j]: 1 \leq i \leq n, 1 \leq j \leq m \} $$
Tue, 18 Oct 2011 17:54:26 +0200https://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/Comment by benjaminfjones for <p>How can I enumerate all the elements of a set?</p>
<p>For example (I'll use latex to describe the desired set) if the set is:</p>
<p>$$ W = { u_{i}[j], \overline{u}_{i}[j]: 1 \leq i \leq n, 1 \leq j \leq m } $$</p>
https://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/?comment=21094#post-id-21094Explain what u_i[j] and \bar{u}_i[j] mean.Wed, 19 Oct 2011 02:18:07 +0200https://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/?comment=21094#post-id-21094Answer by Mike Hansen for <p>How can I enumerate all the elements of a set?</p>
<p>For example (I'll use latex to describe the desired set) if the set is:</p>
<p>$$ W = { u_{i}[j], \overline{u}_{i}[j]: 1 \leq i \leq n, 1 \leq j \leq m } $$</p>
https://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/?answer=12788#post-id-12788I don't know what your `u_i[j]`'s are, but you can do things like the following
sage: m = 2; n = 3
sage: [ (i,j) for i in range(m) for j in range(n)]
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)]
where you would replace `(i,j)` with the Python/Sage version of your `u_i[j]`'s.Wed, 19 Oct 2011 03:55:48 +0200https://ask.sagemath.org/question/8396/enumerate-elements-of-a-set-built-using-properties/?answer=12788#post-id-12788