Eigenvectors of a particular transition matrix

Question: I am considering a Markov chain with $n$ states with a particularly nice structure. The transition matrix is as follows:
\begin{equation}\mathbf{P}=\begin{pmatrix}
0 & 0& \dots&0 & 0 &1\\
0 & 0&  \dots&0 & \frac{1}{2}&\frac{1}{2}\\
\vdots& & & & & \vdots \\
0 &\frac{1}{n-1}& \dots&\frac{1}{n-1}&\frac{1}{n-1}&\frac{1}{n-1}\\
\frac{1}{n} &\frac{1}{n} &\dots&\frac{1}{n} &\frac{1}{n} &\frac{1}{n}
\end{pmatrix}
\end{equation}
I already deduced that the eigenvalues of the matrix are $\lambda_i=(-1)^{i-1}\frac{1}{i}$ for $1\leq i\leq n$. However, I feel that there should also exist closed-form expressions for the eigenvectors of this matrix. Any help in proving or disproving this feeling is appreciated. Thanks.
Comment: Do you want the row eigenvectors or the column ones?
Comment: I'm interested in the regular right eigenvectors.
Comment: One more thing that I noticed, that you might be interested in: the $ij$ entry of $PP^T$ is $1/\max(i,j)$, which means $PP^T$ is a very special semidefinite matrix.
Answer: EDIT2. (5th Nov, 2014). Based on Darij's comments, am editing the answer to improve its clarity. The answer below shows how to get both eigenvalues and eigenvectors (my original answer was just for eigenvectors).
Eigenvalues
The key idea is to consider $P^{-1}$. Some (Markovian) guessing leads us to the following subdiagonal matrix:
\begin{equation*}
  L_n :=
  \begin{pmatrix}
    0 &&&\\
    -1 & 0 &&\\
    0& -2 & 0 &&\\
    &&\ddots&\ddots\\
    \dots& && 1-n & 0
  \end{pmatrix}.
\end{equation*}
Compute now the matrix exponential $V=\exp(L_n)$, which is a lower-triangular matrix with the lower-triangle given by the binomial coefficients:
\begin{equation*}
  V_{ij} = (-1)^{(i-j)}\binom{i-1}{j-1}.
\end{equation*}
A quick experiment shows that (something that can be verified by a moderately tedious induction):
\begin{equation*}
 VP^{-1}V^{-1} = V\begin{pmatrix}
      &&&1-n & n\\
      &&2-n & n-1&\\
      &\dots&\dots&\\
      -1& 2 &&&\\
      1&&&&
    \end{pmatrix}V^{-1} = \begin{pmatrix}
        1 & * & \cdots &*\\
        & -2 & * &* \\
        &&\ddots&*\\
        &&&(-1)^{n+1}n
      \end{pmatrix},
\end{equation*}
which is upper triangular, so we can immediately read off the eigenvalues of $P^{-1}$ (and hence $P$).
Eigenvectors
Although $V$ does not diagonalize $P^{-1}$, we observe that it turns $P^{-2}$ into the bidiagonal matrix:
\begin{equation*}
  B := VP^{-2}V^{-1} =
  \begin{pmatrix}
    1 & -2(n-1)\\
    & 4 & -3(n-2)\\
    &&9 & -4(n-3)&\\
    &&&\ddots & \ddots\\
    \\
    &&&&(n-1)^2 & -n(1)\\
    &&&&& n^2
  \end{pmatrix}.
\end{equation*}
If we succeed in diagonalizing $B$ in closed-form, then we are done. Suppose,  $SBS^{-1}=\Lambda$, then we obtain ($\Lambda$ can be read off of the diagonal):
\begin{equation*}
  S^{-1}\Lambda S = VP^{-2}V^{-1} \implies SVP^{-2}V^{-1}S^{-1} = \Lambda = \text{Diag}([i^2]_{i=1}^n),
\end{equation*}
which shows that $SV$ diagonalizes $P^{-2}$, completing the answer.
Technical Lemma
It remains to find $S$. This reduces to the system of equations:
\begin{equation*}
  SB = \Lambda S\quad\leftrightarrow\quad B^TS^T=S^T\Lambda.
\end{equation*}
I prefer to solve the latter formulation. Let us write $U := S^T$. Consider the $j$th eigenvalue $\lambda_j=j^2$; denote the corresponding column of $U$ by $u$. Then, the equation to solve is
\begin{equation*}
  \begin{split}
    B^Tu = j^2u,\qquad \implies & u_1 = j^2u_1\\
    -(k+1)(n-k)u_k + (k+1)^2u_{k+1} = j^2u_{k+1}.
\end{split}
\end{equation*}
Examining these equations, we see that $U$ is a lower-triangular matrix, with $1$s on its diagonal (which comes from the equation with $k+1=j$). The subsequent values are nonzero. Solving the recurrences for a few different choices of $j$, we can guess the general solution with some help from Mathematica:
\begin{equation*}
  u_k = \frac{(j+1)_{k-j}(n-k+1)_{k-j}}{(2j+1)_{k-j}(k-j)!},\qquad k \ge j.
\end{equation*}
Comment: Here is a link to Matlab code that you can use to verify the above stuff: https://www.dropbox.com/s/3mqwaj55f727twu/evecsThomas.m
Comment: This is great! Thank you so much, I would never have found this myself.
Comment: you're welcome Thomas! I wouldn't have imagined either that it simplifies so prettily!
Comment: @darijgrinberg: actually, scratch all the other stuff; I remembered that actually $V=\exp(L_n)$ above turns $P^{-1}$ into an upper triangular matrix, from which one can immediately read off the **eigenvalues** of $P^{-1}$, no need to go over to $P^{-2}$, which I had to do when trying to get the eigenvectors!
Comment: Ah, nice! Care to update your post to make it clearer? (I feel this is one of the cases where the focus on the heuristics of the solution muddles the solution itself.)
Comment: @darijgrinberg: Good suggestion. I'll spend some time over the weekend to clean up the post, and put the heuristics into the background. Thanks!!
Comment: Why is it enough to find the eigenvalues of the square?
Comment: @darijgrinberg: Say $SX^2S^{-1}=D$ for some matrix $X$, then $SXS^{-1}SXS^{-1}=D$ which implies $SPS^{-1}=\sqrt{D}$, so....
Comment: $\sqrt{D}$ is not unique. Either way, this won't likely be a nice solution. But if your $u_k$ are the coordinates of the eigenvectors (and they are, I assume?), then I guess one can just substitute.
Comment: I agree, actually taking square roots loses the signs, which is bad, but the $u_k$ are the coordinates of $S^T$ which diagonalizes $B$, and $SV$ diagonalizes $P$. The lost signs can be recovered, because from another argument, we *know* what the eigenvalues of $P$ are, so here we only cared about the eigenvectors (in other words, the lost signs can be restored, and the sqrt argument shows that we get a diagonalization)
Answer: Not a complete answer, but some further numerical observations.
We know that the eigenvector for $\lambda = 1$ is $(1,1,1,\ldots,1)$.
David Speyer notes in a comment that experimentation with small $n$
suggests the following generalization: the eigenvector for
$\lambda_i = (-1)^{i-1}/i$ has $j$-th coordinate a polynomial of degree $i-1$
in $j$.  For each $i$ one can readily surmise a pattern, e.g. for $i=2$
it's a linear polynomial whose value at $j=1$ is $-2$ times the value at $j=n$.
Proceeding from the opposite direction, the eigenvector for $\lambda_n$
always has $j$-th coordinate $(-1)^j {n \choose j}$.  More generally,
it seems that the eigenvector for $\lambda_i$ has $j$-th coordinate
a linear combination of the vectors $\left((-1)^j {k \choose j}\right)_{j=1}^n$
for $i \leq k \leq n$.  Again for each value of $n-i$ one can surmise
the pattern.
This suggests the following conjugations of ${\bf P}$ to a
triangular matrix.  Let $B$ be the matrix whose $(i,j)$ entry is $j \choose i$.
Then $B {\bf P} B^{-1}$ is lower triangular with $\lambda_i$ on the diagonal.
the other entries are predictable too; for instance, here's the $n=7$ case:
1     0    0    0    0     0    0

3   -1/2   0    0    0     0    0

5   -5/3  1/3   0    0     0    0

5   -5/2   1  -1/4   0     0    0

3    -2   6/5 -3/5  1/5    0    0

1   -5/6  2/3 -1/2  1/3  -1/6   0

1/7 -1/7  1/7 -1/7  1/7  -1/7  1/7

it was produced in gp with the commands
M(n) = matrix(n,n,i,j,if(i+j>n,1/i,0))
B(n) = matrix(n,n,i,j,binomial(j,i))
Binv(n) = matrix(n,n,i,j,(-1)^(i-j)*binomial(j,i))
MD(n) = B(n) * M(n) * Binv(n)
MD(7)

it's easier to see what's going on if we multiply the $i$th row by $i$
for each $i=1,\ldots,n$:
 1   0  0  0  0  0  0

 6  -1  0  0  0  0  0

15  -5  1  0  0  0  0

20 -10  4 -1  0  0  0

15 -10  6 -3  1  0  0

 6  -5  4 -3  2 -1  0

 1  -1  1 -1  1 -1  1

each column is $\pm$ a row of Pascal's triangle.  Presumably this is
not hard to prove in general, and establishes of the formula for
$\lambda_i$ as well as the description of the eigenvectors for $i$ near $n$
for each value of $n-i$.
On the other hand, let $B'$ be the matrix whose $(i,j)$ entry is
$(-1)^{i-j} {i-1 \choose j-1}$.  Then
Then $B' {\bf P} {B'}^{-1}$ is upper triangular
with $\lambda_i$ on the diagonal.  Here's the $n=7$ case
after multiplying row $i$ by $i$:
1  6 15  20  15  6  1

0 -1 -5 -10 -10 -5 -1

0  0  1   4   6  4  1

0  0  0  -1  -3 -3 -1

0  0  0   0   1  2  1

0  0  0   0   0 -1 -1

0  0  0   0   0  0  1

