Must a square root of a diagonal matrix with distinct eigenvalues be diagonal?
If $X^n$ is a diagonal matrix with distinct eigenvalues, then is $X$ also a diagonal matrix with distinct eigenvalues?
I'm writing a shell script for Linux, using Bash, to translate any video-file into a MP4. For that, I'm using avconv with libvorbis for audio.   Inside my script, I have a question for the user :   read -p "- Audio Quality [scale from -2 to 10] ? "     if [ -n "$REPLY" ] ; then     ABITRATE="-aq $REPLY"     fi   My "ABITRATE" string goes into the final avconv command-line.  But I would like to give the user the opportunity to answer that question with a value in Kb (Kilobit), and translate it into the scale that libvorbis uses. The "scale from -2 to 10" is this :   Quality Kbit/s  Normalization -----------------------------  -2      ~32        y  -1      ~48        y   0      ~64        y   1      ~80        y   2      ~96        y   3     ~112        y   4     ~128        n   5     ~160        n   6     ~192        n   7     ~224        n   8     ~256        n   9     ~320        n  10     ~500        n   I would like to know how to check if my $REPLY is in a range of number. For example, I would like my script to do something like this :   if [ $REPLY is a number between 1 and 32 ] ; then   REPLY="-2" elif [ $REPLY is a number between 33 and 48 ] ; then   REPLY="-1" fi   Is this possible (I'm willing to say 'yes of course, shouldn't be hard' but I don't know the syntax to use) ? What is an "Emergency Call," and can I  set number for it? What are the obj and bin folders (created by Visual Studio) used for? Frequency of the sound when blowing in a bottle An awful lot of people seem to use the phrase "substitute X for Y" to mean "replace X with Y", while I've always used and understood it as "replace Y with X". This makes sense to me, given that a substitute is the replacement, not the thing which has been replaced.  I thought I might be able to figure things out from a dictionary, but now after seeing two sorts of definitions, I'm even more confused:   to put or use in the place of another to take the place of; replace   The first one suggests that the object will be the substitute (replacement), the thing put into place, while the second suggests that the object will be the thing which has been replaced.  Is one of these usages more correct in any sense? (I know this is probably a pointless question, since people will continue to speak the way they speak.) Is there perhaps a difference between American and British English?   And most importantly, is there any reliable way to tell what someone means when they ask how to substitute honey for sugar, or is the verb simply guaranteed to cause confusion? How to validate phone numbers using regex I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:   1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant. On the mobile web after new privilege is earned, reputation block contains some design issues:   no margins poor text color inside bar         By tapping on "track the next one" link, page have been refreshed:   no margins empty block in the middle obscure content         Only after manual refreshing, page looks fine again:        It is hard to reproduce because you need to earn next privilege which takes a lot of time. But I believe it's no too hard for developers :) How do I get the  value of a character as an int in ? How to sort a character vector where elements contain letters and numbers in R? An infinite subset of a countable set is countable In my book, it proves that an infinite subset of a coutnable set is countable. But not all the details are filled in, and I've tried to fill in all the details below. Could someone tell me if what I wrote below is valid?  Let $S$ be an infinite subset of a countable set $T$. Since $T$ is countable, there exists a bijection $f: \mathbb{N} \rightarrow T$. And $S \subseteq T = \{ f(n) \ | \ n \in \mathbb{N} \}$. Let $n_{1}$ be the smallest positive integer such that $f(n_{1}) \in S$. And continue where $n_{k}$ is the smallest positive integer greater than $n_{k-1}$ such that $f(n_{k}) \in S$. And because $S$ is infinite, we continue forever. Now consider the function $\beta : \mathbb{N} \rightarrow S$ which sends $k \rightarrow f(n_{k})$.   So in order for $S$ to be countable, $\beta$ would have to be a bijection. $\beta$ is injective since if $f(n_{k}) = f(n_{j})$, then $n_{k} = n_{j}$ because $f$ is injective. We also can conclude $k = j$ because the various $n_{i}$ chosen were strictly increasing.   Edit: $\beta$ also needs to be surjective. So for every $r \in S$ there exists a $q \in \mathbb{N}$ such that $\beta(q) = f(n_{q}) = r$. We know that $f^{-1}(r) \in \{n_{1}, n_{2}, ..., n_{k} ... \}$, so we can let $f^{-1}(r) = n_{d}$. Thus $\beta(d) = f(n_{d}) = r$. SQLite parameter substitution problem Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name.  I tried using the "?" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use:  for item in self.inventory_names:     self.cursor.execute("SELECT weight FROM Equipment WHERE name = ?", item)     self.cursor.close()   I get the error:     sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 8 supplied.   I believe this is somehow caused by the initial creation of the database; the module I made that actually creates the DB does have 8 bindings.  cursor.execute("""CREATE TABLE Equipment      (id INTEGER PRIMARY KEY,      name TEXT,     price INTEGER,      weight REAL,      info TEXT,      ammo_cap INTEGER,      availability_west TEXT,     availability_east TEXT)""")   However, when I use the less-secure "%s" substitution for each item name, it works just fine. Like so:  for item in self.inventory_names:     self.cursor.execute("SELECT weight FROM Equipment WHERE name = '%s'" % item)     self.cursor.close()   I can't figure out why it thinks I have 8 bindins when I'm only calling one. How can I fix it? Not enough space on /tmp I'm not able to run update manager as I get an error saying that there is not enough free space in the /tmp directory. I've practically cleaned out the tmp directory but the error persists.  here's df-h  /dev/loop0       13G   11G  952M  92% / udev            2.0G  4.0K  2.0G   1% /dev tmpfs           785M  920K  784M   1% /run none            5.0M     0  5.0M   0% /run/lock none            2.0G  584K  2.0G   1% /run/shm /dev/sda6        20G   14G  6.4G  68% /host  overflow        1.0M   16K 1008K   2% /tmp How to launch Ubuntu in Windows Subsystem for Linux in Windows 10 S? Use a rectangular contour to evaluate the integral $$\int_{-\infty}^{\infty} \frac{\cos(mx) dx}{e^{-x}+e^x} = \frac{\pi}{e^{m\pi /2}+e^{-m\pi /2}}$$  I need to evaluate the above integral specifically using a rectangluar contour and at some point applying the residue theorem. I should be ok with the residue part, but I'm confused at to how to get this into the example form shown in the book:  $$I =\int_{-\infty}^{\infty} \frac{e^{ax}dx}{1+e^x}=\frac{\pi}{\sin(a\pi)} $$  I tried using the identity $\cos (mx) = \frac{e^{ix}+e^{-ix}}{2}$ but I end up with $\frac{1}{2} \int_{-\infty}^{\infty}\frac{e^{ix}(e^{imx}+e^{-imx})dx}{1+e^{2ix}}$, which almost resembles the example but not quite... I work with QGIS 2.10.1 on Windows 7 (x64). I have dissolved polygons from an attribute value and the polygons geometries being not perfectly joined together, I get some 'garbage' nodes I need to delete. I have tried to edit the layer and using nodes tool, selecting and deleting the nodes, but it seems impossible to do (nodes are not deleted at all!). Any idea on how to process this kind of clean-up?  EDIT : you can  for testing. "any other verbs then being located in VP" -- is this acceptable? if the sentence you are analysing contains a modal verb, then it is positioned in ‘I’,any other verbs then being located in VP.      (English Syntax and Argumentation - Bas Aarts)   At first, I think the The bold clause should be "...is located..." but then I realize it might be in the form of a non-finite clause (ing clause with a subject) but I'm not sure. If it isn't, how you describe this usage? Is this common in English? MLE for Uniform $(0,\theta)$ I am a bit confused about the derivation of MLE of Uniform$(0,\theta)$.  I understand that $L(\theta)={\theta}^{-n}$ is a decreasing function and to find the MLE we want to maximize the likelihood function.  What is confusing me is that if a function is decreasing, then wouldn't the function be maximized at the smallest input rather than the largest?  Thank you in advance for your help. How to understand pipes When I just used pipe in bash, I didn't think more about this. But when I read some C code example using system call pipe() together with fork(), I wonder how to understand pipes, including both anonymous pipes and named pipes.  It is often heard that "everything in Linux/Unix is a file". I wonder if a pipe is actually a file so that one part it connects writes to the pipe file, and the other part reads from the pipe file? If yes, where is the pipe file  for an anonymous pipe created? In /tmp, /dev, or ...?   However, from examples of named pipes, I also learned that using pipes has space and time performance advantage over explicitly using temporary files, probably because there are no files involved in implementation of pipes. Also pipes seem not store data as files do. So I doubt a pipe is actually a file. Correct spelling of Polish surname Dziubenofska? My Polish grandmothers last name was Dziubenofska, but I know that's not how it is spelt! I'm looking for the proper spelling.   Can you help find it for me?  She came over to Ellis Island and they changed it on her to dziuk. This is only a prefix to the full name. I have a HP Pavilion dm4-2070us which has an Intel Corporation Centrino Wireless-N 1000 adapter.   The problem is that my computer doesn't show the wireless networks after I upgraded my system to Ubuntu 11.10. Following is my output for sudo lshw -class network:  *-network DISABLED          description: Wireless interface    product: Centrino Wireless-N 1000    vendor: Intel Corporation    physical id: 0    bus info: pci@0000:01:00.0    logical name: wlan0    version: 00    serial: 8c:a9:82:81:5a:30    width: 64 bits    clock: 33MHz    capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless    configuration: broadcast=yes driver=iwlagn driverversion=3.0.0-12-generic firmware=39.31.5.1 build 35138 latency=0 link=no multicast=yes wireless=IEEE 802.11bgn    resources: irq:42 memory:c2500000-c2501fff  *-network    description: Ethernet interface    product: AR8151 v2.0 Gigabit Ethernet    vendor: Atheros Communications    physical id: 0    bus info: pci@0000:08:00.0    logical name: eth0    version: c0    serial: 2c:41:38:07:f3:e3    size: 100Mbit/s    capacity: 1Gbit/s    width: 64 bits    clock: 33MHz    capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation    configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=1.0.1.0-NAPI duplex=full firmware=N/A ip=192.168.1.7 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s    resources: irq:44 memory:c1400000-c143ffff ioport:2000(size=128)   The output for rfkill list all:  0: hp-wifi: Wireless LAN     Soft blocked: no     Hard blocked: no 1: hp-bluetooth: Bluetooth     Soft blocked: no     Hard blocked: no 2: phy0: Wireless LAN     Soft blocked: no     Hard blocked: no 3: hp-wwan: Wireless WAN     Soft blocked: no     Hard blocked: no   I have also searched about the status of the WiFi network being shown as disabled. Somehow everything pointed to the fact that my wireless device is switched off and it can be switched on from Windows only. However, I don't have windows partition and it has just Ubuntu 11.10 so I don't see any point in switching the device on in Windows.