I was trying add ones to some specific position in a 100*100 zero matrix. My code was something this:  adjacency=[[0]*100]*100 while ...     x=...     y=...     adjacency[x][y]=adjacency[x][y]+1   But it adds to other positions as well. In face, adjacency[0]=adjacency[1]=..=adjacency[99], while there's no way that the calculation of x, y in while-loop will produce this kind of result.  So, I changed to array. The only thing I changed was:  adjacency=np.zeros((100,100))  And the result is right this time. Adjacency[i] no longer equals to each other.  Does anyone know why? (Using Python2.7.)
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?
As far as I know, it's possible to create a radially polarised ring magnet, where one pole is on the inside, and the field lines cross the circumference at right angles.    So imagine if I made one which was shaped like a sector of a torus.    Then I forced a load of these magnets into a complete torus.     Clearly this magnet is impossible because there's no way for the field lines to get back into the middle. So what happens to the field in this case? Does it disappear completely? Do the magnets blow up? It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root.  Upon running sudo -i, sudo will create an environmental variable called SUDO_USER, which contains the original user's username.  Is there a way to log ALL commands within syslog with something akin to the following syntax:  ${TIME/DATE STAMP}: [${REAL_USER}|${SUDO_USER}]: ${CMD}   An example entry would be:  Sat Jan 19 22:28:46 CST 2013: [root|ksoviero]: yum install random-pkg   Obviously it doesn't have to be exactly the above syntax, it just has to include a minimum of the real user (eg. root), the sudo user (eg. ksoviero), and the full command that was run (eg. yum install random-pkg).  I've already tried snoopy, but it did not include the SUDO_USER variable. Elementary derivation of certian identites related to the Riemannian Zeta function and the Euler-Mascheroni Constant Is the proof of these identities possible, only using elementary differential and integral calculus? If it is, can anyone direct me to the proofs? ( or give a hint for the solution )  1)$$\int_0^\infty { e^{-x^2} \ln x }\,dx = -\tfrac14(\gamma+2 \ln 2) \sqrt{\pi} $$  2)$$\int_0^\infty { e^{-x} \ln^2 x }\,dx = \gamma^2 + \frac{\pi^2}{6} $$  3) $$\gamma = \int_0^1 \frac{1}{1+x} \sum_{n=1}^\infty x^{2^n-1} \, dx$$  and lastly,  4) $$\zeta(s) = \frac{e^{(\log(2\pi)-1-\gamma/2)s}}{2(s-1)\Gamma(1+s/2)} \prod_\rho \left(1 - \frac{s}{\rho} \right) e^{s/\rho}\!$$  I personally think the last is obtained from a simple use of the Weierstrass factorization theorem. I'm unsure as to what substitution is used.  $\gamma$ is the Euler-Mascheroni constant and $\zeta(s)$ is the Riemannian Zeta function.  Thanks in advance. Does leaning (banking) help cause turning on a bicycle? Maximum power transfer proof I have the following homework problem.  Consider a power supply with fixed emf $ε$ and internal resistance $r$ causing current in a load resistance $R$. In this problem, $R$ is fixed and $r$ is a variable. The efficiency is defined as the energy delivered to the load divided by the energy delivered by the emf.  When the internal resistance is adjusted for maximum power transfer, what is the efficiency?  The answer is 50% but I'm confused how this is calculated. Here is my thought process so far.  The power dissipated in the load is $I^2R$ and $\displaystyle I = \frac{ε}{r+R}$ so $\displaystyle P = \frac{ε^2R}{(r+R)^2} = \frac{ε^2}{\frac{r^2}{R} + 2r + R}$ and so power transferred to the load will be maximum when $\displaystyle \frac{r^2}{R} + 2r + R$ is a minimum. Taking the first derivative $\displaystyle \frac {d}{dr}(\frac {r^2}{R} + 2r + R) = (\frac{2r}{R} + 2)$ and this equals 0 when r = -R. The second derivative is $\displaystyle \frac{2}{R} &gt; 0$ so this point would be a minimum and therefore max power transferred when r = -R.  But having $r = -R$ doesn't make sense to me. From what I read, for maximum power transfer $r$ should equal $+R$. So I've probably done something wrong in my calculations or assumptions in the previous paragraph. Also wouldn't max power be transferred when the internal resistance is as close to zero as possible?  Can someone please show me a proof that shows why $r = R$ for max power transfer and then how to calculate the efficiency. The storage on my iPhone is nearly full. Most of the space is used by apps. I'd like to see which apps consume the most space on my device.  Is there a way to get a list of the apps with their corresponding used space? By "used space I mean the installation size (bonus for added user data). I have a atmega8 that is working with 3.6V dc, I need to control some 12V relays with a not chip (7404), what is the simplest way to do this? I have connected a 12V dc to the relays, so when I connect the relays to the chip and then the atmega8, the current returns to the atmega through the not chip. Is this solution correct? There a better way to do this? This might seem like a very simple question, but what is the easiest way to turn a normal vertical list into a horizontal one? Where did the "wheel" group get its name? The wheel group on *nix computers typically refers to the group with some sort of root-like access. I've heard that on some *nixes it's the group of users with the right to run su, but on Linux that seems to be anyone (although you need the root password, naturally). On Linux distributions I've used it seems to be the group that by default has the right to use sudo; there's an entry in sudoers for them:  %wheel ALL=(ALL) ALL     But that's all tangential; my actual question is: Why is this group called wheel? I've heard miscellaneous explanations for it before, but don't know if any of them are correct. Does anyone know the actual history of the term? The direct sum $\oplus$ versus the cartesian product $\times$ In the case of abelian groups, I have been treating these two set operations as more or less indistinguishable. In early mathematics courses, one normally defines $A^n := A\times A\times\ldots\times A$; however in, for example, the fundamental theorem of finitely generated abelian groups, we normally write that every such group is isomorphic to one of the form $$ \mathbb{Z}^n \oplus \mathbb{Z}_{r_1} \oplus \cdots \oplus \mathbb{Z}_{r_t}  $$ where $\mathbb{Z}^n$ now means $\mathbb{Z}\oplus\mathbb{Z}\oplus\cdots\oplus\mathbb{Z}$.  From an intuition perspective, and in the sense of sets, is this more or less the same as $\mathbb{Z}\times\mathbb{Z}\times\cdots\times\mathbb{Z}$? (Bear in mind I am normally using these ideas in relation to homology groups.) If $\frac{\cos x}{\cos y}+\frac{\sin x}{\sin y}=-1$, then what's the value of $4\left(\frac{\cos^3y}{\cos x}+\frac{\sin^3y}{\sin x}\right)$? When writing a book and referring to a female and male aged 18–25, what term would be most appropriate? Boy and girl seem too young, whereas man and woman seem too old.  Example sentence:     A boy/man emerged from the shadows.   Edit: I think the word I am looking for is similar to 'guy' but less American and colloquial. Any thoughts? It would be similar to trying to be extremely careful or precise.   In French it would be "application", For example: "Qui est fait avec application".   Example usage:      John worked with ________. or ...it was done with _______. I've just updated to the latest Google Chrome Dev build, and they've changed from the annoying-but-ok new tab page to an ugly and less usable page.  On the old one, nine thumbnails was not enough, and now they've restricted it to eight.  There's an empty "Tips and Suggestions" box which I wouldn't want even if it had stuff in; they've added Recent Downloads - on the rare occasions when I need that, I'll hit Ctrl-J to open the Downloads tab; and the site-specific search box on the right has now gone!  Is there a way to get the old new tab page back, or a plugin to provide a superior one?   Update: I launch Chrome by pressing Win+R and entering "chrome" - I have a shortcut on the Path with a Target of "C:\Documents and Settings\&lt;user&gt;\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --old-new-tab-page and whilst double-clicking this shortcut brings up the previous new tab page, using the keyboard method results in the old one.  How do I get it working via the Run box? (Without using a batch file, which slows things down too much.)  Update 2: GRRR! Now they've gone and stopped the --old-new-tab-page parameter from working at all! I hate this new version of the page that they're forcing upon us - can anyone provide a method to get rid of it and get the decent page back? What is the volatile keyword useful for? At work today, I came across the volatile keyword in Java. Not being very familiar with it, I found . Given the detail in which that article explains the keyword in question, do you ever use it or could you ever see a case in which you could use this keyword in the correct manner? I'm a big fan of the votes tab in the profile page, as it allows me to keep track of my usage of the moderation tools. Or at least it would, if votes cast on deleted posts didn't unceremoniously disappear.  Although I don't like it, I can live with that for (up|down|close|reopen)-votes. In fact, I didn't even notice it before gaining 10k rep on SU. But it renders the deletion and undelete subtabs pretty much useless, since it hides – by design – all successful deletion and (yet) unsuccessful undeletion votes.  @slhck suggested in an answer to  the following rationale for this behavior:     While this sounds strange, it's just a result of the … let's call it "Stack Exchange policy" of not showing lists of deleted posts to non-moderators. In my opinion this policy is a little incoherent, because your flagging record shows deleted posts [...]   Actually, the flagging record shows deleted posts to pretty much all users. So does the reputation tab of the user profile (as long as you earned/lost reputation on that post).  If that is in fact the reason, why can't a 10k user see a list of posts he voted on (and thus, already saw)? Completion of rational numbers via Cauchy sequences Can anyone recommend a good self-contained reference for completion of rationals to get reals using Cauchy sequences? Adding my launcher to the Unity Launcher automatically. How? What is the shortcut for opening a new window (opening folders). for that I have to go to folder options and right click and then need to click on open new window.  or I have to make focus on the folder icon or open a folder then press  Ctrl+N  for opening a new window is there any direct command spcific to open a new window in ubuntu. What is the purpose of the word 'self'?