This time the rows are $\pm$ rows of Pascal's triangle.
Assuming that this too is straightforward to prove in general,
it again establishes the formula for $\lambda_i$, and this time
gives for each value of $i$ the formula for the $\lambda_i$ eigenvector
as a polynomial of degree $i-1$.
Answer: I like to know what the answer to a problem is before I try to prove that it is right, so immediately I went to my computer and generated some data.
So for one thing, it looks like the eigenvectors have rational entries (when normalized so that their first entry is 1).
Furthermore, if you're a little creative and don't always write these rational numbers in lowest terms, it seems like you can express the denominators in the eigenvector associated to the eigenvalue 1/i (or -1/i) are a polynomial of degree (i-1) in n.  For the 1 eigenvector (the perron-frobenius one, obviously) you get the constant function 1 (obviously).  For the -1/2 eigenvector, for instance, the denominators are 2, 4, 6, 8, ....   and for the 1/3 eigenvector, they appear to be the values of the polynomial 3/2(n-1)(n-2)
Edit: It looks like the correct denominator for the ith eigenvector in the n by n matrix is probably i/(i-1)! (n-1)(n-2)...(n-i+1) - that is, the eigenvectors are integer vectors, if this is their first coordinate.
Comment: Fix $n$ and look at the $j$th entry of the eigenvector for $1/d$. It appears to be a polynomial of degree $d-1$ in $j$.
Answer: I'll write out closed eigenvectors for a related matrix.
Let $J$ denote the "reverse-diagonal" matrix (i.e., $J_{i,n-i+1}=1$).
Then, consider the matrix $JP^{-1}$. This is seen to be
\begin{equation*}
 JP^{-1} = \begin{pmatrix}
  1 & &\\
  -1 & 2 & \\
  0 & -2 & 3 & \\
  \vdots & &\ddots & \ddots & \\
   \dots & & & -(n-1) & n
 \end{pmatrix}
\end{equation*}
This is very special bidiagonal matrix, whose eigenvectors are obtainable in closed form, though it is not clear if this helps towards getting eigenvectors of $P^{-1}$ (thanks to D. Speyer for catching this gaffe).
Here is an explicit diagonalization of $JP^{-1}$. It seems after some experimentation that $$VJP^{-1}V=\text{Diag}([1,2,\ldots,n]),$$ where $V=\exp(L_{n})$ and $L_n$ is the $n\times n$ lower triangular matrix that with entries $1,2,\ldots,n-1$ on its first lower-diagonal and zeros elsewhere
 (this is related to Pascal matrices and matrix exponentials)
Looking more into Pascal matrices, their generalizations etc., one should be able to figure out explicit eigenvectors also for $P^{-1}$ directly.
Comment: How can you recover the eigenvectors of $J P^{-1}$ from those of $P^{-1}$?
Comment: sorry, I wrote too fast; all I meant was that it seems relatively easy to get eigenvectors of $JP^{-1}$ in closed form, and the closed form we get there can suggest what eigenvectors of $P^{-1}$ might look like. However, I don't know if this is possible.
Comment: I think I managed to obtain closed form eigenvectors for $P^{-1}$. Will upload this stuff once I get a chance to type it in!
Comment: Very nice observations. I'm very curious to see your answer!


how to move grub boot from one partition to another in linux

Question: Is there a way to move the grub to a new partition, or drive in linux in the grub rescue, or the live mode?
Comment: Not sure what you mean. The grub installed to a MBR for BIOS boot uses many files inside the LInux install. Or if UEFI the grub in the ESP uses those same files in the Linux install. If UEFI you can move the /EFI/ubuntu folder to another drive. If in Ubuntu and BIOS you can easily install grub to the MBR of another drive. What is it that you want in detail?
Answer: Yes, this can be done. The command is grub-install and its syntax is like so:
grub-install [OPTION...] [OPTION] [INSTALL_DEVICE]
Since you asked for a live media recovery, here's a procedure from this tutorial:
Boot the Ubuntu Live CD.

Press Ctrl-Alt-F1

sudo mount /dev/sda1 /mnt

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys

sudo chroot /mnt

Now the fun stuff. Lets say I want grub to be on /dev/sda2, I'd run sudo grub-install /dev/sda2 or alternatively sudo grub-install /dev/sda to be partition/OS independent
Comment: As you're a reputation 10 user: If this answer helped you, don't forget to click the grey **☑** at the left of this text, which means [Yes, this answer is valid](http://askubuntu.com/help/accepted-answer)!  **;-)**
Answer: My answer to move the default boot to another disk, which is hard to find on the web:
Assume you boot from /dev/sda2 and you want to boot by default from /dev/sdb2.
This without bothering/counting menuentries in /boot/grub.cfg, then:

update-grub
reboot, and select the partition you want to boot from (say /dev/sdb2).
when booted, do update-grub again. this will make the current booted partition the primary boot partition.
for added luck, do

a) install-grub /dev/sda
b) install-grub /dev/sdb
Now , if you ever pull drive /dev/sda , some bootable grub remains.
Happy booting!


Recommended Books For AM/FM (especially AM) Radio Design

