Let a be a 2-dimentional list with each element being a set. For example, let a be a (3,3) list, I initialize as follows a = [set()] * 3 a = [a] * 3  I now want to assign a[1][1] with another set. I do a[1][1] = set([1,2,3])  But in doing this, not only a[1][1], but also a[0][1] and a[2][1] are assigned to this new set. It's so weird to me. How does this happen? How should I correct it? Thanks!!  I set a to be a 2D list array because I want a to work like a = cell(3,3) as in Matlab.
410
I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?
18193
How would one denote the set of all subsets of $A$ which have size $2$?  Would  $$\binom{A}{2}$$  be a good idea?
78303
$$u = (r,1,1), \ v = (1,s,2s), \ w = (1,2,2)$$  I know to assume the set will be linearly dependent, equate them to the $0$ vector and find the values not equal to what $r$ and $s$ is. But I can't seem to reduce the matrix to echelon form.  I've gotten to the point of:  $$     \begin{pmatrix}     r &amp; 1 &amp; 1 \\     1 &amp; s &amp; 2 \\     1 &amp; 2s &amp; 2 \\     \end{pmatrix} $$  $R_2 = R_2 - R_3$ $$     \begin{pmatrix}     r &amp; 1 &amp; 1 \\     1 &amp; -s &amp; 0 \\     1 &amp; 2s &amp; 2 \\     \end{pmatrix} $$ $R_3 = R_3 +2R_2$  $$     \begin{pmatrix}     r &amp; 1&amp; 1 \\     0 &amp; -s &amp; 0 \\     1 &amp; 0 &amp; 2 \\     \end{pmatrix} $$  EDIT: Thank you @LordSharktheUnknown  $R_3 = r \times R_3 - R_1$  $$     \begin{pmatrix}     r &amp; 1 &amp; 1 \\     0 &amp; -s &amp; 0 \\     0 &amp; -1 &amp; 2r-1 \\     \end{pmatrix} $$  And I'm stuck. I know $s ≠ 0$ for it to be linearly independent but I have no idea how to reduce the rows any further to get to $r$ by itself.  Any help is appreciated.  Thank you.
74245
In the  book on pg 130, they mention that an Array's length is fixed when you initialize it and that multidimensional arrays are not supported. I just tried using the .add function on an array and it worked so I'm sure what they are talking about, but I couldn't make an array of arrays (which could have just been because I didn't have the right syntax). Ignoring syntax errors, there seems to be some sort of difference and thus maybe an (even if just slight) advantage to using one over the other?
35739
I just wonder if my following solution is true. Let $X,Y$ be sets, let $f:X\to Y$ be a function, let $\{Y_i\}_{i\in I}$ be a family of subsets of $Y$. (Note: I use equalities instead of mutual containment) $$\begin{align}f^{-1}\left[\bigcup_{i\in I} Y_i\right]  &amp;= \{x \in X: \mbox{there exists an}\quad i \in I\mbox{ such that } y \in Y_i,f(x)=y\}  \\&amp;=\bigcup_{i \in  I} f^{-1}\left[Y_i\right] \end{align}$$ I initially do not know how to get from the left to right, but when I put both sets in set notation, they turn out to be the same, hence the one line proof. Something go ultimately wrong?
103126
I dont know the concept or how to answer the question.     Suppose there are two sets, $X=\{1,2\}$ and $Y=\{a,b\}$.         What are all the ordered pairs in the form of (element of $X$, element of $Y$)?   What are all the ordered pairs in the form of (element of $Y$, element of $X$)?
100685
Is there an easy way of finding the neighbours (that is, the eight elements around an element) of an element in a two-dimensional array? Short of just subtracting and adding to the index in different combinations, like this:  array[i-1][i] array[i-1][i-1] array[i][i-1] array[i+1][i]   ... And so on.
94519
Is it possible in c# to initialize an array in, for example, subindex 1?  I'm working with Office interop, and every property is an object array that starts in 1 (I assume it was originally programed in VB.NET), and you cannot modify it, you have to set the entire array for it to accept the changes.  As a workaround I am cloning the original array, modifying that one, and setting it as a whole when I'm done.  But, I was wondering if it was possible to create a new non-zero based array
9688
Is this true?  If $A$ and $B$ are sets, then $A=\emptyset $ if and only if $B = A \bigtriangleup B$.  If $A=\emptyset$ then $B=\emptyset$ too?  Could someone help me please?
113672
For example:  &gt;&gt;&gt; x = [1, 1, 2, 'a', 'a', 3] &gt;&gt;&gt; unique(x) [1, 2, 'a', 3]   Assume list elements are hashable.  Clarification: The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].
16314
Greetings Community! The above problem you see is a combinatorics problem I could not solve. :( This problem is from ZIO $2010$, P$1$.     Here is what I did: Observe that every graph can be divided into "sub-groups" which may help in solving. We first remove the empty set. Then the singleton set. Consider the bigger but smaller than the sub-parts example:    The singleton sets are $\{4,5,6\}$ which are at the least position in the graph.   The dual sets are $\{2,4\}, \{3,5\}, \{3,6\}$, the bottom - two portions in the graph. The triplet sets are $\{2,4,5\}, \{4,5,6\}$ which we may manually count but for the bigger graphs in the sub-part, this may prove to be difficult and this is where I am stuck.   Any help would be appreciated. Thanks.
28573
I want to make an enumerated list in the following format:  [1] foo foo [2] foo foo ...    How I can do that using enumerated lists? I have tried the following:  \begin{enumerate}[\left[ 1 \right]]   but it does not work.
85227
I have been wrestling with an exercise concerning latin squares from the textbook A First Course in Discrete Mathematics by Ian Anderson. The exercise is formulated thus:     A set $S$ of $mn$ elements is partitioned into $m$ sets of size $n$ in     two different ways: $S = A_1 \cup ... \cup A_m = B_1 \cup ... \cup   B_m$. Show that the sets $B_i$ can be relabelled so that $A_i \cap B_i   \neq \emptyset$ for each $i = 1, ..., m$. [Hint: consider the sets   $S_i = \{ j : A_i \cap B_j \neq \emptyset\}$.]   I am not sure how to prove this. Here is an example I have completed:  Let $S = \{1,...,25\}, m = 5, n = 5$ and let $$(s_{mn}) =  \begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\ 6 &amp; 7 &amp; 8 &amp; 9 &amp; 10 \\ 11 &amp; 12 &amp; 13 &amp; 14 &amp; 15 \\ 16 &amp; 17 &amp; 18 &amp; 19 &amp; 20 \\ 21 &amp; 22 &amp; 23 &amp; 24 &amp; 25 \end{pmatrix}$$.  Furthermore, let $$A_1 = \{1,6,11,16,21\}, A_2 = \{2,7,12,17,22\}, A_3 = \{3,8,13,18,23\}, A_4 = \{4,9,14,19,24\}, A_5 = \{5,10,15,20,25\}. $$  $$B_1 = \{1,2,3,4,5\}, B_2 = \{6,7,8,9,10\}, B_3 = \{11,12,13,14,15\}, B_4 = \{16,17,18,19,20\}, B_5 = \{21,22,23,24,25\}.$$  Furthermore, $S_1 = S_2 = S_3 = S_4 = S_5 = \{1,2,3,4,5\}$.  I can e.g. relabel the $B_i$s so that $B_1$ becomes $B_2$ etc. and $B_5$ becomes $B_1$ and thus get:  $$(s_{mn}) =  \begin{pmatrix} 21 &amp; 22 &amp; 23 &amp; 24 &amp; 25 \\ 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\ 6 &amp; 7 &amp; 8 &amp; 9 &amp; 10 \\ 11 &amp; 12 &amp; 13 &amp; 14 &amp; 15 \\ 16 &amp; 17 &amp; 18 &amp; 19 &amp; 20 \\ \end{pmatrix}$$.  Then the condition $A_i \cap B_i \neq \emptyset$ still holds for each $i = 1,...,m$.  I guess I in some kind of way have to use Hall's theorem:     The sets $A_1,...,A_m$ possess an SDR if and only if they satisfy the Hall condition.
94919
Given two sets$$A=\{1,3,5\}\quad,\quad B=\{1,3,8\}.$$ Then I compute the $A\setminus B=\{5\}.$   But my book$^\dagger$said: ... . Also, observe that $x\notin A\setminus B$ does not mean that $x\notin A\lor x\in B$. Why?  I don't know how to explain the Why, please give me some example.    $^\dagger$, second edition, page $4$.  EDIT: My intuition tells me that it does mean that. I guess there is some special case about null-set or about the restriction of the universal set.
5742
I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value.  I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax?
31018
Is "empty set" an element of a set? For example:  is this FALSE?:  0 ∈ {1,2,3}
17043
I have a Python script which takes as input a list of integers, which I need to work with four integers at a time.  Unfortunately, I don't have control of the input, or I'd have it passed in as a list of four-element tuples.  Currently, I'm iterating over it this way: for i in range(0, len(ints), 4):     # dummy op for example code     foo += ints[i] * ints[i + 1] + ints[i + 2] * ints[i + 3]  It looks a lot like &quot;C-think&quot;, though, which makes me suspect there's a more pythonic way of dealing with this situation.  The list is discarded after iterating, so it needn't be preserved.  Perhaps something like this would be better? while ints:     foo += ints[0] * ints[1] + ints[2] * ints[3]     ints[0:4] = []  Still doesn't quite &quot;feel&quot; right, though.  :-/ Related question: