There isn't duplicated answer because I was always blocked by solution below !!!!!!!  I want to plot a graph and still run following code without closing the graph automatically like Matlab.  I try  , it failed and appear in a small moment then close itself.  Code:  import numpy as np import matplotlib.pyplot as plt  if __name__ == '__main__':     plt.figure(figsize=(10, 10))     plt.plot(range(5), lw=2, label='Real')     plt.title('Prediction')     plt.legend(loc="best")     plt.show(block=False)     print("---Plot graph finish---")   I try  , it failed, too. Check the code below.  Code:  import numpy as np import matplotlib.pyplot as plt  if __name__ == '__main__':     plt.figure(figsize=(10, 10))     plt.plot(range(5), lw=2, label='Real')     plt.title('Prediction')     plt.legend(loc="best")     plt.draw()     plt.show()     print("---Plot graph finish---")   Above will block until I close it.  Code:  import numpy as np import matplotlib.pyplot as plt  if __name__ == '__main__':     plt.ion()     plt.figure(figsize=(10, 10))     plt.plot(range(5), lw=2, label='Real')     plt.title('Prediction')     plt.legend(loc="best")     plt.draw()     plt.show()     print("---Plot graph finish---")   Above will appear nothing, or it appear and disappear very fast.  My version is below:  user@ya:~/$ sudo pip freeze | grep matplotlib matplotlib==2.2.3 user@ya:~/$ sudo pip -V pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)   Environments:  I only execute script in Ubuntu ex: user@ya: python xxx.py Distributor ID: Ubuntu Description:    Ubuntu 16.04.5 LTS Release:    16.04 Codename:   xenial   Can anyone help me? I just want to do like Matlab which won't close the plotted graph even if the script finishes.
After these instructions in the Python interpreter one gets a window with a plot:  from matplotlib.pyplot import * plot([1,2,3]) show() # other code   Unfortunately, I don't know how to continue to interactively explore the figure created by show() while the program does further calculations.  Is it possible at all? Sometimes calculations are long and it would help if they would proceed during examination of intermediate results.
What are some good tutorials on writing custom styles (classes) that clearly explain commands used and some of the features that TeX has to offer in the way of styles? Why is my command throwing a 'data tag parsing failed' error? I am trying to lock some boxes in a map of mine, and I used this command:   /blockdata 10 4 9 {Lock:Elyiana's Mage Key}   At first it worked, but then when I logged back on the next day it gave me this error message:    Data tag parsing failed: Expected '}' but ''' at: {Lock:Elyiana'&lt;--[HERE]     I don't know why it doesn't like the apostrophe in the key's name. I would change it, but it already worked and locked some other items. My version is 1.12, does anyone have an answer to my problem? How to reduce the size of VMware disk My Ubuntu image VMware disk has grown to 5GB physical file size. It's a dynamically growing disk with the maximum capacity of 8GB. I cleaned some stuff inside Linux distro and now inside it occupies 3GB. Obviously the physical file size didn't shrink back automatically. Is there a way (if possible free of charge) to shrink this disk back to ~3GB?  I need this to fit the image on the DVD. Let $\mathbb{S} = \{ (X,Y,Z) \in \mathbb{R}^3 :X^2 + Y^2+Z^2=1\}$ denote the Riemann sphere. The following problem is taken from Gamelin "Complex Analysis" chapter one:     What is the image of the spherical cap $ C := \{(X,Y,Z) \in \mathbb{S} : A \leq X \leq 1\}$, where $A$ is some fixed real number between $-1$ and $1$, under the stereographic projection $ \pi(X,Y,Z) = \frac{X+iY}{1-Z}$?   Here is my work so far:  ( The case $A=1$ is trivial, so assume $A &lt;1$)  We want to find $\pi(C) = \{z \in \mathbb{C} \mid \exists(X,Y,Z) \in C: \pi(X,Y,Z) = z \}= \{z \in \mathbb{C} \mid \pi^{-1}(z) \in C\}$, where the last equality holds by $\pi$ being a bijection. Write $z=x+iy$.  Here, $ \pi^{-1}(z) \in C\iff A\leq \frac{2x}{1+x^2+y^2} \leq 1 \iff (\star) :A \leq \frac{2x}{1+x^2+y^2}$, since the inequality $2x \leq 1+x^2+y^2$ holds for all $x,y \in \mathbb{R}$.  $A=0$: $( \star)$ reduces to $ 0 \leq x$, so in this case the image is $\{z \in \mathbb{C} \mid \Re(z) \geq 0 \}$.   $A &gt;0$: Since $A \neq 0$ in $(\star)$ we have,  $ \frac{2x}{1+x^2+y^2} \geq A \iff Ax^2-2x+Ay^2+A \leq 0 \iff (x-\frac{1}{A})^2 +y^2 \leq \frac{1}{A^2}-1$. Thus the image is the interior and boundary of the circle centered at $\frac{1}{A}$ with radius $\sqrt{\frac{1}{A^2}-1}$. Note $\frac{1}{A^2}-1 \geq 0$ as $A \in (0,1)$.  $A &lt;0$ : By symmetry and the above, here the image is $ \mathbb{C} / \{ $ interior and boundary of circle centered at  $  \frac{1}{A}$ with radius $\sqrt {\frac{1}{A^2}-1} \}$.  Is my working correct? Many Thanks! What is the number of invertible $n\times n$ matrices in $\operatorname{GL}_n(F)$? $F$ is a finite field of order $q$. What is the size of $\operatorname{GL}_n(F)$ ?  I am reading Dummit and Foote "Abstract Algebra".  The following formula is given:  $(q^n - 1)(q^n - q)\cdots(q^n - q^{n-1})$.  The case for $n = 1$ is trivial.  I understand that for $n = 2$  the first row of the matrix can be any ordered pair of field elements except for $0,0$. and the second row can be any ordered pair of field elements that is not a multiple of the first row.  So for $n = 2$  there are $(q^n - 1)(q^n - q)$ invertible matrices.  For $n\geq 3$, I cannot seem to understand why  the formula works.  I have looked at Sloane's OEIS A002884.  I have also constructed and stared at a list of all $168$ $3\times 3$ invertible matrices over $GF(2)$.  I would most appreciate a concrete and detailed explanation of how say $(2^3 - 1)(2^3 - 2)(2^3 - 2^2)$ counts these $168$ matrices. I'm having the strangest issue since updating to OS X El Capitan. My "Open File" dialogs show the sidebar but all my main (and useful) locations are missing. Take a look at this screenshot. This screenshot shows Keychain Access but this happens in Safari when I'm trying to attach a file to Gmail for example, or uploading an image to Facebook.  What I would like is for the sidebar to show my home directories, such as Desktop, Documents, Downloads, etc.  Help? Converting LAS 1.4 to 1.2 LIDAR files were released for major part of Slovenia few months back in zlas format. Decompressed LAS format is 1.4 version. I have tried many options how to generate DEMs and had some success in programs and tools but unfortunately they were all trial versions of license pay versions.  Problem is that I can't open and generate DEMs of LAS version 1.4 in many open and free tools (such as MCC-Lidar).   Can you help me converting LAS from 1.4 to 1.2 in some free tool? Or if it is any other way for LAS 1.4. What details should a good cover letter contain to back up a UK Visit Visa application? In Book 1, Artemis et al escaped from the time stop by drugging themselves to sleep.  In the same time stop, Julius Root "accidentally" plugged Briar Cudgeon with a tranquilizer dart.  Cudgeon fell asleep, but did not disappear from the time stop.  Why not? How many elements does the ring $ℤ[X]/(X^2-3,2X-4)$ have? Describe the structure of this ring. I'm making exercises to prepare for my ring theory exam:     How many elements does the ring $ℤ[X]/(X^2-3,2X-4)$ have? Describe the   structure of the this ring.   I find it always difficult if the ideal is generated by two elements.   I thought about someting like this. $X=2$ and $X^2=3$. Therefore $4=3$ therefore $1=0$. As $2=1$ then $X=0$. And then everyting seems to become $0$.   I'm not sure if I'm allowed to see it this way, but this is the first thing that comes to my mind. Youtube says "This video is currently unavailable" Prove that if $0\le p_n&lt; 1$ and $S=\sum p_n&lt; \infty$ then  $\prod (1-p_n)&gt;0$. Hint given: First show that if $S&lt;1$, then $\prod (1-p_n)\ge 1-S$.   Attempt: I was able to show the hint by using recursion setting $A_n=\prod_{i=1}^{n}(1-p_i)$ re expression the $\prod (1-p_n)$ as $1-S+\sum_{n_1, n_2=1,n_1&lt;n_2 }^{\infty} p_{n_1}p_{n_2}-..... $ and observed that every subsequent term is less than the previous term hence  $\prod (1-p_n)\ge 1-S$ which is $&gt;0$ if $S&lt;1$ but am unsure about how to extend it to $S\ge1$. For a simple circuit with a battery supplying a voltage $V$ to a capacitor, let us assume that the charge on the capacitor is $Q$. Now, the work done by the battery or the energy supplied is given by the relation:  $$W=QV$$  But the energy stored in the capacitor is given by:  $$U = \tfrac12 QV$$  The value of $Q$ as well as that of $V$ should be the same in both the equations.  Now my question is, where is the other half of the energy that the battery supplied? Sharing alignment between equations in two different items In the following minimal example, I have two equations inside an itemize environment, with an item per equations. Each equation is defined in its own equation environment.    \documentclass{article} \usepackage{amstext}  \begin{document}  \begin{itemize}  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit:   \begin{equation}     f(x) = \left\{     \begin{array}{l l}       1 &amp; \text{ nisl justo, hendrerit} \\       0 &amp; \text{ sagittis condimentum}\\     \end{array} \right.  \end{equation}   \item Duis magna nunc, ultrices at fringilla non, feugiat sed massa:   \begin{equation}     g(x) = \left\{     \begin{array}{l l}       -1 &amp; \text{ fermentum fringilla mauris eget} \\       0 &amp; \text{ gravida ipsum vitae}\\     \end{array} \right.  \end{equation} \end{itemize}  \end{document}   However, each equation has its own alignment, giving the following result:    It would be nice (I think) if both equations could be aligned in the same way, something like this:    Is this possible?   Note: it would be nice if the solution could be also applied to equations in different paragraphs.    UPDATE:   presented a very nice solution, which is currently the most upvoted, but it does not work quite well:  \documentclass{article} \usepackage{amsmath} \begin{document}  This is a list.  \begin{itemize}    \item First item.   \begin{align*}   f(x) &amp;= \begin{cases} 0 &amp; \text{now} \\ 1 &amp; \text{then} \end{cases}   \intertext{\item Second item.}   g(x) &amp;= \begin{cases} 0 &amp; \text{here and there}  \\ -1 &amp; \text{to and fro} \end{cases}   \end{align*}  \end{itemize}  After the list. \end{document}     Can you see? "now" and "then" are not aligned to "here and there" and "to and fro". Can we solve this? :) I do not know how to prove this question: $m^{\phi(n)}+n^{\phi(m)}\equiv 1 \pmod {mn}$ where $m$ and $n$ are relatively prime.  Can anyone help? I am looking for shapefiles or a list of suburb names for Melbourne and Canberra. I have ABS shapefiles, but I need to filter that to end up with only metropolitan suburbs.  My shapefile has codes in it for  - I just need to know which suburbs belong to the metros. The runabouts in Deep Space Nine sometimes have additional equipment on their backs; this is a screenshot from S02E15 (Paradise), showing the Orinoco in the background with the unknown equipment &amp; the Rio Grande in the foreground with a clean configuration:  What is the equipment &amp; why is it only sometimes present? C# Equivalent of SQL Server DataTypes For the following SQL Server datatypes, what would be the corresponding datatype in C#?  Exact Numerics  bigint numeric bit smallint decimal smallmoney int tinyint money     Approximate Numerics  float real     Date and Time  date datetimeoffset datetime2 smalldatetime datetime time     Character Strings  char varchar text     Unicode Character Strings  nchar nvarchar ntext     Binary Strings  binary varbinary image     Other Data Types  cursor timestamp hierarchyid uniqueidentifier sql_variant xml table   (source: ) Using competitors domain with different ending to boost traffic A finite, cancellative semigroup is a group