Question: I am trying to gain a better grasp of how to build an AM radio receiver. Can you direct me to some books (or other information) that will help?
Comment: Build Your Own Transistor Radios by Ronald Quan is a good read.  It's in two halves: first is circuits & build instructions with a progression through the different "types" of radio circuits; the second is the theory.  It's AM only, unless recent editions have included FM, but still it's a great book.
Answer: A great textbook for building a receiver or transmitter from scratch is Solid State Design for the Radio Amateur, by Wes Hayward W7ZOI and Doug DeMaw W1FB, published by the American Radio Relay League in 1986.  (If you were hoping to build a receiver that uses tubes, then this book would only be indirectly useful.)  Unfortunately it's been out of print for many years, and ridiculous prices are asked for used copies.
However, it can be found on archive.org here.  Thanks to the ARRL for apparently allowing the book to be read online!  What's more, the ARRL also seem to have shared several editions of the Radio Amateur's Handbook / the ARRL Handbook, which are also excellent resources.
Answer: If you want to learn how a radio works one good source of information is Bob Heil's pine board radio project. It is a tube type radio, but even if you don't build it you will learn a lot about radio.
https://heilhamradio.com/amateur-radio-post/the-pine-board-project/
Most HAM HF radios are SSB or CW instead of FM, but there are many books on all types of radios. On Amazon do a search for books published by the ARRL or if a ARRL member you can purchase them for the website.
ARRL also publishes a magazine, QSX, for radio experimenters. At the moment it is a separate subscription, but they plan to  offer a digital subscription to all ARRL members in near future.
Comment: ARRL magazine for experimenters is QEX.
Answer: I have a copy of The ARRL Handbook for Radio Communications from 2014 but they make a copy every year. The 2014 copy i have is one large hard cover book but they also make it in soft cover. The last few editions have been broken down in to a set of 6 soft cover books. It is a bit pricey but it is available used for fairly cheap(around $5 for copies from the early 2000's) online.
If you have a good local library they may have an electronic copy you can "check out."
I found this copy of the 2019 edition online:
http://web.archive.org/web/20200407064826/https://3v8hb.files.wordpress.com/2019/04/the-arrl-handbook-for-radio-communication-2019-v2.pdf


how to block mac address with portsentry

Question: I use portsentry to block ip address who trying to scanning. Now how do I want to block mac address who trying to scanning. Can I use portsentry, or possibly other tools?
Answer: The mac-address changes at every hop, so the only way to block this would be to the do an ARP request. With this you risk that the attacker intentionally starts sending the mac addresses of other, legitimate computers on the network and you risk to DoS yourself.


Migration from SharePoint 2013 to SharePoint 2016. Will workflow works after migration?

Question: I have just migrated a web application from SharePoint 2013 to SharePoint 2016 with SQL server 2016, however, i have read some blog that says workflow manager does not support SQL server 2016, so will migrated workflow works or I need to downgrade to SQL server 2014?
https://techcommunity.microsoft.com/t5/SharePoint/Does-SharePoint-Workflow-Manager-support-SQL-2016/td-p/21389
Answer: Found this and now my 2013 workflows are back!

We have completed our validation work and are pleased to announce that
  Workflow Manager Server 1.0 now supports the following platforms when
  used in a SharePoint Server 2016 environment:
.NET 4.6+ (when using Service Bus Server 1.1 with KB3086798) Windows
  Server 2016 Windows 10 x64 (for development purposes) SQL Server 2014
  & SQL Server 2016 To install the supported Workflow Manager Farm on a
  Windows Server 2016 machine:
Install WFM 1.0 Refresh from WebPI. This would install SB 1.1 and
  includes KB3086798. Install WFM 1.0 Cumulative Update 3 from WebPI.
  Install WFM 1.0 Cumulative Update 4 from WebPI.


How to restrict my PC to browsing only for security reasons?

Question: I have a PC that i only use for browsing the web. I do not have any problem with disabling any other services/protocols that does not affect web browsing.
I want to disable these unnecessary services (For example: Server Message Block).
So i need a complete accurate list of these services ( not just internet services may other things ex: usb ports)
Comment: Install Chrome OS?
Comment: Windows services and hardware components are often tied together in ways that are not immediately apparent, but can cause issues further down the line. Think carefully about what types of attacks you are trying to prevent and take steps to mitigate those. Do not follow a 'lockdown for the sake of lockdown' model as you can do more harm than good. For example, disabling USB ports, is this PC ever in a public, unattended setting where an open USB port could be exploited? For SMB, do you need to disable the service (which is tightly integrated with win management) or is a firewall block enough?
Answer: What O/S? You can go into your services menu, click any service, and right click any service and go into Dependency tab. This will indicate any dependent services. You should Google a service if you do not know what it is , or what it does.


Besides the speed of sound, what else changes when the transmitting medium changes?

Question: Besides the speed of sound, what else changes when the transmitting medium changes? Say from Oxygen to Hydrogen. I'm pretty sure the loudness does not change, but I think you would HEAR a change in pitch, because I think the wavelength changes when the transmitting medium changes. I don't think speed changes anything you hear. The main question is.... Can you hear a difference if you change the transmitting medium?
Answer: The short answer is yes. Sound waves are greatly affected by the medium in which they travel, not just in terms of speed, but also in terms of loudness and tonal quality. Just think of the variation in loudness and sound quality of different acoustic guitars which may use the same strings, but the sound is greatly affected by the different media in which it travels, including the wood, sound cavities, even the varnish on the instrument.
By considering 'sound' as the result of the propagation of pressure waves through a mechanical medium such as any solid, liquid or gas, the 'speed of sound' can be shown to be a function of the elastic and inertial properties of the medium, such that:
$v=\sqrt{\frac{elastic~property}{inertial~property}}$
For example, the speed of sound through a gas with Bulk Modulus (elastic property) $B$ and volume density (inertial property) $\rho$, is given by:
$v=\sqrt{\frac{B}{\rho}}$
The speed of sound also depends on the temperature of the medium.
Now, the 'loudness' and 'pitch' of a sound are psychological phenomena which generally correlate to the physical phenomena of intensity and frequency, however there are some subtle differences, some of which relate to physiology of the ear drum.
The wavelength of sound changes with the medium, because it is proportional to the wave speed.
$v=f\lambda$
The frequency however is generally independent of the medium, although it can vary with the relative velocity of the sound source with respect to the observer, due to the Doppler Effect.
The 'pitch' heard relates to the perception of frequency of a sound vibration. It is dependent upon the physiology of the ear drum such as age. The relation between (perceived) pitch and frequency is not linear.

Also, the ear perceives sound not just in terms of loudness and pitch, but also tone quality (timbre) which is affected by the medium.
The intensity of a sound wave (power per unit area) is the rate at which the energy transported by the wave transfers through a unit area $A$ and is generally proportional to the volume density of the medium, so the more dense the medium, the more power per unit area (wave intensity).
The 'loudness' of a sound is not only a function of wave intensity, but of physiological conditions within the ear drum which affect the frequency response of loudness perception. This is typically characterised in the 'Equal Loudness Curve'.

The perception of sound qualities other than loudness and pitch are often referred to as 'timbre'. This encompasses effects of the sound 'envelope' (attach-decay-sustain-release) as well as spectral differences (relative weighting of harmonic content, combination tones and resonant characteristics) as well as temporal relationships such as reverberation. Timbre is heavily affected by different sound medium,
In summary, you can hear a difference if you change the sound transmission medium. Firstly in terms of loudness (eg: an acoustic guitar will) and secondly in terms of perceived pitch (which is affected by loudness) as well as timbre (tone quality) which, although somewhat subtle and difficult to detect through scientific measurement, is nonetheless perceptible and measurable by the human ear and through advanced digital signal processing techniques.
Answer: As you correctly pointed out, the wavelength of a sound wave would change as it experiences a change in medium. However, this does not mean that the pitch, which is related to the frequency, would change. In fact, it shouldn't change. In general, there will reflections of the wave upon a change of medium. Therefore, the 'loudness' which is related to the amplitude of the wave, will also change.
To answer your main question, you can hear a difference if you change the transmitting medium. An extreme example is if you are in space (or any place close to resembling a vacuum). There wouldn't even be particles to transmit your sound waves, so you wouldn't hear a thing.
Comment: Thank you for your answer. In a vacuum there is no transmitting medium, and I don't think the frequency changes when the transmitting medium changes, Frequency you point out effects pitch, so I still do not know if I would hear a deference with a change in the transmitting medium, other then in the event of  lack of any sound in a vacuum.
Comment: @MarkDeGregg Vacuum itself can be the medium. More generally, a medium is characterised by its density. There exist formulae for 'reflection coefficient' and 'transmission coefficient' for reflection and transmission of waves at a boundary between two differing media. In the case that medium 1 is, say, air and medium 2 is a vacuum, the reflection coefficient would become 1, meaning all waves are reflected, while the transmission coefficient would become zero.
Answer: Here's a weird effect: the direction that you think the sound is coming from can change. You might think that the sound is coming from somewhere other than its actual source.
This is due to the bending of wavefronts when you go from one medium to another, the same effect that makes it look like a pencil bends when you put it into a glass of water. Here's a link to a great diagram of this at Wikimedia Commons, using a ray model, and another diagram from Davidson AP Physics that uses the a wave model.


Issue with shopping cart rule. Please help

Question: I am having an issue with a shopping cart price rule. I am basically giving customers free shipping for certain products and paid shipping for other products. The rule is working fine when you have a single product in the cart, but when you add a free shipping product with a paid shipping product, shipping is showing as free instead of being charged the shipping for the other product. Attached is a screenshot of my settings. Thanks!
Answer: Shopping cart price rules like these can be a bit confusing.  You have the top part set up properly.
However, at the bottom, you need to restrict which products you want the free shipping to apply to.
Right now, you have this option:
"Apply the rule only to cart items matching the following conditions (leave blank for all items)"
... blank...
... so it's applying this rule to all items in the cart.
I hope this helps!
Comment: Awesome that worked great! My only concern is that it is adding a bit of extra shipping for any extra item. Not full shipping but just extra dollars. Do you know why? Thank you so much!


How to tell if 2x4 is untreated and safe for indoor project?

Question: I bought some 2x4s from homedepot. Took a picture of the stamp. How can you tell if it's treated or not?  Is it safe for indoor furniture project?
Answer: Easy way: did you buy it INSIDE the store? - then it's not PT - they store that out where it can stay nice and wet.
That's a KD (kiln dried) stud - it's not PT. It's not greenish, as well, which is a somewhat blatant clue.
Comment: @Ecnerwal, "big box" stores in my area store pressure treated lumber indoors with the rest of the lumber.
Comment: thank you so much. Just want to make sure I got it correct. KD means  the wood was held at a high temperature for a certain amount of time to kill any insects hiding inside. Does not involve any chemicals, so its safe to use it for any indoor projects.
Comment: Treated lumber isn't necessarily green, so that is *not* a blatant clue. For example, ACQ-B treated lumber will look greenish (unless it has been stained dark brown so it looks more appealing as fence posts or decking), and ACQ-D treated lumber will be a light brown color.
Comment: KD (no numbers) means it was dried below 19% moisture when planed. HT means it was heat treated adequately to kill insects (which is normally the case for KD lumber, but the two mean different things)


Why does marginal benefit diminish?

Question: Why does marginal benefit diminish? Intuitively, marginal benefit would be proportional to the input, so for example, if you had 1 worker that could produce 10 units, then 2 workers could produce 20 units, and 3 workers could produce 30 units, so on and so forth. But according to the law of diminishing marginal benefit, that's not the case. Why exactly does it diminish?
Comment: I think you are confusing production with consumption (utility). Even in production though, think of 1 bakery which employs 5 people. Jamming 50 into the bakery will not simply increase production 10x.
Answer: When studying microeconomics, we usually consider production to have two major factors:

Labor (L) which could be measured as the number of employees
Capital (K) which is made up of physical stuff such as machines, stores and factories.

What you are saying it's the intuitive thing to happen would usually be true if the number of stores, factories and machines (the capital) increased in the same proportion as the number of workers (the labor). This property is known as constant returns to scale.
It wouldn't be of much help to have a ton of workers if you don't have the tools and the space for them to work.
For a production function $f(L,K)$, returns to scale are defined by: For all $t>1$

Decreasing returns to scale: $f(tL,tK) < t f(L,K)$
Constant returns to scale: $f(tL,tK) = t f(L,K)$
Increasing returns to scale: $f(tL,tK) > t f(L,K)$

An example of increasing returns to scale is cryptocurrency mining. If that wasn't the case, there would be no incentives to participate in a mining pool rather than mining alone.
What you were stating was diminishing marginal productivity. Marginal productivity is rather defined by:

Marginal Productivity of Labor: $MPL = \frac{\partial f}{\partial L}$
Marginal Productivity of Capital: $MPK = \frac{\partial f}{\partial K}$

Marginal returns of each factor alone (keeping the other one constant) are most of the time decreasing, a common exception being a company starting up and trying to take advantage of specialization of labor.
Them being decreasing can be described mathematically as:

$\frac{\partial^2 f}{\partial L^2} < 0$
$\frac{\partial^2 f}{\partial K^2} < 0$

For example in the case of labor, this means that if you keep the number of factories, stores and machines constant, each additional worker would boost production by less than the previous one.
The marginal returns being decreasing can lead them to in fact becoming negative (i.e. $\frac{\partial f}{\partial L}<0, \frac{\partial f}{\partial K}<0$), meaning having more of a factor leading to producing less than before.
For example, having too many workers could lead them to get in the way of each other because of the lack of physical space for all of them.
As an exercise, I invite you to think about this production function:

$f(L,K) = 5 L^{\frac{2}{3}} K^{\frac{1}{3}}$

Why does marginal benefit diminish?


Is opening new tab equivalent to opening new window?

Question: Is opening new tab in the terminal window is equivalent to opening a new tab in terms of resources? I need to run 16 scripts in parallel. I do not know whether opening tabs or new terminals is the best practice? I want to get the maximum performance but without exhausting the resources to an extent that degrades the performance.
Answer: I think, it is close the same. I cannot judge if opening more windows with terminal take more resources than one window with more tabs, but the window object take CPU time only while changing. You can test the performance with command cp /dev/zero /dev/null what takes 100% of one core (this is a simple load test). Run more such commands in more terminals and look at top or KSysGuard to see the result. I hope you have at least 16 cores for that.
Comment: I have `Intel® Core™ i5-6500 CPU @ 3.20GHz × 4`. does this seems sufficient?
Comment: I am not familiar with Intel nicks, but suoppose that i5 has 4 cores, and you have four CPU: together 16cores could be sufficient. I do not know how complex is your script, but if one script take full load of one core it is good idea to support each instance with one core. In the same way you need to look for other component: if the script intensively read from the disk, 16 scripts could cause crush while reading the same disk. But sometimes it is more important the task was carried out than how quickly it was finished.
Comment: Each script read an address from a text file in a loop. Then connects to the address using TLS connection. I think it is considered a lightweight task.
Answer: No. E.g. in Gome terminal (and others, like firefox or emacs) a new tab is added to the current window (and you can switch among them); a new window is separate. Often you can tear out a tab into it's separate window (but not the other way around, curiously).


How to use a theme.

Question: When I downloaded a theme, .tar.gz or .gz or some kind of format like that.  When I opened it, it was just a folder full of files.  How do I make it a theme or something?
Answer: You will need to open your archive manager as root. Use Alt+F2 and type gksu [packagemanager] where [packagemanager] is the command for the archive manager. (In not too heavily changed Ubuntu installations, this is file-roller.) Open the file, then extract the entire package to the directory /usr/share/themes (or /usr/share/icons for cursor themes or icon themes).
Next, you will need a program to apply the theme. I suggest the GNOME Tweak Tool. Install this by opening the terminal and typing these commands, one by one:
sudo add-apt-repository ppa:ricotz/testing
sudo apt-get update
sudo apt-get install gnome-tweak-tool

Once this is done, you can either search for the tool in the HUD or run it directly by pressing Alt+F2 again and typing gnome-tweak-tool. In the dialog that appears, there should be some options on the left for "Theme". Click that, and change the theme settings to your liking. The effect should be immediate.
Comment: You can extract the contents to ~/.themes (or ~/.icons) if you want changes to be available to only the current user.
Answer: The Community Wiki recommends that you extract the archives into either ~/usr/share/themes or icons to ~/usr/share/icons.
The recommended application to manage themes, unity-tweak-tool, is available from the Ubuntu Software Center.
From terminal:
sudo apt-get install unity-tweak-tool

Alternatively, you can visit the project page http://ubuntu-tweak.com/ and download the debian file package. Ubuntu-tweak offers more configuration options than just customizing unity themes.

I had previously copied the recommendation for  the Myunity tool from the Community Pages, but it is no longer receiving popular attention.  The only thing close to an explanation that I could find in the forums. Searching this site, it seems that MyUnity is 3rd party software and is the solution for Ubuntu 12.04, but that the unity-tweak-tool is preferred for newer releases (my inference).
Additional edits incorporate advice from this answer.
Answer: Some theme authors include an install script in the archive; if you find a file called INSTALL or something similar, extract the archive to a folder that is preferably easy to get to. Then open the terminal and cd to the applicable folder (probably ~/Downloads by default). Then in terminal, run ./[Name-of-Install-Script] to install.

How to use a theme.


Which graphics cards are supported by a Late-2009 iMac 27inch?

Question: I have the ATI Radeon HD 4850 graphics processor with 512MB of GDDR3 memory installed on an i5 iMac 27inch setup. Given that my current card is malfunctioning and that versions of that card are prohibitively expensive, which cards could I theoretically upgrade to?
Answer: According to iFixit.com, you can upgrade the video card to the same one that was in the last 2011 model:

If you are using the iMac 27" late 2009 or 2010 model for games you
  might want to upgrade your graphics card to the 6 series of the last
  2011 model.
For any other reason this upgrade is not recommended as the power gain
  is only noticeable in games.

Since you have to replace the card, it's definitely a good time to look at an upgrade:

ATI 4850 Card Approx $150 (used) to $400 (new)
ATI Radeon 6970 Card - Approx. $200 (used) to $800 (new)

The ATI Radeon 5xxx series from the 2010 should works as well, but they are very rare for some reason.  For the price and convenience, I would go with the 6xxx series if upgrading.
If I had the time to search and scour the web for a good deal, I would try to get the 6970 at a good price, but I don't think I would spend the extra money on upgrading a computer that was technically 7 years old with a graphics card that was 5 years old.  Especially so since the graphics upgrade wouldn't be noticeable unless I was gaming.  And if that was the case, I would probably have a console or a PC...but that's just me.
The iFixit link I provided has an excellent step by step on how to replace this card.
Comment: Thanks! So this card (Apple iMac 27" A1312 ATI Radeon HD 6970M 661-5950 Mid-2011) would be compatible?
Comment: According to ifixit, yes.  I did some reading and it appears that interface is the same.  Obviously OS X ships with the drivers that you need so you should be good to go.
Comment: Well its August 2021 and my late 2009 iMac, which runs great with its upgraded SSD and replaced optical drive with SSD just had the GPU go out. On eBay as of today, you can pickup a Mid 2011 6970m to upgrade the late 2009 iMac GPU for about ~$250 (including the 3-pipe heatsink). You can take a chance and order international from China for less but those cards are usually PC GPUs pulled from an old Dell or Alienware laptop and they flash the GPU firmware which may or may not work.
Comment: 6970m upgrade video https://www.youtube.com/watch?v=9dPsH1zIQMs
Answer: The Radeon HD 6770M is compatible — see here. I don't know if it will be any cheaper, though.


Shape builder distorting perfect circle

Question: me again. I'm having trouble with logo creation. As you can see in the following images, I'm using a couple of circles which intersect, but after trying to remove the intersections on the inner side of the circle, it gets distorted and new unnecessary anchor points get added. I'm just wondering for a workaround for this and maybe tips for a better workflow in general :)
.
Comment: Hi. Welcome to GDSE.  Why do the extra anchors matter?  I don't see anything I would describe as "distortion" in your example. The circle still looks absolutely fine to me.
Comment: You do understand that illustrator is unable to make a perfect circle.
Answer: Shape Builder adds anchors whenever there's an underlying path intersection. Just how it works.
I DO see the distortion, although it's minor. The circle starts looking like a daisy with slightly bulged sections. Could be align to pixel grid - Just guessing. If you're working rather large the pixel grid alignment could cause these sort of subtle changes. Hard to say really.
Best way around both of these is to draw a new circle on top, remove that inner-extra-anchors-with-bulges-circle, and use Pathfinder to subtract your n circle from the shape. It'll be much cleaner.
Much of this is merely working around how sloppy shape builder can be. it's not meant to be a precision tool. If it were, it would remove redundant anchors, etc.
Comment: Well, no you mischaracterize it a bit. Its true its not super precise. But in reality the extra anchors get there because its trying to eliminate tearing i vain.
Comment: yeah, it's minor and it matters as what I end up doing afterwards is using the same shape, offsetting it to the right and overlapping two of the ending points and that's where the minor thing becomes a big difference that is perceivable by the eye. I will try out your suggestions. Thanks!
Comment: I am having trouble understanding and putting into place your method suggestion, would really enjoy if I  could see a video of it.
Comment: You *really* should not need a video. Requesting one is a bit over the top. My time is valuable, spending to make videos upon request is untoward. Simply select he inner "wonky" path with the Direct Selection tool.. delete it.. draw a new circle using the Ellipse tool... Select the new circle and the underlying shape and use Pathfinder Minus Front.
Comment: sorry if it sounded a request, I tried to be as nice as possible. thank you for taking the time to share steps of the workaround anyways.
Comment: the second explanation worked like a charm but now I need to remove some of the outer lines as I only need the smaller arches of the largest circles and I'm facing the same issue, but I cannot interpret your solution in a way that makes me also have a clean circle on the outer edges. Should I just post another question for this?
Answer: Illustrator have a lot of nifty tools which makes it easy to quickly draw complicated shapes, but some of them tend to add a lot of unwanted anchor points which can't be removed easily.
I can't give you a recipe for "the best workflow". It's more about knowing a lot of trick and workarounds and learning when to use them.
If you expand a circle with a stroke, the outer path gets additional anchor points:

If you instead create two circles and use Minus Front in the Pathfinder panel, you get a cleaner result:

So if you create your circles like that you can use Pathfinder operations for example like this:

The three rings consist of two circles each, a black outer circle and a white inner circle.
First I select the two circles which makes up one of the large rings and click Minus Front in the Pathfinder panel to subtract the inner circle from the outer one. In other words, I use the inner circle to create a hole in the outer one.
I do the same with the other large ring.
Then I select the small outer ring and the two large rings I just created and click Unite in the Pathfinder panel to combine all the black parts.
Lastly I select this newly created black part and the inner circle of the small ring and click Minus Front in the Pathfinder panel. This way I subtract the inner circle of the small ring from the rest of the figure and that's it.
There are other ways to do this. The operations could be done in another order. This is just an example to get you started.
Comment: OK, I've tried to explain it more in detail and made a new gif with a gray background, so it's easier to see what's going on. Don't be shy to ask for further clarifications.
Comment: Btw, I'm not saying that it's wrong to use Shape Builder at all. It's just good to know different ways to achieve the same thing. Especially if you are interested in avoiding unnecessary anchor points. I can't guarantee the circles won't be slightly deformed this way also. As @joojaa pointed out, Illustrator isn't capable of making perfect circles and as you manipulate the shapes, small deformations will occur.
Comment: I don't particularly understand why parts of the circles are transparent in your last gif. And how do I get to that point? Sorry if my questions are newbie-like. My initial starter experience was totally lead by using the shape builder tool instead of pathfinder and I guess I am facing the consequences now.
Comment: they also end up getting deformed, although it is a nice workaround. should I just drop the idea of having a perfect circle and try making them at leas visually perfect or should I use other software?
Comment: and now I'm facing the same issue but with outer parts of the circle as I need to remove some of the curves that stem from it and I can't seem to think of a way to reinterpret your solution in that context.
Comment: Hmm, are they visually deformed or do you have to add a circle on top before you can see it?
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/116117/discussion-between-wolff-and-allesplusjetzt).

Shape builder distorting perfect circle


Android: Default Battery Percentage Level for individual services to switch off

Question: We all know Android OS switches off services one by one when the battery reaches critical level. But is there any fixed battery level to cut down individual services. For example, Bluetooth will be switched off at 20%, Mobile data at 15%, Wifi at 10%, etc. I am searching these information in Android documentation and Googling as well. But I am not able to find such information. Any help please.
Answer: "Services" doesn't mean what you think it means. A service is an app component that can run in the background. For example, an email app might have a service that's started every 15 minutes to check for new email (and stops itself when it completes). This means it's background apps that stop, not things like the Wi-Fi and mobile data.
App developers are encouraged to check for the low battery condition and stop battery-draining activities. This broadcast also triggers the "low battery" dialog, so it's easy to tell at what level it fires. It can be changed by the device manufacturer (since Android is open-source), but it's usually set to trigger at 15%.
Comment: Hi Dan, thanks for your response. I am very well aware of the term "service". And sorry for the confusion. I am actually writing a report where i need to provide the threshold values set by individual manufacturers. In fact, I guess even with the same manufacturer, the threshold values may vary with the device models. So I am just interested in at least 2 or 3 device models threshold values.


Why doesn't "locate" work?

Question: I tried "locate libevent", but it doesn't work. and nothing happens.
Answer: You may have to run updatedb first, though it's often set up to run automatically.
Are you certain that path exists which includes libevent?  If not try searching for something you know exists (etc, your home directory, and so on)
Comment: Also if the file has been recently installed (today) there's a very good chance you need to run updatedb.
Answer: As already mentioned, locate uses a proprietary database which contains all filenames of the system (or at least of the directories which have been configured to be included in this database). To (re-) build this database you need to run updatedb.
You could also use find (e. g. find / -name 'libevent*') to search for the file which will take longer (depending on the size of your harddisk) but needs no database.
Answer: locate silently returns nothing when it doesn't find what you requested.

Why doesn't "locate" work?


Performance of .net GC in Kubernetes pod without memory limit

Question: I'm checking on a scaling issue and we are suspecting it has something to do with the memory, but after running a load testing on local machine it doesn't seems to have memory leak.
We are hosting the .net core application in Kubernetes, with resources setting 800mi request memory without limit.
And as per describe from this Article

The trigger for Garbage collection occurs when, The system has low
physical memory and gets notification from OS.

So does that mean GC is unlikely to kick in until my nodes are low on memory if we did not setup memory limit, and it will eventually occupied most of memory in node?
Answer: Yes that's exactly what can happen, both with .NET and other pods.
Always set memory and CPU limits as this may have impact on other pods or  Configure Default Memory Requests and Limits for a Namespace
Answer: @Martin is right but I would like to provide some more insight on this topic.
Kubernetes best practices: Resource requests and limits is a very good guide explaining the idea behind these mechanisms with a detailed explanation and examples.
Also, Managing Resources for Containers will provide you with the official docs regarding:

Requests and limits

Resource types

Resource requests and limits of Pod and Container

Resource units in Kubernetes

How Pods with resource requests are scheduled

How Pods with resource limits are run, etc

Bear in mind that it is very important is to have a good strategy when calculating how much resources you would need for each container.
Optimally, your pods should be using exactly the amount of resources you requested but that's almost impossible to achieve. If the usage is lower than your request, you are wasting resources. If it's higher, you are risking performance issues. Consider a 25% margin up and down the request value as a good starting point. Regarding limits, achieving a good setting would depend on trying and adjusting. There is no optimal value that would fit everyone as it depends on many factors related to the application itself, the demand model, the tolerance to errors etc.
And finally, you can use the metrics-server to get the CPU and memory usage of the pods.


How to connect to the QQ Messenger network?

Question: I´m looking for a version of QQ messenger for Ubuntu 12.04. I found a note in Wikipedia that there is a beta version of QQ for Linux, but I could't find it. Does anyone know where I can find it?
Are there any alternative messenger to use QQ?
Answer: You can find the download page at http://im.qq.com/qq/linux/download.shtml or if you just want the direct link to the .deb package:
http://dl_dir.qq.com/linuxqq/linuxqq_v1.0.2-beta1_i386.deb
Comment: ok, thanks for your help. Next step. learnign chinese :-)
Comment: This is for common QQ in chinese. Sorry, my fault. I forgot to say I´m looking for QQ international in english or german language.
Or is only chinese verison available for linux?
Comment: @JensHN I think due to QQ being Chinese it might be the only version.
Comment: First, the .deb is crap, you can't install it. If you download the .tar.gz, it will run, but you can't login...
Answer: There is a recently developed plugin for Pidgin that works quite well. Basic things such as chatting, buddyicons and sending files are all supported. You can use it by adding ppa:lainme/pidgin-lwqq to your repositories and then install pidgin-lwqq. After that WebQQ shows up in the list of protocols to choose from when adding a new account in Pidgin.
sudo apt-add-repository ppa:lainme/pidgin-lwqq
sudo apt-get update
sudo apt-get install pidgin-lwqq

