The value of Index 1 changes in all rows in method1. How should I create an ar1 array correctly?  method1:  ar1= [[0] * 3] * 3  ar1[0][1]=5 print(ar1)   method2:  ar2=[     [0,0,0],     [0,0,0],     [0,0,0],  ] ar2[0][1]=5 print(ar2)   output1:  [[0, 5, 0], [0, 5, 0], [0, 5, 0]]   output2:  [[0, 5, 0], [0, 0, 0], [0, 0, 0]]
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?
proof that function is constant I'm annoyed by quite a simple problem in calculus (I apologize in advance if I'm not using adequate terms in English, I don't take the course in English nor am I a native speaker):  Let $f:\mathbb R\longrightarrow \mathbb R$ be a function which is continuous at $0$ and satisfies $f(x)=f(2x)\,\forall x\in\mathbb R$.  My question is how do I formally prove that for every $x&lt;0$ $f(x)=c_1$, and for every $x&gt;0$ $f(x)=c_2$, where $c_1,c_2\in \mathbb R$? After proving those two statements (or at least one of them WLOG) it would be quite easy to prove that $f(0)=c_1=c_2$ by the definition of continuity of $f(0)$ and thus $f(x)$ is constant. Those two statements are just so obvious to see that I can't think of any formal way of proving so without "cheating". Thanks in advance! I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able to create an instance of this class to properly use the functions. How can I gain access to this class so that I can create an instance? I have been unable to find a way to do this.   I guess I should note that the c++ dll is not my code. Only squares instead of letters and numbers are displayed in my calculator and other apps in Ubuntu 18.04 I don't know what I did wrong in my Ubuntu 18.04 OS. For some reason some of my apps look like this:    This also happens to other gnome apps like pdf-reviewer and Logs. Window title, menu bar etc. are all blank, display only squares.  *Problem solved: I downloaded Google Fonts, saved them in a new folder, they can be applied system-wide, but after I did some font settings using Google Fonts it didn't work. I changed the font of Interface with Tweaks-Tool, that was what causing the problem. In C/C++, are global variables as bad as my professor thinks they are? First order differential equations with 2 varriables Does anybody know how to solve the following differntial equation?  $$w^2\cdot r+\frac{dw}{dt}\cdot r+\frac{dr}{dt}\cdot w=3g$$  where w and r are a function of time so $w(t)$ and $r(t)$. $g$ is a constant  EDIT: This equation came from a thought problem of mine which I will now explain since I still do not know how to approach the problem.  Basically I want to design a spiral track in which a vehicle will accelerate. However the total acceleration needs to be constant.   The vehicle will have 2 acceleration components, a radial component ($a_r$) and a change in speed component ($a_s$). Since we want constant acceleration: $a_r + a_s = constant$  From circular motion we know that $a_r = \omega ^2 r$ where $r$ is the radius, and $\omega$    Further we know that $v=\omega*r$, therefore: $a_s=\frac{d}{dt}(\omega r)$  For constant acceleration $a_{total} = a_r + a_s = \omega ^2 r + \frac{d}{dt}(\omega r) =constant$  Further usefull information: Length of the track covered at a certain time $l=v*t=\omega r t$  With all this the radius will be a function of time, $r(t)$ and the angular velocity will be a function of time, $\omega (t)$  Boundary conditions: $r(0)  = 0$ $\omega (0) = 0$  Now I would like to find a possible set of solutions to create a track by implementing end boundary conditions that i choose e.g. $v(t_{end})=100 [m/s]$ and $l(t_{end})=5000 [m]$  Here is a diagram for clarity: How do you integrate $\int \frac{1}{a + \cos x} dx$? How do you integrate $\int \frac{1}{a + \cos x} dx$?  Is it solvable by elementary methods?  I was trying to do it while incorrectly solving a homework problem but I couldn't find the answer.  Thanks! How can I run an external program from C and parse its output? I've got a utility that outputs a list of files required by a game.  How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information.  The utility spits out a series of strings, and this is supposed to be portable across Mac/Windows/Linux.  Please note, I'm looking for a programmatic way to execute the utility and retain its output (which goes to stdout). Using subcaption package but subfigures end up stacked rather than side by side I'm trying to put two jpegs side by side using the subcaption package, but the images are consistently stacking on top of each other rather than side by side. All the solutions I've found simply state that the pictures have to be small enough to actually be side by side but I've tried making them smaller, too small even and they stay stacked. My code looks like this:  \begin{figure}[H] \centering \begin{subfigure}{0.5\textwidth} \centering     \includegraphics[width=0.3\linewidth]{inclusion.jpg}     \caption{inclusions}     \label{fig:inclu} \end{subfigure}  \begin{subfigure}{0.5\textwidth} \centering     \includegraphics[width=0.3\linewidth]{deform}     \caption{grain deformation}     \label{fig:deform} \end{subfigure} \caption{filler text} \label{fig:manmade} \end{figure}   Help would be greatly appreciated. What's in an Eclipse .classpath/.project file? How can I take pictures through a skyscraper, airplane, or train window? I find that I take a lot of pictures through skyscraper and vehicle windows (those that are impractical or impossible to open). There are all kinds of problems with taking photographs through windows: reflections from light inside, dirt on the window, etc. My technique mostly involves placing the lens directly on the window glass and shielding it from lights reflecting from above.   Are there any non-obvious gizmos / techniques for easily shooting through windows? I've heard that a polarizing filter might be used in this situation, but I don't carry one around most of the time. Besides, most of the pictures I am interested in taking are in low light situations (at sunset or in a moving train, etc). How can I import an obj sequence into blender? I have an obj sequence of a fluid simulation from Realflow. I've found a few tools that can import an obj sequence into blender, but most are outdated and don't work. Are there any scripts or plug-ins that can do that? I exported my QGIS project with the qgis2web plugin as OL3.  Can I embed this folder to a wordpress homepage or can I import it to google maps and add this to WordPress? Given that $a,b,c$ are distinct positive real numbers, prove that $(a + b +c)\big( \frac1{a}+ \frac1{b} + \frac1{c}\big)&gt;9$   This is how I tried doing it:  Let $p= a + b + c,$ and $q=\frac1{a}+ \frac1{b} + \frac1{c}$.  Using AM>GM for $p, q$, I get:  $$\frac{p+q}{2} &gt; {(pq)}^{1/2}$$ $$\sqrt{(a + b +c)\bigg(\frac1{a}+ \frac1{b} + \frac1{c}\bigg)} &lt; \frac{\big(a+\frac1{a} + b+\frac1{b} + c+\frac1{c}\big)}2$$ And for any $x\in \mathbb{R}, \space \space x+\frac1{x}≥2.$ Thus,   $$(a + b +c)\bigg(\frac1{a}+ \frac1{b} + \frac1{c}\bigg)&lt;9, $$ which is the opposite of what had to be proven. What did I do wrong? I have a question about subsets $$ A \subseteq \mathbb R $$ for which there exists a function $$f : \mathbb R \to \mathbb R$$ such that the set of continuity points of $f$ is $A$. Can I characterize this kind of sets? In a topological,measurable or in some way? For example, does there exist a function continuous on $\mathbb Q$ and discontinuous on the irrationals? Starters on Stack Overflow tend to lose interest as soon as their first question starts getting downvotes. Their first question also sometimes gets closed because it was either not framed properly or it missed some very common things.  There should be way to cope with this for instance give some starter bonuses to new users. How can one refute John Searle's "syntax is not semantics" argument against strong AI? Find $\lfloor {\alpha}^6 \rfloor$ If $\alpha$ is a real root of the equation   $$x^5-x^3+x-2=0$$   find the value of $\lfloor {\alpha}^6 \rfloor$.      This one totally stumped me. We are asked to calculate $\lfloor {\alpha}^6 \rfloor$ without actually calculating the root or using wolfram alpha or any other calculator. I found that the above equation has only one real root by sketching its graph using calculus. I was also able to use the intermediate value theorem to conclude that $1&lt;\alpha&lt;2$ , but this is of little use while calculating $\lfloor {\alpha}^6 \rfloor$. Please help! They knew where she was. Why didn't the Ministry of Magic ask Moaning Myrtle's ghost about her death? Moaning Myrtle said she made sure Olive Hornby was haunted by her memory of finding Myrtle's body until Olive's dying day. Olive had to seek help from the Ministry of Magic in an effort to be free of the spirit, so the Wizards there knew a witness (Myrtle's ghost) to the 1943 murder had become available. After the Ministry of Magic exorcised Myrtle, she was relegated to Hogwarts, generally haunting the same stall in the same lavatory she died in. The powers that be knew where she was  What does JKR say about why no one at the Ministry of Magic, or any of the Hogwarts Professor's, asked Moaning Myrtle about her death? Stop Excel from automatically converting certain text values to dates Does anyone happen to know if there is a token I can add to my csv for a certain field so Excel doesn't try to convert it to a date?  I'm trying to write a .csv file from my application and one of the values happens to look enough like a date that Excel is automatically converting it from text to a date.  I've tried putting all of my text fields (including the one that looks like a date) within double quotes, but that has no effect. Why won't Amanita move in and settle down?