When I do  &gt;&gt;&gt; a = [1]*3 &gt;&gt;&gt; a  [1,1,1] &gt;&gt;&gt; a[0] = a[0]+1 &gt;&gt;&gt; a  [2,1,1]   which is perfectly fine, but when I do the same with sets iget the following  &gt;&gt;&gt; a = [set()]*3 &gt;&gt;&gt; a [set([]), set([]), set([])] &gt;&gt;&gt; a[0].add(1) &gt;&gt;&gt; a  [set([1]), set([1]), set([1])]   Which is a very strange behaviour, any explanation for this?
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?
In JavaScript can I make a "click" event fire programmatically for a file input element? diameter on a compact metric space I have troubles showing the following:  Let $(X,\rho)$ be a compact metric space and $F \subset X$ a closed subset. Prove that if diam $F &lt; \infty$, then there exist $x_{0}, y_{0} \in F$ such that diam $F= \rho(x_{0},y_{0})$.  It looks so trivial yet hard to find the trick. Today I got what I presume was the update that should take care of Spectre and Meltdown. That didn't go very well. What do I do now? See screen photo.    I can't boot the 4.4.0-108-generic kernel because of a kernel panic. I'm running 16.04 on an Intel Core i5-4670K CPU @ 3.40GHz × 4. Apt-get update with an @ in password error I want to update ubuntu 11.04 throught apt-get. So I added the following lines in apt.conf  export http_proxy=http://username:password@proxyserver.net:port/ export ftp_proxy=http://username:password@proxyserver.netport/  export http_proxy=http://deepak:Deepak@123@12.1.1.1:3128   My question is: how do I insert special characters to a username or password?  For instance: my password for proxy is Deepak@123 and it is getting an error. What is postselection in quantum computing? A quantum computer can efficiently solve problems lying in the complexity class . I have seen a claim the one can (potentially, because we don't know whether BQP is a proper subset or equal to PP) increase the efficiency of a quantum computer by applying postselection and that the class of efficiently solvable problems becomes now postBQP = .  What does postselection mean here? Why do many anime not follow the manga? Why are they usually made shorter? Many anime do not follow the manga history and are made shorter. However there are a few that do follow it or try to finish the history with the manga like the big three (Naruto, Bleach, One Piece), Death Note, and FMA Brotherhood. But others finish the anime without the real ending like FMA, Ouran High School, Pandora Hearts, Tsubasa Reservoir Chronicle. Why is this so? Is it because of the high cost? Or the lack of popularity? Unexpected workspace change? My friend who has only recently downloaded blender has come across a workspace issue. He said he accidentally pressed a button and it has entirely changed his user interface/ Workspace. He can't open, save or do anything with the change.    This is a full window image! I'm looking for a programmers' editor. I know Xcode and I use it for application programming but I'm looking for something that will:   Syntax highlight PHP, SQL, Javascript (including jQuery) and CSS not required but would be nice; also Lua, Python, and Perl    IntelliSense type stuff, start typing and get all the functions/objects/variables it could be and any parameters. Xcode does this well for C/C++/Objective-C but looking for languages that are listed above. Would be nice if it worked with projects and not just files    Integrated with SVN, CVS, or GIT Had upload-to-server functionality built in   I am aware of  but am looking for other options before I drop 100 bucks. In a world without air, I understand they definitely would. However, with drag taken into account, I think they wouldn't. Since the drag force varies proportional to the square of speed (ignoring the change in coefficient of drag with speed), wouldn't the total impulse due to drag on a bullet fired from a gun from a specific height horizontal to ground be higher than the total impulse on an identical bullet dropped from the same height with no horizontal velocity?  Also, when bullet spin is taken into account, the bullet fired from a gun should resist change in orientation; therefore, it should maintain a small but non-zero angle of attack, and also have a lift force, correct? $X$ is a random variable, if $\Bbb E(X^2)=1$ and $\Bbb E(X)\geq a>0$, prove that $\Bbb P(X\geq\lambda a)\geq(a-\lambda a)^2$ for $0\leq\lambda\leq 1$. This is a problem in KaiLai Chung's A Course in Probability Theory.     Given a nonnegative random variable $X$ defined on $\Omega$, if $\mathbb{E}(X^2)=1$ and $\mathbb{E}(X)\geq a &gt;0$, prove that $$\mathbb{P}(X\geq \lambda a)\geq (a-\lambda a)^2$$   for $0\leq\lambda \leq 1$.   Let $A=\{x\in \Omega:X(x)\geq \lambda a\}$, we get $$\int_A (X-\lambda a)\geq a-\int_A\lambda a -\int_{A^c}X$$ and $$\int_A (X^2-\lambda^2 a^2)=1-\int_A\lambda^2a^2-\int_{A^c}X^2$$ I want to contrast $\int_A (X-\lambda a)$ and $\int_A (X^2-\lambda^2 a^2)$, but I don't know how to do it, could anyone gives me some hints? Convergence of exponential Brownian martingale to zero almost surely Define the exponential Brownian martingale as $N_t = \exp\left\{a W_t - \frac12 a^2 t \right\}$ which is a martingale with respect to the natural filtration of $W$ which stands for a standard Brownian motion.  I now want to prove that $N_t \rightarrow 0$ a.s. for $t \rightarrow \infty$. As $N_t$ is a martingale it is by definition in $L^1$ hence Doob's martingale convergence theorem tells us that there exists a $N_\infty \in L^1$ such that $N_t \rightarrow N_\infty$ a.s., but how could I prove that $N_\infty \equiv 0$? Any help is greatly appreciated! When I'm going through a whole bunch of shots to determine which to delete and which to flag, it's fastest for me to just keep both hands on the keyboard.  However, if I want to zoom in to 100% on a picture and then pan to a specific area, it seems I can only get halfway there -- 'Z' to zoom, but then I'm stuck having to pick up the mouse to pan around.  I was excited to find page-up/page-down/home/end can be used, but they seem to exist to provide an exhaustive, linear scrolling of the image, panning top-to-bottom then left-to-right, without unconstrained 2d movement.  Is there some way to toggle the arrow keys so they can pan instead of navigate to the next/prev photo?  Something else?  Or am I out of luck? How to reduce fireflies in Cycles? I often use Cycles' built in Glass BSDF shader to achieve realistic refraction effects, but in many cases, it seems that Cycles' glass caustics creates an unfortunately large number of fireflies (pixels that are abnormally bright relative to their surroundings). In some models of mine, even when I render for 3000 or more samples/pixel, my final image is still covered in fireflies. While I can improve this in many cases by increasing the total amount of light available in the scene, this loses a lot of the potency of the refractive effects I'm looking for, especially in scenes with low light levels.  So my question is, how can I reduce the amount of fireflies while using Cycles' caustics without sacrificing the quality of the refractive effects?  Note: I am aware that Cycles' caustics will perform much better once Cycles has full support for bidirectional path-tracing, but it looks unlikely that that will become , unfortunately. I'm taking an intro course in Probability theory, and we have just defined expectation for a random variable as $E(X) = E(X^+) - E(X^-)$ if either of them is finite (extending the definition first from simple positive rv to positive rv, and then to all rvs, positive or not).  Then I came across this result for the expectation of a positive random variable. Let $(\Omega, \mathcal{F}, P)$ be a probability space and $X \ge 0$ be a positive rv:  $$ E(X) = \int_{\Omega} X dP = \int_\Omega \int_0^\infty \mathbf{1}_{\{X &gt; t\}} dt  \, d P = \int_{0}^\infty P(X &gt; t) dt. $$ Actually, I'm familiar with this result, and the proof I've seen before involves converting $\int^\infty_0 P(X &gt; t) \, dt$ to a double integral. What I'm struggling with is the step $ \int_{\Omega} X dP = \int_\Omega \int_0^\infty \mathbf{1}_{\{X &gt; t\}} dt  \, d P $, and also the formal definition of an expectation itself.   I have no previous with integration or a "hard analysis" background, and the material covered so far in the course I'm taking has only used $\int_\Omega X dP$ as a notational device for $E(X)$. In general, any pointers to literature or "intuitive" explanations are more than welcome.  Thanks in advance! Confirming that my own question is a duplicate by voting to close should have immediate effect Someone voted to close my question as a duplicate. I agreed, so I cast my close vote (I have enough reputation to vote to close).  . So I expected this to happen.  But it didn't. This confused me — is this not a question I asked after all? No, it is. Maybe I need to reload the page? Nope, the question still isn't closed. Is the asker confirmation feature broken? Well, there's the “This question may already have an answer here” banner at the top. What if I click “That solved my problem!”? Ah, that does close the question.  It turns out that only clicking “That solved my problem!” instantly closes the question. Casting a close vote has a different effect, it's just an ordinary close vote.  Please make casting a close vote equivalent to clicking “That solved my problem!”. What is the difference between 32-bit and 64-bit Ubuntu? I've heard the 64-bit platform performs better and can detect more than 4GB of RAM. Also, while some apps haven't ported to 64-bit yet, ia32-libs lets a 64-bit machine run them.  If so, why not promote 64-bit over 32-bit? Does QGIS support true circular curves? Primitive of holomorphic Function $\frac{1}{z}$ on an Annulus. Given an Annulus with $A(0,r,R)$ show by considering Cauchy's Theorem for primitives that there is no holomorphic function with $f'(z)=\dfrac{1}{z}$.   I am struggling to picture this since but it seems like there are issues because $f(z)=\log z$ isn't well defined in the same range as $\dfrac{1}{z}$.  Am I looking to show that $\int_Ag(z)dz = 0$ where $g(z) = \dfrac{1}{z}$? Renormalized mass I am reading Schwarz QFT and I reached the mass renormalization part. So he introduces, after renormalization, a physical mass, defined as the pole of the renormalized propagator, and a renormalized mass which can be the physical mass, but can also take other values, depending on the subtraction schemes used. Are these masses, other than the physical one, observable in any way experimentally, or are they just ways to do the math easier (using minimal subtraction instead of on-shell scheme, for example)?   Also, in the case of charge renormalization, the explanation was that due to the vacuum polarization, the closer you are to the charge, the more you see of it, so the charge of the particle increases with the momentum you are testing the particle with. However, I am not sure I understand, from a physical point of view, why do you need to renormalize the mass. Is this physical mass (defined as the pole of the renormalized propagator) the same no matter how close you get, or it also changes with energy? And if it changes, what is shielding it at big distances? This is a question from the free Harvard online abstract algebra .  I'm posting my solutions here to get some feedback on them.  For a fuller explanation, see  post. This problem is from assignment 5.  a) Prove that the relation $x$ conjugate to $y$ in a group $G$ is an equivalence relation on $G$. b) Describe the elements $a$ whose conjugacy class (= equivalence class) consists of the element $a$ alone.  a) Let $G$ be a group and $R$ be a relation on $G$ defined by $a\sim b$ if $a$ is conjugate to $b$.  Then $a\sim b$ if there is a $g\in G$ such that $a = gbg^{-1}$.  Let $a$ be an element of $G$.  Then $a=eae^{-1}$.  So $a\sim a$ and $R$ is reflexive.  Let $a$ and $b$ be elements of $G$ such that $a\sim b$.  Then there is a $g\in G$ such that $a=gbg^{-1}$.  Then $b=g^{-1}ag$.  Since $g^{-1}\in G$, $b\sim a$.  Hence, $R$ is symmetric.  Let $a,b$, and $c$ be elements of $G$ such that $a\sim b$ and $b\sim c$. Then there are elements $g,g^\prime\in G$ such that $a=gbg^{-1}$ and $b=g^\prime cg^{\prime -1}$.  Then $a=g(g^\prime c g^{\prime -1})g^{-1}=(gg^\prime)c(g^{\prime -1}g^{-1})=(gg^\prime)c(gg^\prime)^{-1}$. Since $gg^\prime\in G$, $a\sim c$.  Hence $R$ is transitive.  Therefore $R$ is an equivalence relation on $G$. b) Let $S$ be the set of elements of $G$ such that, for $s\in S$, $s=gsg^{-1}$ for any $g\in G$.  Then $sg=gs$.  So $S$ is the set of elements that commute with every element of $G$.  In other words, $S$ is the center of $G$. Again, I welcome any critique of my reasoning and/or my style as well as alternative solutions to the problem. Thanks.