Comment: Dont waste your time, it doesn't work. Can't get it to login.
Comment: QQ has disable all 3rd party clients and APIs a couple years ago - only official Tencent releases work now AFAIK
Answer: Forget all about the linux version of QQ. It's so old that it doesn't work properly.  In fact, it never worked properly. As far as I am aware (I've been teaching in China for 10 years) QQ for linux was never properly developed in the first place and there certainly hasn't been any further development.
Yes, you can use longene/wine but to be perfectly honest, it's 'iffy' and buggy.  Bear in mind that whilst the front page of QQ will be in English -or the language of your choice - the remainder will be in Chinese .. the 'search for friends .. add contact..'  and the inbuilt translator is absent.
The best advice I can offer is to make your system dual-boot.  Install Windows then download QQ (www.imqq.com)  shove a Ubuntu cd into the drive and restart the computer.  Install Ubuntu alongside Windows.
If you want to use QQ boot into the Windows operating system.  Bear in mind that QQ International will install the front-end in your chosen language along with the inbuilt translator, but the back end - the 'QZone' for photos and blog will all be in Chinese.
I'm not the only 'foreign teacher' who has tried linux qq/longene etc ..  We've all settled on the dual boot system.
Comment: As an alternative to dual boot (especially if it is for just one tool with minor system requirements) some sort of virtualization could be used. For example Virtual Box, there is already an package for ubuntu and it is quite easy to use.
Comment: Sad, but true. I agree with Adaephon, VirtualBox. KVM is said to have better performance, but don't install that KVM krap, because your laptop will afterwards crash when it resumes from standby.
Comment: Dual booting for a game or Office makes some sense, but rebooting just to reply to a message seems very impractical...
Answer: sudo apt-add-repository ppa:lainme/pidgin-lwqq
sudo apt-get update
sudo apt-get install pidgin-lwqq

pidgin-lwqq is the right way, it works for me without any problems. Had it running under Arch Linux. The Chinese prefer it to webqq, the wine thing or the old one from Tencent (does not work any more).
If you login, there is a little window popping up asking you for a captcha, that's it.   ;-)
Here http://www.xheike.com/thread-1442-1-1.html and here http://www.cnblogs.com/zhj5chengfeng/archive/2013/09/08/3308029.html one can see that it works. Okay, with a little Chinese knowledge.
Answer: for your Linux needs please consider using:
http://qqchat.qq.com (QQ for Facebook.. it's wickedly good!)
Or in alternative you can always try your luck with WINE...
Comment: The web-chat doesn't work, the .deb doesn't install, the pidgin-extension can't login, the .tar.gz says it's too old and logs out, with the windows version on wine you can't enter the username or password. What a crap of a software.


how to scroll down a webpage

Question: I'm testing my new mobile website in Android devices.
But in emulator default Browser, I can't scroll down, right or left the page. There is no scrollbars, and arrow keys don't work, too. Here is a screenshot from my emulator window (I opened stackoverflow in browser)
Answer: I treat my mouse like a touch.
I left click the mouse button at the bottom of the emulator and drag the mouse to the top.
Answer: I have noticed that you need to click the mouse left button at the edge of the screen for couple of seconds to activate the scroll. Once activated you use the mouse like a touch.
If you are not able to locate the scroll bar then go back and come back again on your page. While the page is loading, the scroll bar will be highlighted for a brief period of time. You can then click at the location as I have explained above in first paragraph.

how to scroll down a webpage


Source for up-to-date GPU/ASIC hash performance?

Question: I am looking for CPU, GPU and/or ASIC performance stats on hash performance. Specifically SHA256 and Argon2i. I've googled and only came up with very limited anecdotal evidence. Considering that this fast-changing field is so important for security managers, I would expect there to be a resource that provides the latest benchmarks in this area. Does such a thing exist?
Comment: @dandavis, some SHA-2 algorithms are used for password hashing, with a tuneable number of iterations. Without knowing how fast a dictionary attack can be, it's hard to know how many iterations you need.
Comment: how does sha2 hashing speed affect security?
Comment: A well implemented system that uses pw-based security will use a system of hashing whereas the password and a salt are hashed many thousands of times ("work factor") before they are stored. The idea is that if these pw-hashes are obtained by an attacker, it will require a lot of CPU work/time to brute-force all the passwords from these hashes.

Knowing the GPU/ASIC speed of brute-forcing is helpful in designing security policies––especially password expiration policies.
Comment: It is now 2 years 1 month since this was asked; a google search still fails to turn up much of use. Did you ever manage to find anything? It is hard to believe that there is simply no information on this.
Answer: In June 2016, Jeremi M. Gosney (the guy behind sagitta HPC) published the results obtained with their top-end password cracker, running Hashcat v3.00-beta: https://gist.github.com/epixoip/a83d38f412b4737e99bbef804a270c40
This list contains all hashing functions implemented by Hashcat which, unfortunately, doesn't support Argon2i yet.
Regarding SHA256, the results are:
<code>Speed.Dev.#1.:  2865.2 MH/s (96.18ms)
Speed.Dev.#2.:  2839.8 MH/s (96.65ms)
Speed.Dev.#3.:  2879.5 MH/s (97.14ms)
Speed.Dev.#4.:  2870.6 MH/s (96.32ms)
Speed.Dev.#5.:  2894.2 MH/s (96.64ms)
Speed.Dev.#6.:  2857.7 MH/s (96.78ms)
Speed.Dev.#7.:  2899.3 MH/s (96.46ms)
Speed.Dev.#8.:  2905.7 MH/s (96.26ms)
Speed.Dev.#*.: 23012.1 MH/s
</code>
Comment: Thanks, this is precisely the "limited anecdotal evidence" I was speaking of =)
Comment: I see... Well, I don't think it has been much advancement since then. The GTX 1080 remains the top-notch GPU today. You might ask on Hashcat forums or Jeremy directly. Please keep us posted if you find anything interesting :)


The uncertainty of a metre ruler?

Question: I have been taught that the uncertainty in the measurement of a metre ruler is +-1 mm. However , I was also taught that the uncertainty is half of the smallest division in the measuring instrument. So, it should be that the uncertainty of the measurement of a metre ruler is +-0.5 mm( its smallest division is 1 mm) ?
Comment: Nothing is certain with uncertainties.
Comment: @ja72 - that is certainly true. Oh wait...
Comment: @Floris - https://en.wikipedia.org/wiki/Epimenides_paradox
Comment: I'm pretty sure "uncertainty" isn't the term you're talking about. The uncertainty in a measurement may be caused by the person using the ruler (and other things), in addition to the ruler itself. All else being the same, I could make 100 measurements with that ruler, and you could then make 100 measurements *of the same thing with the same ruler*, and the uncertainty could be different in both cases.
Comment: @ja72 - the truth is that Epimenides was right - he just didn't have the theoretical framework to understand that Cretans exist in a Schroedinger's-cat-like quantum state where neither truth or untruth can be determined without actually observing the Cretan - which just annoys them, because they don't like being stared at. (I suppose this begs the question of "How many quantum Cretans can dance of the head of a quantum pin?", but I ain't goin' there! :-)
Comment: [Measurement uncertainty](https://en.wikipedia.org/wiki/Measurement_uncertainty)
Comment: There's inaccuracy (how far off the right answer you are), and there's precision, which boils down both to how fine a gradation you can read *and* to what the repeatability of your reading is.
Answer: There is no "one size fits all" answer to your question.
First - the size of the smallest division on a meter ruler need not be one mm. I have a ruler that only goes down to half cm divisions, and I have one that gives half mm divisions.
Second - a ruler may not be accurate to the nearest division. Wooden rulers in particular will grow and shrink with humidity, they can become bent, and they may have been poorly constructed to begin with. Metal rulers tend to be better in this regard.
Third - your ability to align the ruler with the thing you are measuring. Parallax error can come into play (more so for thicker rulers), as well as a "zero" error: does the end of the ruler really correspond to zero? Is the end fully straight, or worn? Is the ruler accurately aligned with the direction of the thing you are measuring?
Example of two rulers that don't agree on "zero" (by about 1.2 mm) - note also the effect of parallax, where the line of 1" aligns exactly, but the 0.5" and 1.5" lines seem to be shifted; this is due to the relatively close distance of the camera to the ruler, and the magnifying effect this has on the metal ruler relative to the wooden one behind it:

All these factors matter in determining the error of your measurement. But if you are just interested in quoting the number you read off your ruler (assuming it is marked in mm) and you thought the nearest value was 345 mm, then you would have to ask yourself - could it have been 346? If your measurement was "almost half way" between two values the answer is clearly "yes", and you can see you would be wrong to say +- 0.5 mm; this is why one would commonly quote the error due to the device as one unit of the least significant measurement. But note that other factors may contribute additional error.
Comment: @CarlWitthoft I understand that. My point was that a ruler with 0.1 mm graduations is likely to be **no more accurate** than 0.1 mm - and possibly less. Which is why I am advocating _against_ trying to estimate subdivisions.
Comment: @msh210 while it is possible to estimate subdivisions, you have to be careful about interpretation of the error: was the ruler intended to be that accurate? In other words is the scale sufficiently linear to allow that interpolation? Usually the answer is "no". 1 mm on 1 m is 0.1% which is actually rather good...
Comment: Fair enough!ONEONEONE (needed more chars to be able to post)
Comment: +1. Re "if… quoting the number you read… (assuming it is marked in mm) and you thought the nearest value was 345 mm, then… ask… could it have been 346? If your measurement was 'almost half way' between two values the answer is clearly 'yes', and you can see you would be wrong to say +- 0.5 mm": Right, but that's only because you're choosing imprecision. If instead you say exactly what you think you see (e.g. "345.4 mm" even though the lines are 1 mm apart), you won't be off by more than 0.5 mm (for this reason). But you need to drop a digit after e.g. multiplying that measurement.
Comment: Careful: you're mixing accuracy and precision there.  A ruler which has 0.1mm gradations will give you an answer with precision of 0.05mm but the entire ruler might only be accurate to 20% if it was built badly.
Answer: Indeed, the uncertainty associated with each reading on your meter rule would carry an uncertainty of 0.5mm. However, in order to measure the length of anything, you would really need to make two readings: one at each end of the object under measurement. Even if you start from the "zero" mark on your rule, it is really a reading of 0.0 cm by you, so it too carries some undertainty. Then I am sure your physics class on uncertainty would have taught you how to combine uncertainties: in this case because you subtract two quantities, their absolute uncertainties add - Hence you get an uncertainty of 1mm.
The above argument is the theoretical explanation for the apparent inconsistency you raised in your question (i.e. whole division or half division to quote as uncertainty?) Meaning: this probably would be what most marking schemes of physics exams expect from you when they ask about it.
In reality of course, things are quite complicated, and I completely agree with the points raised by Floris. You should certainly take into account those practical considerations, if you are concerned about what is the real uncertainty of your actual measurement in reality in an experiment, not what you should write on the answer script of your exams.
Comment: This was such a beautiful reply. Most people just think they are taking only one measurement, but actually as you pointed out so well, they are taking two readings when making a measurement.

The uncertainty of a metre ruler?


Tune of wind instruments and the strength of blow

Question: First of all I want to inform you that I wasn't that close with music in my life so I might not know the obvious and mix up terminology. I am gathering information for an engineering project involving a recorder.
I have played the recorder for a few years in elementary school, so I know how to play the keys. But know when I am trying to simulate the keys with a pneumatic device, I am having some questions about tunes and the strength of blow. The pitch of the key differs when the strength of the blow differs. So, I assume that there is one right rate of flow that plays the perfect tune for a specific key (ignoring tremolo). Then how are symbols like forte, piano, cresendo, etc. played? So is keeping a consistant blow for each key important in wind instruments?
Comment: You might like this contraption:  https://www.youtube.com/watch?v=OjONQNUU8Fg, or even better,   https://www.youtube.com/watch?v=uEzGHg-JBZU
Comment: It matters a lot: for instance, you can get two different pitches even from one fingering. If you blow harder ("overblow"), you can get a pitch one octave higher. You can also make intentional slight variation in wind speed for vibrato.
Comment: When recorders were at their most popular the crescendo hadn't yet appeared in western art music. When it did appear it became so popular that some instruments - those with the narrowest dynamic range - became less useful to orchestral composers. Most instruments could be adapted but the recorder couldn't. Its lowest notes were no use in loud music: its highest no use in soft music.
Answer: Yes, changing the air flow changes the pitch for all wind instruments. But, unlike an organ pipe, most wind instruments also have other mechanisms to alter the pitch, e.g., tongue position, embouchure, or alternative fingerings that lengthen or shorten the vibrating air column slightly and thereby alter the pitch. So if the air pushes the pitch in one direction, you can compensate with the other mechanisms.
The recorder is a bit of a special case.  My recorder book (The Modern Recorder Player, Hauwe) says something like "at an amateur-to-intermediate level, the recorder is best considered like an organ pipe with a very limited dynamic range".
But even recorders can support dynamics by using different fingerings for the different dynamics.
Answer: Wind instruments change pitch depending on how hard they are blown. When blown harder instruments like the flute or recorder go up in pitch and instruments like the clarinet go down in pitch. Experienced players learn to compensate for this by embouchure adjustments and possibly fingering changes so they play in tune at any dynamic level.
Answer: If building a fipple flute type of instrument (aka a recorder) you will likely have to adjust the blowing pressure for each note. On a recorder the lower notes need a steady low pressure air stream. High notes typically need more pressure and flow. Every wooden recorder differs slightly.
Also the thumb hole aperture typically changes between notes in the upper register. It is possible to keep it a constant size as Paetzold do in their line of square instruments. I have no idea how they achieve this.
Getting any real dynamics out of a recorder style instrument is difficult. Loud low notes are almost impossible as are quiet high notes. Tuning varies with air pressure. Alternative fingerings can help, but there is not a complete set of loud or soft fingerings available. Consorts of recorders often cheat by blowing softly or heavily and hope that the listener did not notice the slight pitch change.
Answer: The following comes from my experience playing in recorder ensembles, so I will answer your questions from the perspective of playing together with other recorders.
Indeed, you can change the pitch of a note by strengthening or loosening your blow. We often use this to tune some notes relative to each other. We tune all recorders to the A of the lowest recorder, but as all recorders are different we often have to tune other combinations of notes/chords individually as well (while playing!). So for example if the C on my recorder has a high pitch relative to the G of my neighbour, one (or both) of us has to alter their blow strength every time we play a C/G together, especially on emphasised notes and chords.
When playing with a group, you can emulate forte and piano by varying the note length. So for forte you'd stretch out a note as close to the next note as possible, and for piano you'd cut a note of earlier (as a general rule of thumb, what sounds like forte in one situation could sound like piano in anouther, context matters so much).
Because the relative tuning to each other is what matters most though, you can often get away with all strengthening your blow just a little bit.
This is what we often do when there's a crescendo for everyone.
It takes a lot of tailoring and trial and error to get this right for an entire piece, and (to me) it is definitely the most challenging and fun part of playing in a recorder ensemble.
The feeling when you get this right is totally worth it though!


Are any descriptions of Rudra's aspect?

Question: Are any descriptions of Rudra's aspect ? If yes, where we can find them?
Comment: what do you mean by aspect? Did you mean Saumya and Raudra aspect.../ Ghora-Aghora aspect...?...
Comment: There are 11 Rudras. About which Rudra are you talking?
Comment: Any description of Rudra from the scriptures. For example does he has horns? does he wear tiger skin? etc..
Comment: All of them...i am searching their aspects.
Comment: @LuckyPashu if you are really interested in in-depth exploration and have the patience to read then please try "Sanatana Dhara Rudra Shiva across Vedas and Itihasa" in Google. Good luck.
Answer: Read the shivopasana mantra of the Krishna yajurveda Mahanarayanaya Upanishad. It describes and covers the 5 primary aspects of shiva/rudra.
Rudra/Shiva is of 5 aspects sadyojata, ghora/aghora, vamadeva, tatpurusha, ishaana.
Sadyojata: source of all existence
Vamadeva: the most beautiful and effulgent
Aghora/Ghora: terrifying and non terrifying
tatpurusha: the Supreme Personality/Purusha
Ishaana: the supreme ruler and creator of all beings
His specific form is described as the following:
namo hiraNya-baahave hiraNya-varNaaya hiraNya-ruupaya hiraNya-pataye
ambikaapataya umaa-pataye pashu pataye namo namah
Namaha to the One who has golden hands ( hiraNya-baahave ) ; who is the golden hue or whose speech is charming ( varNa means colour or word ) ; who is of golden form ( ruupa ) or whose form is charming ; who is Lord ( pataye ) of wealth and gold ; who is the Lord of Mother Ambika and Lord of Uma and who is the Lord of all beings ( pashu : animals )
And from the rudram he is described as the following:  om namaste astu bhagavan visvesvaraya mahadevaya
tryambakaya tripurantakaya trikalagni-kalaya
kalagnirudraya neelakanthaya mrutyunjayaya
sarveshvaraya sadashivaya shrimanmahadevaya namah
Om. Oh, Bhagavan, may this salutation be unto you who is the Lord of the universe, the great God, the three-eyed, the destroyer of demon Tripura, who is the Sandya time when three fires are lit, the Rudra that is the fire that consumes the universe, the blue-necked, the conqueror of death, the Lord of all, the ever-auspicious one.  Salutations unto the glorious great Lord.
Hope above helps sources are Shivopasana Mantra from Krishna Yajurveda and Sri Rudram.

Are any descriptions of Rudra's aspect?


Location of BIOS file on asus eee pc 1005ha

Question: I just upgraded ram from 1 gb to 2 gb. The system won't see the 2 gb, so I learned that I need to update the BIOS. Where is this located?
Answer: On a chip somewhere deep in the motherboard. - You typically use a special program to update the motherboard - it either runs within Windows or generates a disk/cd that you use on startup.
The Asus support website does not allow copy/paste direct links to certain pages (as it is all ajaxy!), so you can either click here and navigate through the site yourself or click here directly for the latest (official) BIOS update.
Comment: which bios version should i user?
Comment: The latest version
Answer: The BIOS is located on a ROM chip on your motherboard. It can be updated through a process called flashing. To find the update file, you'll need to visit your motherboard manufacturer's website and grab it from the BIOS update section. Uniflash should help you with flashing it.


Is the Vivitar SF 4000 flash compatible with the Canon Rebel XT?

Question: Is the Vivitar VIV-SF-4000 flash compatible with a Canon Rebel XT? It will flash but doesn't seem to sync with all the settings.
Answer: The SF-4000 is a manual-only flash.  If you look at the foot, it only has a single pin. This isn't unreasonable for a $20 flash unit.  It will fire in sync so that the light will register in the image when you take the shot.  But it won't understand 2nd curtain sync, HSS, or eTTL signaling, and it cannot be controlled from the camera menu--that type of communication requires the other four pins of the Canon hotshoe (look at the camera hotshoe contacts).
The SF-4000 does also have "dumb" optical slave modes.  It does not "speak" Canon's wireless eTTL optical slave protocol, but does have a sensor that will fire the flash when it senses another flash burst, so you can use it off-camera by tripping it with your XT's pop-up flash. However, the XT's flash cannot be put into M mode (i.e., not fire an eTTL pre-flash), so you'll have to use a slave mode on the SF-4000 that can ignore the preflash for the proper timing.


Tracking when variables get updated

Question: I have a problem with org-mode's agenda view. While I've set org-agenda-files to '("~/org/") invariably when I finally spin up M-x org-agenda I find that org-agenda-files just points to one org-file. Obviously something is deciding just to include the last org-file I viewed but I'm having trouble working out what. Is there any way to trap when this variable is changed and display or log some sort of backtrace?
Comment: From the `org-agenda-files` docstring, "If an entry is a directory, all files in that directory that are matched by `org-agenda-file-regexp` will be part of the file list." By default, that regexp matches all files with `.org` extension in that directory. Can you tell how you have your .org files organized? Do they belong in the `~/org/` folder directly? Or are they in sub-directories under that?
Comment: ageneda -> agenda
Comment: @kaushalmodi: yeah, my ~/org/ is full of org files each with a bunch of TODOs in them (I have one per "topic" with an index.org).
Comment: What version of `org` are you using?  Also could you do the following to test:  Run `emacs -q` then in scratch point to your installation of Org `(add-to-list 'load-path "path/to/org")` if from ELPA or Git, if using built-in you can disregard.  Then in scratch `(require 'org)` `(setq org-agenda-files "~/org/")` `(org-agenda nil "t")`.  See if your TODOs all show up.
Comment: @JonathanLeech-Pepin: Latest org for the org ELPA archive (current 8.2.7c on this box).
Answer: In this situation, I find that the best way to figure out what's going
on into is to visit my ~/.emacs.d/ and run rgrep.
Searching your configs
The following snippet, taken from here, makes sure that rgrep
doesn't go into the elpa/ subdir (since you're sure to find dozens
of useless hits in there).
(eval-after-load 'grep
  '(progn
     (add-to-list 'grep-find-ignored-directories "auto")
     (add-to-list 'grep-find-ignored-directories "elpa")))

Then I just run
M-x rgrep RET org-agenda-files RET *.el RET ~/.emacs.d/

which will find any reference to org-agenda-files in my
configuration. If it's a problem with my configs, this will find it.
Searching Elsewhere
If the above doesn't find anything, it means there's an Elpa package
causing trouble. So I do
M-x rgrep RET org-agenda-files RET *.el RET ~/.emacs.d/elpa/

This will usually yield a lot of results, but there are ways to go
through them quickly. For instance, it's very unlikely that org-mode
itself is causing this problem. So it's safe to ignore all hits that
come from inside org-modes installation directory.
Comment: Sadly the only place I find it referenced (apart from my config set-up) is in the ELPA version of org. Hence wondering if there was a better way to trap when org updated it.
Comment: Mystery solved! In the end I found the offending line in ~/.emacs.d/my-custom.el which is what _custom-file_ points at. As this is loaded at the end of my init.el it was over-writing what my-org.el had set up. Also as my elisp files are in a sub-dir why I didn't find it earlier.
Answer: Another option you have is to track the value of this variable throughout the execution of org-agenda, that has to tell you where the problem is.

Evaluate the following code:
(global-set-key [f1] (lambda () (interactive) (message "%s" org-agenda-files)))

Visit the function with M-x find-function RET org-agenda.
Edebug it with C-u C-M-x.
Call the function, M-x org-agenda.
Gradually step through it by pressing n, and monitor the value of the variable by hitting F1.

At some point inside the org-agenda function, you'll hit F1 and the value of org-agenda-files will have changed. That will tell you where to look.
Comment: You could also redefine the function with a bunch of messages, if you don't want to Edebug.
Answer: Since 26.1, you can use add-variable-watcher to track the variable where and how be changed.
 Function: add-variable-watcher symbol watch-function

Because the watch-function will be called with 4 arguments: symbol, newval, operation, and where, you can simply add a watcher in your init.el, for example,
(add-variable-watcher 'tab-width (lambda (&rest x) (message "Oops! tab-width changed: %S" x)))

which gives you some messages like
Oops! tab-width changed: (tab-width 2 set #<buffer xxx.el>)

Answer: Are you ever using C-c [ (org-agenda-file-to-front) or C-c ] (org-remove-file) while in an org file?
These overwrite the current org-agenda-files with a hardcoded list of files that will no longer use your defined ~/org/ as a source.
Also if you are setting it to ~/org/ please ensure that the agenda files you want are in that folder with .org for the extension.  Otherwise they will not be detected.
Comment: I'd like to add that if you don't expect the list of agenda files to change very frequently, it's better to add that list of files to something like `~/org/agenda.files` and set `org-agenda-files` to `~/org/agenda.files`.
Comment: Not consciously. Indeed they are not mapped to useful keys for me.

Tracking when variables get updated


Has Data's cat Spot always been played by the same cat?

Question: In Star Trek : TNG, the android Data has a cat named Spot. Spot appears in several episodes in multiple seasons. Has this role always been played by the same cat? Or have there been other 'Spots'?
Answer: Spot was played by at least six different cats over the seven seasons and movies where Spot makes an appearance.
Spot actually changes from a long-haired Somali cat to an orange tabby in Season 6. Even Spot's gender changes from male to female in the course of the series.
In universe, it's possible Data simply owned multiple cats, all named Spot, although this is never confirmed. Otherwise, the changes to Spot are simple retcons.
According to the Memory Alpha article on Spot, the six different cats that portrayed Spot include:

Two long-haired Somail cats.
Monster
Brandi
Bud
Tyler

Additionally, two backup cats, Spencer and Zoe, were also trained to act as Spot for the TNG films.
Comment: Spot II in Discovery seems to imply Spot I in TNG was a single cat (at least in-universe).


mount encfs over nfs?

Question: I am trying to mount a nas drive in ubuntu 16.04, then create an encfs mount from that for uploading the encrypted contents to the cloud.
/mnt/nas  #decrypted (NFS mount from the NAS)
/mnt/.nas #encrypted (encrypted on local file system using decrypted data from NAS mount)

The first mount works fine:
sudo mount 192.168.2.10:/volume1/filestorage /mnt/nas/

I can see the contents just fine in that mount. Then I try to encrypt it with encfs:
echo 'MYPASSWORD' | ENCFS6_CONFIG='/home/user/encfs.xml' encfs -o allow_other -S /mnt/.nas/ /mnt/nas/

And it returns this error:
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
fuse failed.  Common problems:
 - fuse kernel module not installed (modprobe fuse)
 - invalid options -- see usage message

So I modify my command:
echo 'MYPASSWORD' | ENCFS6_CONFIG='/home/user/encfs.xml' encfs -o allow_other,nonempty -S /mnt/.nas/ /mnt/nas/

This time there is no error, but when I look at the either /mnt/.nas or /mnt/nas, they both show empty. When I umount the drive like this
sudo umount /mnt/nas/

The /mnt/nas/ path shows all the NAS files again. When I run the exact command a second time, it removes the mount with the NAS.
I will also add, I tried mounting encfs first, THEN mounting the NAS drive. In that case, I can see the files in /mnt/nas but /mnt/.nas is empty.
Here's the contents of /etc/exports on the NAS. This was setup via the Synology UI.
/volume1/filestorage *(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)

I have had encfs working fine on this server for a while now using the  .encfs6.xml file I generated just fine for months. The only difference is I purchased a NAS and started moving all files there for local backup. So instead of running encfs on local encrypted and decrypted directories, the decrypted directory is now an NFS mount from the NAS, and the encrypted files are in a local path on ubuntu.
How do I mount the NAS decrypted files, then use encfs to encrypt them to be uploaded to the cloud from the Ubuntu server?
EDIT Tried same process with sshfs & encfs, same result.
Answer: You need --reverse, see https://github.com/vgough/encfs/blob/master/encfs/encfs.pod:

With --reverse it takes as source plaintext data and produces enciphered data on-demand.

mount encfs over nfs?


Please help Txhash

Question: i looked up my txhash on etherscan and the (from) address does not match my own. I verified the (To) address and it is correct. Even the value is the same as my purchase. How is this possible? What are my options? Please help
Answer: Why do you think it's not your own? Transactions don't have a 'from' address, it's possible etherscan made a mistake in guessing who it's from. But more likely it is one of your addresses, perhaps a different one to the one you thought, such as a change address. Or if you're using an exchange or web wallet, it might just be from another one of the UTXOs that exchange/wallet has, not deposited to you

Please help Txhash


FPGA based RTL evaluation

Question: Currently I am testing some RTL, I am using ncverilog, and it is very ... very slow. I have heard that, if we use some kind of FPGA boards, then things will be faster. Is it for real?
Comment: @Brian: When it comes to a single run of testing, the time difference will be in the order of a minute. But, when we run a comprehensive test, the difference is in the order of days ~ (I mean it, days~~)
Comment: What do you consider very very slow?  Minutes or hours.
Answer: You're talking about two different things.
NCVerilog is a simulation tool while an FPGA board is real hardware. So, there will be differences. Real hardware will be generally faster but with a simulator, you can have all sorts of debugging fun. Trying to probe a specific signal is just a matter of adding a line to the testbench. Also, you can easily make changes to the simulated model instead of having to redesign the FPGA board.
If you run simulation on a sufficiently powerful machine, you can sometimes approximate real-world performance (assuming that the FPGA is a slow one).
All in all, you should do both. Use a simulator to do your basic development and evaluation. Move onto your FPGA hardware once your design is sufficiently well defined.
Comment: Good answer (easy to understand for a newbie like me). Thank you!
Answer: You can trace activity on signals in a running FPGA design using "embedded logic analyzer" software tools like Altera SignalTap or Xilinx ChipScope.  Before synthesizing/mapping your RTL to the device, you would use these tools to attach soft probes to the signals you want to watch.  You can set triggers so that a signal's values only get logged under certain conditions.  Then you generate the bitfile and program the device with JTAG.  The logic analyzer communicates with your PC over JTAG and logs activity on your probes, which you can then analyze.
It's a bit complicated to set up, as these tools are not especially easy to use, but you will get results much faster than with RTL simulation.
Answer: We've had the same issues with simulation speed too.  However, we stick with simulations for the majority of our verification.  Each sim checks a specific function and are much quicker than system-level sims.  We've also made them self-checking and are useful for regressions tests (unit-tests).
For long system tests on real-world signals that take too much time to simulate, we move these to the FPGA if we can.  We need to manually re-check all these testcases again after code changes, so it can be slow in its own way.
Sometimes though, FPGAing a design is just not feasible. Sometimes full designs are too large to fit into an FPGA, or the clock rate is too high.  But remember that you don't necessarily have to FPGA your entire design, it may be enough to get the important block you're interested in and check this out fully.
Answer: What kind of RTL are you testing ? If you use FPGA boards, then you can compile
your code provided you have the right tool for the right FPGA. Since FPGA are reprograammable, then of course you can test your code on the board, and have the target (FPGA) execute your code (RTL)
But it is no more a simulation, it is a test, with a given hardware, at a given clock speed.
And you don't get nice result on the screen, you need to use physical probe and scope. Plus you don't get to see how the internal of your code is working.
verilog or VHDL simulation is sort of like running code using a debugger. FPGA testing is more like debugging with printf. The big difference is that when simulating, your CPU has to simulate the behaviour of all those logic gate that results of your code. On the FPGA, there is no simulation, you just 'run' the code, so it is much faster, but you have less information.
You should use simulation for very small components, and then test your whole program on a FPGA.
Answer: You're probably asking about hardware simulation accelerators.
Here is one of them : GateRocket
Comment: GateRocket went out of business last year.

FPGA based RTL evaluation


Why the notation $A\equiv C \pmod B$ instead of $A \text{ mod } B = C$?

Question: Why is, for the modulus operation, the notation $A\equiv C \pmod B$ used instead of $A \text{ mod } B = C$? Or alternatively $\text{mod}(A,B) = C$ or, as in many programming languages, $A\text{ } \% \text{ } B = C$.
Comment: Because $42\bmod 8=2$, but you also have $42\equiv 34\pmod{8}$.
Comment: So math $A \equiv B \text{ mod } C$ is programmer $ A \% C = B \% C$
Comment: Programmers use mod as a binary operation. Mathematicians use it as a binary relation.
Comment: As said below, mathematicians don't really have much use for mod as a binary operation. But the binary relation (indeed, congruence relation) is useful because, as the name "modular arithmetic" suggests, we can actually do arithmetic mod $n$. That is, if $a\equiv b$ and $c\equiv d$ then $a+c\equiv b+d$ and $ac\equiv bd$ mod $n$. So the integers mod $n$ form a finite number system with addition and multiplication operations. We can then use polynomials to construct all possible finite fields (which computer scientists are interested in too).
Comment: @arctictern But mathematicians do indeed perform computations and so they do indeed used normal forms (here the binary operator form of mod). Number theorists use if quite frequently. For example, the fraction $\,a/b\,$ must be in normal form (lowest terms) in order to apply the Rational Root Test.
Comment: @BillDubuque Yes, we implicitly use the binary operator to obtain least residues in the usual set of integer representatives $\{0,\cdots.n-1\}$. Fair enough.
Comment: @arctictern Not only implicitly, but also explicitly, e.g. $\,x^N = 1\,\Rightarrow\, x^A = x^{A\ {\rm mod}\ N}.\ $ Also it is heavily used in the polynomial case when working in quotient rings $\,K[x]/(f(x))\ $
Answer: Because $A\equiv C\pmod{B}$ and $A\bmod B=C$ mean very different things. The first just says that $A-C$ is a multiple of $B$, so for a given $A$ and $B$ there are infinitely many different values of $C$ making it true. The second says that $C$ is the unique integer in the set $\{0,1,\ldots,B-1\}$ for which $A-C$ is a multiple of $B$.
To put it a bit differently, the first expresses a relation; it's analogous to the expression $A=C$ that also expresses a relation between $A$ and $C$. The $\bmod$ in the second is a binary operation on its arguments, analogous to the $+$ in $A+B$: like $A+B$, $A\bmod B$ returns a unique value.
Comment: In the first one, the $\pmod B$ is not an independent part of the expression, per se, but rather a clarification of $\equiv$. A notation that could've been more intuitive would be $A\equiv_BC$, but unfortunately, that's not how we write things.
Answer: The notation $m\equiv n\pmod{k}$ means
$$
k\mid (m-n)
$$
In words, $k$ divides $m-n$.
On the other hand, $m\bmod k$ denotes the unique number $n$ with $0\le n<k$ such that $$m\equiv n\pmod{k}$$ (under a very common convention).
As an example, $42\bmod 8=2$, but we can also write $42\equiv 34\pmod{8}$.
Comment: @drhab There are several conventions about the definition of the binary operation "mod". I used the simplified setting where $k>0$ is an integer, but it can be generalized and the definition $m-k\lfloor m/k\rfloor$ is frequently used and works also for non integer $k\ne0$.
Comment: Just curiosity: is $m-k\times\lfloor\frac{m}{k}\rfloor$ a proper definition of $m\text{ mod } k$?
Comment: But beware that there are two different and possibly reasonable conventions for the meaning when $m$ is negative, and perhaps more choices when $k$ is negative, and the often-horrible choice made by a few programming languages to have the codomain be $1, 2, \ldots, k$ rather than $0, 1, \ldots, k-1$.
Comment: @JohnHughes Indeed I warned about possible different conventions. Listing them all might overflow the allotted length for answers.
Answer: The familiar
a % b

or
mod(a, b)

found in many programming languages is a function from the integers to the set $\{0, 1, \ldots, b-1\}$ (or something very similar). That function finds surprisingly little use in mathematics, however, so little that there's no standard notation for it that I know of.
On the other hand, the notion of "equivalence mod $a$", where integers $x$ and $y$ are considered equivalent if their difference $x-y$ happens to be divisible by $a$, comes up a lot, so mathematicians invented a notation for it: they write
$$
x \equiv y \bmod a.
$$
The "equivalence classes" for this relation, e.g., for $a = 3$, the three sets
$$
\{\ldots, -6, -3, 0, 3, 6, \ldots \} \\
\{\ldots, -5, -2, 1, 4, 7, \ldots \} \\
\{\ldots, -4, -1, 2, 5, 8, \ldots\}
$$
have the property that each one contains exactly ONE of the numbers between $0$ and $a-1$, so we often use those to indicate which set we're talking about, writing something like
$$
\bar{0} = \{\ldots, -6, -3, 0, 3, 6, \ldots \} \\
\bar{1} =\{\ldots, -5, -2, 1, 4, 7, \ldots\} \\
\bar{2} =\{\ldots, -4, -1, 2, 5, 8, \ldots\}
$$
to "name" the equivalence classes. Since there's no easy way, in a computer, to write down an infinite set, programmers decided to use these "names" (dropping the bar) to denote the equivalence class.


Delaying the Roll out of Offer Letter

Question: I'm an experienced professional and I applied for an opening through Job Board. My profile got shortlisted and I gave 1 Aptitude written test, 1 telephonic interview (technical) , 2 face to face technical interviews. Post the 2nd interview, the I was told that i'm selected and they'll be rolling out the offer soon. However it's been 2 weeks and I've still not heard anything from the HR. I called them 3-4 times but they kept on delaying giving some excuse. What should I do?
Answer: I'd suggest trying somewhere else. There will always be companies who keep on delaying accepting or refusing you. Don't put all your eggs in one basket.

Delaying the Roll out of Offer Letter


ArcGIS Pro attribute table question

Question: I'm in the middle of the transition from ArcMap to ArcGIS Pro. I have many records that I need to review. In ArcMap, I pan to the record (ctrl + N), use the down arrow key to go to the next record. In ArcGIS Pro, I pan to the record but when I use the arrow key it nudges the map. Does anyone know how to keep the attribute table active?
Answer: The arrow key press will be handled by which ever view is active.  Click on the attribute table's title (tab) to make it active, then press the down arrow if you want to go to the next record down.
Comment: My question was if there was a way to keep the attribute table active. After panning the record, the active view becomes the map. I would like to keep the attribute table active to avoid clicking and having to take my hands off the keyboard altogether.
Comment: You may need to explain further (or perhaps your ArcGIS Pro behaves differently to mine).  When I pan the table it remains the active view.
Comment: Interesting, I'm wondering if it's a version issue. In a different forum, somebody mentioned the behavior you experience but after a version update now experiences what I do.
Comment: Sounds like a bug then.  You should probably report it to ESRI as a support issue.

ArcGIS Pro attribute table question


dictations, improving spelling

Question: I'm looking for a website that would propose free dictations in English, so that I could listen and then type what I hear and at the end to see if I made any mistakes. I was searching in the Internet, but I didn't find anything close enough. May be someone knows and wouldn't mind to share ?
Thanks!
Comment: I'm voting to close this question as off-topic because it is a request for resources, rather than about the English language itself.
Answer: Check this link on meta ELL.
This meta post on ELL lists many resources, one of which relates to pronunciations. The other resources are quite useful as well.
Answer: The Writer's Almanac is a daily radio segment/podcast which features Garrison Keillor in 5 minutes of talk and poetry.  There is not a literal transcript for the entire program, but there is a "set of notes", so to speak, which can used to help interpret what is said, and there is an exact copy of the poem featured in each segment.
Keillor is a good source for pronunciations and diction as he has a clear and near-perfect Midwestern accent, and I only very rarely detect what I would consider a mispronunciation.  (Though some episodes in the summer of 2013 were done by poet Billy Collins, who notably cannot pronounce "poem" correctly.)

dictations, improving spelling


Is there some way to add Stormcloud to startup application?

Question: I'm enjoing a lot Stormcloud, the downside is that it doesn't have a "startup" option so sometimes I forget to use it. Is there some way to add it to the startup applications?
Answer: Open the unity dash and type `startup applications. There you can manage the applications that will start automatically with your session. Include Stormcloud there and it's done.
If you don't know the command, after you click Add inside Startup Applications, you'll see a Browse button. Click on the left side of Nautilus where it says File System. Click on the bin folder. Inside this bin folder you'll see all of the different applications installed. Scroll through until you find the right command.
Comment: I don't know the command :(
Comment: try just "stormcloud", without the quotes
Answer: This depends on what Ubuntu desktop you are using, but ultimately, it'll always be a simple job.
If you are using the Unity desktop, then simply click the "power" icon in the top right hand corner of the screen and click "Startup Applications". You will see below the icon in question. You can find that little "power" icon in the top right hand corner of the Unity desktop.

This dialogue box will appear. Simply click Add, choose the command to run on start-up (You can press Browse from there to save you time typing in the command, or if you know exactly what the command is, you can type it in) and then it should be saved to your startup applications preferences.
Comment: I don't know the command or where it is :(
Comment: For the command, try 'stormcloud' without the quotes. I could not directly find a link to confirm if this works.


Motion in a central field and angular momentum

Question: Is it correct that for a motion in a central force field, e.g. a gravitational field, the absolute value of the total angular momentum of the particle and the component of the perpendicular to the plane of motion are conserved, but the other components of the angular momentum in general not?
Answer: I believe all three components are constant.
First, be sure you are careful about the point from which you are measuring angular momentum. The definition of angular momentum is $\vec{L}=\vec{r}\times\vec{p}$, where $\vec{r}$ is the position of the object measured from your point of origin. This point can be whatever you want, but it's most convenient to measure it from the "source" of your force.
To answer your question, the rotational analog of Newton's second law can help:
$$
\vec{\tau}_\text{net} = \frac{d\vec{L}}{dt}.
$$
As long as the net torque is zero, then $\vec{L}$ is constant – all of the three components! In the case where the position vector $\vec{r}$ is measured from the source of the central force, then the corresponding torque is indeed zero (since force and position would be (anti)parallel, causing a zero cross product).
Note that using the convention for the position vector described above, the direction of angular momentum is perpendicular to the plane of motion. Use the good ol' right hand rule to convince yourself of this. So I suppose the "other" two components you mention are constantly zero.
Comment: Note that the if the point of origin is taken to be something other than the center where the force is directed, then angular momentum will not be conserved.