Question:
I am reading a data mining book and it mentioned the Kappa statistic as a means for evaluating the prediction performance of classifiers. However, I just can't understand this. I also checked Wikipedia but it didn't help too:
How does Cohen's kappa help in evaluating the prediction performance of classifiers? What does it tell?
I understand that 100% kappa means that the classifier is in total agreement with a random classifier, but I don't understand how does this help in evaluating the performance of the classifier?
What does 40% kappa mean? Does it mean that 40% of the time, the classifier is in agreement with the random classifier? If so, what does that tell me or help me in evaluating the classifier?

Introduction
The Kappa statistic (or value) is a metric that compares an Observed Accuracy with an Expected Accuracy (random chance). The kappa statistic is used not only to evaluate a single classifier, but also to evaluate classifiers amongst themselves. In addition, it takes into account random chance (agreement with a random classifier), which generally means it is less misleading than simply using accuracy as a metric (an Observed Accuracy of 80% is a lot less impressive with an Expected Accuracy of 75% versus an Expected Accuracy of 50%). Computation of Observed Accuracy and Expected Accuracy is integral to comprehension of the kappa statistic, and is most easily illustrated through use of a confusion matrix. Lets begin with a simple confusion matrix from a simple binary classification of Cats and Dogs:
Computation
     Cats Dogs
Cats| 10 | 7  |
Dogs| 5  | 8  |

Assume that a model was built using supervised machine learning on labeled data. This doesn't always have to be the case; the kappa statistic is often used as a measure of reliability between two human raters. Regardless, columns correspond to one "rater" while rows correspond to another "rater". In supervised machine learning, one "rater" reflects ground truth (the actual values of each instance to be classified), obtained from labeled data, and the other "rater" is the machine learning classifier used to perform the classification. Ultimately it doesn't matter which is which to compute the kappa statistic, but for clarity's sake lets say that the columns reflect ground truth and the rows reflect the machine learning classifier classifications.
From the confusion matrix we can see there are 30 instances total (10 + 7 + 5 + 8 = 30). According to the first column 15 were labeled as Cats (10 + 5 = 15), and according to the second column 15 were labeled as Dogs (7 + 8 = 15). We can also see that the model classified 17 instances as Cats (10 + 7 = 17) and 13 instances as Dogs (5 + 8 = 13).
Observed Accuracy is simply the number of instances that were classified correctly throughout the entire confusion matrix, i.e. the number of instances that were labeled as Cats via ground truth and then classified as Cats by the machine learning classifier, or labeled as Dogs via ground truth and then classified as Dogs by the machine learning classifier. To calculate Observed Accuracy, we simply add the number of instances that the machine learning classifier agreed with the ground truth label, and divide by the total number of instances. For this confusion matrix, this would be 0.6 ((10 + 8) / 30 = 0.6).
Before we get to the equation for the kappa statistic, one more value is needed: the Expected Accuracy. This value is defined as the accuracy that any random classifier would be expected to achieve based on the confusion matrix. The Expected Accuracy is directly related to the number of instances of each class (Cats and Dogs), along with the number of instances that the machine learning classifier agreed with the ground truth label. To calculate Expected Accuracy for our confusion matrix, first multiply the marginal frequency of Cats for one "rater" by the marginal frequency of Cats for the second "rater", and divide by the total number of instances. The marginal frequency for a certain class by a certain "rater" is just the sum of all instances the "rater" indicated were that class. In our case, 15 (10 + 5 = 15) instances were labeled as Cats according to ground truth, and 17 (10 + 7 = 17) instances were classified as Cats by the machine learning classifier. This results in a value of 8.5 (15 * 17 / 30 = 8.5). This is then done for the second class as well (and can be repeated for each additional class if there are more than 2). 15 (7 + 8 = 15) instances were labeled as Dogs according to ground truth, and 13 (8 + 5 = 13) instances were classified as Dogs by the machine learning classifier. This results in a value of 6.5 (15 * 13 / 30 = 6.5). The final step is to add all these values together, and finally divide again by the total number of instances, resulting in an Expected Accuracy of 0.5 ((8.5 + 6.5) / 30 = 0.5). In our example, the Expected Accuracy turned out to be 50%, as will always be the case when either "rater" classifies each class with the same frequency in a binary classification (both Cats and Dogs contained 15 instances according to ground truth labels in our confusion matrix).
The kappa statistic can then be calculated using both the Observed Accuracy (0.60) and the Expected Accuracy (0.50) and the formula:
Kappa = (observed accuracy - expected accuracy)/(1 - expected accuracy)

So, in our case, the kappa statistic equals: (0.60 - 0.50)/(1 - 0.50) = 0.20.
As another example, here is a less balanced confusion matrix and the corresponding calculations:
     Cats Dogs
Cats| 22 | 9  |
Dogs| 7  | 13 |

Ground truth: Cats (29), Dogs (22)
Machine Learning Classifier: Cats (31), Dogs (20)
Total: (51)
Observed Accuracy: ((22 + 13) / 51) = 0.69
Expected Accuracy: ((29 * 31 / 51) + (22 * 20 / 51)) / 51 = 0.51
Kappa: (0.69 - 0.51) / (1 - 0.51) = 0.37
In essence, the kappa statistic is a measure of how closely the instances classified by the machine learning classifier matched the data labeled as ground truth, controlling for the accuracy of a random classifier as measured by the expected accuracy. Not only can this kappa statistic shed light into how the classifier itself performed, the kappa statistic for one model is directly comparable to the kappa statistic for any other model used for the same classification task.
Interpretation
There is not a standardized interpretation of the kappa statistic. According to Wikipedia (citing their paper), Landis and Koch considers 0-0.20 as slight, 0.21-0.40 as fair, 0.41-0.60 as moderate, 0.61-0.80 as substantial, and 0.81-1 as almost perfect. Fleiss considers kappas > 0.75 as excellent, 0.40-0.75 as fair to good, and < 0.40 as poor. It is important to note that both scales are somewhat arbitrary. At least two further considerations should be taken into account when interpreting the kappa statistic. First, the kappa statistic should always be compared with an accompanied confusion matrix if possible to obtain the most accurate interpretation. Consider the following confusion matrix:
     Cats Dogs
Cats| 60 | 125 |
Dogs| 5  | 5000|

The kappa statistic is 0.47, well above the threshold for moderate according to Landis and Koch and fair-good for Fleiss. However, notice the hit rate for classifying Cats. Less than a third of all Cats were actually classified as Cats; the rest were all classified as Dogs. If we care more about classifying Cats correctly (say, we are allergic to Cats but not to Dogs, and all we care about is not succumbing to allergies as opposed to maximizing the number of animals we take in), then a classifier with a lower kappa but better rate of classifying Cats might be more ideal.
Second, acceptable kappa statistic values vary on the context. For instance, in many inter-rater reliability studies with easily observable behaviors, kappa statistic values below 0.70 might be considered low. However, in studies using machine learning to explore unobservable phenomena like cognitive states such as day dreaming, kappa statistic values above 0.40 might be considered exceptional.
So, in answer to your question about a 0.40 kappa, it depends. If nothing else, it means that the classifier achieved a rate of classification 2/5 of the way between whatever the expected accuracy was and 100% accuracy. If expected accuracy was 80%, that means that the classifier performed 40% (because kappa is 0.4) of 20% (because this is the distance between 80% and 100%) above 80% (because this is a kappa of 0, or random chance), or 88%. So, in that case, each increase in kappa of 0.10 indicates a 2% increase in classification accuracy. If accuracy was instead 50%, a kappa of 0.4 would mean that the classifier performed with an accuracy that is 40% (kappa of 0.4) of 50% (distance between 50% and 100%) greater than 50% (because this is a kappa of 0, or random chance), or 70%. Again, in this case that means that an increase in kappa of 0.1 indicates a 5% increase in classification accuracy.
Classifiers built and evaluated on data sets of different class distributions can be compared more reliably through the kappa statistic (as opposed to merely using accuracy) because of this scaling in relation to expected accuracy. It gives a better indicator of how the classifier performed across all instances, because a simple accuracy can be skewed if the class distribution is similarly skewed. As mentioned earlier, an accuracy of 80% is a lot more impressive with an expected accuracy of 50% versus an expected accuracy of 75%. Expected accuracy as detailed above is susceptible to skewed class distributions, so by controlling for the expected accuracy through the kappa statistic, we allow models of different class distributions to be more easily compared.
That's about all I have. If anyone notices anything left out, anything incorrect, or if anything is still unclear, please let me know so I can improve the answer.
References I found helpful:
Includes a succinct description of kappa:

Includes a description of calculating expected accuracy:


Question:
Given a recording I need to detect whether any clipping has occurred.
Can I safely conclude there was clipping if any (one) sample reaches the maximum sample value, or should I look for a series of subsequent samples at the maximum level?
The recording may be taken from 16 or 24-bit A/D converters, and are converted to floating point values ranging from $-1...1$. If this conversion takes the form of a division by $2^{15}-1$ or $2^{23}-1$, then presumably the negative peaks can be somewhat lower than -1, and samples with the value -1 are not clipped?
Obviously one can always create a signal specifically to defeat the clipping detection algorithm, but I'm looking at recordings of speech, music, sine waves or pink/white noise.

I was in the middle of typing an answer pretty much exactly like Yoda's.  He's is probably the most reliable but, I'll proposed a different solution so you have some options.

If you take a histogram of your signal, you will more than likely a bell or triangle like shape depending on the signal type. Clean signals will tend to follow this pattern. Many recording studios add a "loudness" effect that causes a little bump near the top, but it is still somewhat smooth looking. Here is an example from a real song from a major musician:

Here is the histogram of signal that Yoda gives in his answer:

And now the case of their being clipping:

This method can be fooled at times, but it is at least something to throw in your tool bag for situations that the FFT method doesn't seem to be working for you or is too many computations for your environment.


Question: What are some good books for learning general relativity?

I can only recommend textbooks because that's what I've used, but here are some suggestions:

Gravity: An Introduction To General Relativity by James Hartle is reasonably good as an introduction, although in order to make the content accessible, he does skip over a lot of mathematical detail. For your purposes, you might consider reading the first few chapters just to get the "big picture" if you find other books to be a bit too much at first.
A First Course in General Relativity by Bernard Schutz is one that I've heard similar things about, but I haven't read it myself.
Spacetime and Geometry: An Introduction to General Relativity by Sean Carroll is one that I've used a bit, and which goes into a slightly higher level of mathematical detail than Hartle. It introduces the basics of differential geometry and uses them to discuss the formulation of tensors, connections, and the metric (and then of course it goes on into the theory itself and applications). It's based on these notes which are available for free.
General Relativity by Robert M. Wald is a classic, though I'm a little embarrassed to admit that I haven't read much of it. From what I know, though, there's certainly no shortage of mathematical detail, and it derives/explains certain principles in different ways from other books, so it can either be a good reference on its own (if you're up for the detail) or a good companion to whatever else you're reading. However it was published back in 1984 and thus doesn't cover a lot of recent developments, e.g. the accelerating expansion of the universe, cosmic censorship, various results in semiclassical gravity and numerical relativity, and so on.
Gravitation by Charles Misner, Kip Thorne, and John Wheeler, is pretty much the authoritative reference on general relativity (to the extent that one exists). It discusses many aspects and applications of the theory in far more mathematical and logical detail than any other book I've seen. (Consequently, it's very thick.) I would recommend having a copy of this around as a reference to go to about specific topics, when you have questions about the explanations in other books, but it's not the kind of thing you'd sit down and read large chunks of at once. It's also worth noting that this dates back to 1973, so it's out of date in the same ways as Wald's book (and more).
Gravitation and Cosmology: Principles and Applications of the General Theory of Relativity by Steven Weinberg is another one that I've read a bit of. Honestly I find it a bit hard to follow - just like some of Weinberg's other books, actually - since he gets into such detailed explanations, and it's easy to get bogged down in trying to understand the details and forget about the main point of the argument. Still, this might be another one to go to if you're wondering about the details omitted by other books. This is not as comprehensive as the Misner/Thorne/Wheeler book, though.
A Relativist's Toolkit: The Mathematics of Black-Hole Mechanics by Eric Poisson is a bit beyond the purely introductory level, but it does provide practical guidance on doing certain calculations which is missing from a lot of other books.


Question:
What is more acidic:
$\ce{D3O+}$ in $\ce{D2O}$
or
$\ce{H3O+}$ in $\ce{H2O}$
and why?
I think it's $\ce{D3O+}$ in $\ce{D2O}$ as I saw somewhere that this property is used in mechanistic studies (the inverse isotope effect), but I need a proper explanation.
EDIT: I found a statement about this in Clayden:  Water $\ce{H2O}$ is a better solvating agent for $\ce{H_3O^+}$ than $\ce{D2O}$ is for $\ce{D_3O^+}$ because O–H bonds are longer than O–D bonds hence $\ce{D_3O^+}$ in $\ce{D2O}$ is stronger than $\ce{H_3O^+}$ in $\ce{H2O}$. That is the origin of the inverse solvent isotope effect.
This is in contrast with all the answers given yet, so I am pretty confused.

For the reasons explained in New point of view on the meaning and on the values of $K_\mathrm{a}(\ce{H3O+, H2O})$ and $K_\mathrm{b}(\ce{H2O, OH-})$ pairs in water Analyst, February 1998, Vol. 123 (409–410), the $\mathrm{p}K_\mathrm{a}$ of $\ce{H3O+}$ in $\ce{H2O}$ and the $\mathrm{p}K_\mathrm{a}$ of $\ce{D3O+, D2O}$ are undefined.
The entire point of the above reference is that
$\ce{H3O+ + H2O <=> H2O + H3O+}$
(which would correspond to an equilibrium constant of 1) is not a genuine thermodynamic process because the products and reactants are the same.
$\ce{D3O+ + D2O <=> D2O + D3O+}$
would also correspond to an equilibrium constant of 1
So when Clayden and the OP write

$\ce{D3O+}$ in $\ce{D2O}$ is stronger than $\ce{H3O+}$ in $\ce{H2O}$

it is wrong for the above reason.
Two genuine thermodynamic equilibriums are
$\ce{2H2O <=> H3O+ + HO-}$ and $\ce{2D2O <=> D3O+ + DO-}$
Experimentally, the self-dissociation constants of $\ce{H2O}$ to $\ce{H3O+}$ and $\ce{OH-}$ and $\ce{D2O}$ to $\ce{D3O+}$ and $\ce{OD-}$ can be measured as in The Ionization Constant of Deuterium Oxide from 5 to 50 [degrees] J. Phys. Chem., 1966, 70, pp 3820–3824 and it is found that $\ce{H2O}$ is about 8 times more dissociated (equilibrium constant is 8 times greater).
But using the above data to say $\ce{D3O+}$ is stronger is misleading, because this corresponds to a reaction with $\ce{OD-}$, not $\ce{D2O}$.  $\ce{D3O+}$ simply has a lower concentration in heavy water than $\ce{H3O+}$ has in light water.
As for why the $\ce{D2O}$ is less dissociated than $\ce{H2O}$, The ionization constant of heavy water ($\ce{D2O}$) in the temperature range 298 to 523 K Canadian Journal of Chemistry, 1976, 54(22): 3553-3558 breaks the differences down in to enthalpy and entropy components, which both favor ionization of $\ce{H2O}$ and states that $\ce{D2O}$ is a more structured liquid than $\ce{H2O}$. Not only the bonds of each product and reactant molecule need to be considered, but also the intermolecular forces: the number and strength of intermolecular hydrogen bonds for each species.  See Quantum Differences between Heavy and Light Water Physical Review Letters 101, 065502 for recent (2008) experimental data.
Numerous references characterized $\ce{D2O}$ as "more structured" than $\ce{H2O}$, meaning more hydrogen bonds, and a more narrow distribution of hydrogen bond lengths and angles.  According to Effect of Ions on the Structure of Water: Structure Making and Breaking Chem. Rev. 2009, 109, 1346–1370 "It is indeed generally agreed that heavy water, $\ce{D2O}$, is more strongly hydrogen bonded (structured) than light water, $\ce{H2O}$."  My explanation would therefore be that there is a greater penalty for placing ions in $\ce{D2O}$ than $\ce{H2O}$ as far as disruption of a hydrogen bonding network.
Also the equilibrium constant for
$\ce{H2O + H2DO+ <=> HDO + H3O+}$
can be measured and it is 0.96 according to Isotopic Fractionation of Hydrogen between Water and the Aqueous Hydrogen Ion J. Phys. Chem., 1964, 68 (4), pp 744–751

Explanation of Normal/Inverse Solvent Isotope Effect
For a kinetic normal/inverse solvent isotope effect
there will be a reactant and transition state.  If (for example) there is a single solvent exchangeable proton that is the same group in the reactant and transition state, for example, $\ce{ROH}$ in the reactant and $\ce{R'OH}$ in the transition state, switching solvents from $\ce{H2O}$ to $\ce{D2O}$ will either favor the reactant or the transition state relative to each other (considering the respective $\ce{OH}$ bond strengths as well and intermolecular hydrogen bonds to solvent). IF $\ce{D2O}$ favors the reactant relative to the transition state (activation energy is increased), this is a "normal kinetic solvent isotope effect".  Oppositely, if $\ce{D2O}$ favors the transition state relative to the reactant this is an "inverse kinetic solvent isotope effect." More complex scenarios involving more exchangeable sites can of course occur.
Similarly there can be equilibrium normal/inverse solvent isotope effect, if there is an equilibrium reaction and then it is reactant vs. product (rather than reactant vs. transition state) that matters.


Question: Can someone point me to a paper, or show here, why symmetric matrices have orthogonal eigenvectors? In particular, I'd like to see proof that for a symmetric matrix $A$ there exists decomposition $A = Q\Lambda Q^{-1} = Q\Lambda Q^{T}$ where $\Lambda$ is diagonal.

For any real matrix $A$ and any vectors $\mathbf{x}$ and $\mathbf{y}$, we have
$$\langle A\mathbf{x},\mathbf{y}\rangle = \langle\mathbf{x},A^T\mathbf{y}\rangle.$$
Now assume that $A$ is symmetric, and $\mathbf{x}$ and $\mathbf{y}$ are eigenvectors of $A$ corresponding to distinct eigenvalues $\lambda$ and $\mu$. Then
$$\lambda\langle\mathbf{x},\mathbf{y}\rangle = \langle\lambda\mathbf{x},\mathbf{y}\rangle = \langle A\mathbf{x},\mathbf{y}\rangle = \langle\mathbf{x},A^T\mathbf{y}\rangle = \langle\mathbf{x},A\mathbf{y}\rangle = \langle\mathbf{x},\mu\mathbf{y}\rangle = \mu\langle\mathbf{x},\mathbf{y}\rangle.$$
Therefore, $(\lambda-\mu)\langle\mathbf{x},\mathbf{y}\rangle = 0$. Since $\lambda-\mu\neq 0$, then $\langle\mathbf{x},\mathbf{y}\rangle = 0$, i.e., $\mathbf{x}\perp\mathbf{y}$.
Now find an orthonormal basis for each eigenspace; since the eigenspaces are mutually orthogonal, these vectors together give an orthonormal subset of $\mathbb{R}^n$. Finally, since symmetric matrices are diagonalizable, this set will be a basis (just count dimensions). The result you want now follows.


Question:
I recently used bootstrapping to estimate confidence intervals for a project. Someone who doesn't know much about statistics recently asked me to explain why bootstrapping works, i.e., why is it that resampling the same sample over and over gives good results. I realized that although I'd spent a lot of time understanding how to use it, I don't really understand why bootstrapping works.
Specifically: if we are resampling from our sample, how is it that we are learning something about the population rather than only about the sample? There seems to be a leap there which is somewhat counter-intuitive.
I have found a few answers to this question here which I half-understand. Particularly this one. I am a "consumer" of statistics, not a statistician, and I work with people who know much less about statistics than I do. So, can someone explain, with a minimum of references to theorems, etc., the basic reasoning behind the bootstrap? That is, if you had to explain it to your neighbor, what would you say?

fwiw the medium length version I usually give goes like this:
You want to ask a question of a population but you can't.  So you take a sample and ask the question of it instead.  Now, how confident you should be that the sample answer is close to the population answer obviously depends on the structure of population.  One way you might learn about this is to take samples from the population again and again, ask them the question, and see how variable the sample answers tended to be.  Since this isn't possible you can either make some assumptions about the shape of the population, or you can use the information in the sample you actually have to learn about it.
Imagine you decide to make assumptions, e.g. that it is Normal, or Bernoulli or some other convenient fiction.  Following the previous strategy you could again learn about how much the answer to your question when asked of a sample might vary depending on which particular sample you happened to get by repeatedly generating samples of the same size as the one you have and asking them the same question.  That would be straightforward to the extent that you chose computationally convenient assumptions.  (Indeed particularly convenient assumptions plus non-trivial math may allow you to bypass the sampling part altogether, but we will deliberately ignore that here.)
This seems like a good idea provided you are happy to make the assumptions.  Imagine you are not.  An alternative is to take the sample you have and sample from it instead.  You can do this because the sample you have is also a population, just a very small discrete one; it looks like the histogram of your data.  Sampling 'with replacement' is just a convenient way to treat the sample like it's a population and to sample from it in a way that reflects its shape.
This is a reasonable thing to do because not only is the sample you have the best, indeed the only information you have about what the population actually looks like, but also because most samples will, if they're randomly chosen, look quite like the population they came from.  Consequently it is likely that yours does too.
For intuition it is important to think about how you could learn about variability by aggregating sampled information that is generated in various ways and on various assumptions.  Completely ignoring the possibility of closed form mathematical solutions is important to get clear about this.


Question: I'm confused about the difference between genome and DNA. Is it correct to say that the same type of bacteria has the same DNA? But my understanding is that it is not correct to say that the same type of human has the same DNA, since every human has a different DNA. What am I missing here?

All humans have some differences in their DNA, but there's far more that is shared. On average the difference between humans is only about one thousandth of their full DNA, which means we're about 99.9% the same. These differences aren't distributed fully randomly, but are often because of specific gene alternatives. (Random mutations do occur, but they are also often fatal, so the random mutations we see of living adults are much more restrictive than all the random mutations that occur.)
To identify the human genome is to study many people's DNA and to label the parts that are shared between everyone, the parts with two or three variations, and the parts with even more variations. Even though every person has different DNA, we can still say they fit the pattern, just like every T-shirt may be unique but they all fit the T-shirt pattern and not the trousers pattern.


Question:
This is based on a question from betsy.s.collins on BioStars. The original post can be found here.

Does anyone have any suggestions for other tags or filtering steps on BWA-generated BAM files that can be used so reads only map to one location? One example application would be to find seeds for the TULIP assembler/scaffolder, which works best for reads that map to unique genomic locations.

The questioner is referring to genomically-unique alignments, which are something different from multiple possible alignments at a single location. If the only multiple alignment is at the same genomic location, those alignments are still unique in the genomic sense. The impossibility of finding the exact, correct, alignment is a well-known problem, and there are a few downstream methods (e.g. left normalisation) to make sure that multiple local alignments and/or sequencing errors have reduced impact.
The concept of "uniquely mapped reads" is a loaded term, and most sources suggest filtering by MAPQ should do the trick. However, this approach doesn't seem to work when using BWA as a read mapper.
Uniquely mapped reads (i.e. a read that maps to a single location in the genome) are sometimes preferred when running analyses that depend on the quantification of reads, rather than just the coverage (e.g. RNASeq). Duplicated reads require additional filtering or normalisation on the analysis side, and most downstream programs won't consider concepts like "a fifth of the read maps somewhere here on chromosome 5, and four-fifths of the read maps somewhere here on chromosome 14."

Update - as of January 2021, samtools can now do filtering based on an expression that includes tag variables. In this case, this expression can be used to exclude any reads that have either an XA or SA tag:
samtools view -b mapped.bam -e '!([XA] | [SA])' > unique_mapped.bam

For more details on the samtools expression parameter, see the samtools documentation:

Original answer follows....
To exclude all possible multi-mapped reads from a BWA-mapped BAM file, it looks like you need to use grep on the uncompressed SAM fields:
samtools view -h mapped.bam | grep -v -e 'XA:Z:' -e 'SA:Z:' | samtools view -b > unique_mapped.bam

Explanation follows...
I'm going to assume a situation in which a bioinformatician is presented with a mapped BAM file produced by BWA, and has no way of getting the original reads. One high-effort solution would be to extract the mapped reads from the BAM file and re-map with a different mapper that uses the MAPQ score to indicate multiple mappings.
... but what if that were not possible?
My understanding of BWA's output is that if a read maps perfectly to multiple genomic locations, it will be given a high mapping quality (MAPQ) score for both locations. Many people expect that a read that maps to at least two locations can have (at best) a 50% probability of mapping to one of those locations (i.e. MAPQ = 3). Because BWA doesn't do this, it makes it difficult to filter out multiply-mapped reads from BWA results using the MAPQ filter that works for other aligners; this is likely to be why the current answer on Biostars [samtools view -bq 1] probably won't work.
Here is an example line from a BWA mem alignment that I've just made. These are Illumina reads mapped to a parasite genome that has a lot of repetitive sequence:
ERR063640.7     16      tig00019544     79974   21      21M2I56M1I20M   *       0       0       TATCACATATCATCCGACTCAGCTCGACGAGTACAATGCTAATTTAACACTTAGAATGCCCGGCAATGAAATTCGTTTTCCGTCAATTCTTGAAAATTTC    <AABBEGABFJKKKIM7GHKKJK>JLKLDGMHLIMIHHCGIJKKLJKLNJGLLLKLILKLMFNDLKGHJEKMKKMIJHGLOJLLLKIJLKKJEJLIGG>D    NM:i:4  MD:Z:83A13      AS:i:77 XS:i:67 XA:Z:tig00019544,-78808,21M2I56M1I20M,6;tig00019544,-84624,79M1I20M,6;tig00019544,-79312,33M4I42M1I20M,8;

BWA mem has found that this particular read, ERR063460.7, maps to at least three different locations: tig00019544, tig00019544, and tig00019544. Note that the MAPQ for this read is 21, so even though the read maps to multiple locations, MAPQ can't be used to determine that.
However, the alternative locations are shown by the presence of the XA tag in the custom fields section of the SAM output. Perhaps just filtering on lines that contain the XA tag will be able to exclude multiply-mapped reads. The samtools view man page suggests that -x will filter out a particular tag:
$ samtools view -x XA output.bam | grep '^ERR063640\.7[[:space:]]'
ERR063640.7 16  tig00019544 79974   21  21M2I56M1I20M   *   0   0   TATCACATATCATCCGACTCAGCTCGACGAGTACAATGCTAATTTAACACTTAGAATGCCCGGCAATGAAATTCGTTTTCCGTCAATTCTTGAAAATTTC    <AABBEGABFJKKKIM7GHKKJK>JLKLDGMHLIMIHHCGIJKKLJKLNJGLLLKLILKLMFNDLKGHJEKMKKMIJHGLOJLLLKIJLKKJEJLIGG>D    NM:i:4  MD:Z:83A13  AS:i:77 XS:i:67

... so it filtered out the tag (i.e. the tag no longer exists in the SAM output), but not the read. There are no useful bits in the FLAG field to indicate multiple genomic mappings (which I know can be filtered to exclude the read as well), so I have to resort to other measures.
In this particular case, I can use grep -v on the uncompressed SAM output to exclude alignment lines that have the XA tag (and re-compress to BAM afterwards, just to be tidy):
$ samtools view -h output.bam | grep -v 'XA:Z:' | samtools view -b > output_filtered.bam
$ samtools view output_filtered.bam | grep '^ERR063640\.7[[:space:]]'
<no output>

Hurray! reads filtered. As a little aside, this grep search has a fairly substantial computational load: it's looking for some string with the text XA:Z: somewhere in the line, and doesn't actually capture every situation. Some masochistic person might come along at a later date and decide that they're going to call all their reads HAXXA:Z:AWESOME!:<readNumber>, in which case a tweak to this grep search would be needed to make sure that there's a space (or more specifically a tab character) prior to the XA:Z:.
Now I do a check for any duplicated read names, just to be sure:
$ samtools view output_filtered.bam | awk '{print $1}' | sort | uniq -d
ERR063640.1194
ERR063640.1429
ERR063640.1761
ERR063640.2336
ERR063640.2825
ERR063640.3458
ERR063640.4421
ERR063640.4474
ERR063640.4888
ERR063640.49
ERR063640.4974
ERR063640.5070
ERR063640.5130
ERR063640.5300
ERR063640.5868
ERR063640.6116
ERR063640.6198
ERR063640.6468
ERR063640.6717
ERR063640.6797
ERR063640.7322
ERR063640.750
ERR063640.7570
ERR063640.7900
ERR063640.8115
ERR063640.8405
ERR063640.911
ERR063640.9206
ERR063640.9765
ERR063640.9986

Oh... damn. I wonder what they are:
$ samtools view output_filtered.bam | grep '^ERR063640.3458[[:space:]]'
ERR063640.3458  16  tig00002961 5402    60  58S38M  *   0   0   AGGTACCATTCGATAGAGGGAGAAAGGCACTACTAAAGATTTTGCCACATTTGCTATATCCGTATCGCGAAGATCAGGACTTACTCCGCAGAAGAA    DD6HFFJBKFH=KDILKLGLJEKLKGFJIH8IKHLLMJEK:L:HBGJIHJKFLLKIHJDHLNKCK;KMKGMFKJILIIIMKI9JLKKHEJFII?CC    NM:i:0  MD:Z:38 AS:i:38 XS:i:0  SA:Z:tig00002377,202353,-,14M3I5M1I35M38S,19,5;
ERR063640.3458  2064    tig00002377 202353  19  14M3I5M1I35M38H *   0   0   AGGTACCATTCGATAGAGGGAGAAAGGCACTACTAAAGATTTTGCCACATTTGCTATA  DD6HFFJBKFH=KDILKLGLJEKLKGFJIH8IKHLLMJEK:L:HBGJIHJKFLLKIHJ  NM:i:5  MD:Z:5G48   AS:i:35 XS:i:27 SA:Z:tig00002961,5402,-,58S38M,60,0;

Aha! Supplemental alignments, which use the official SA tag [other canonical alignments in a chimeric alignment]. These appear to be situations where a single read has been split up, and maps to multiple locations. Note that in this case, both of the alignments still have MAPQ scores of over 3. It sounds like the questioner would also want to get rid of these situations as well. This time, there are standard flag fields as well to deal with these situations (0x800: secondary alignment). Except it's not enough to just filter the supplemental alignment, because both read mappings should be removed, rather than just the one (or ones) that happened to be tagged as secondary.
Luckily, BWA appears to put the SA tag into all reads containing supplementary alignments (if this is not the case, I'm sure someone will correct me on that). So, I add in the SA search as an additional grep filter:
$ samtools view -h output.bam | grep -v -e 'XA:Z:' -e 'SA:Z:' | samtools view -b > output_filtered.bam
$ samtools view output_filtered.bam | awk '{print $1}' | sort | uniq -d
<no output>

Done. Easy peasy! </sarcasm>
... that original "high-effort" solution of using a different aligner doesn't look so bad now.


Question:
I have been working on the topic of camera pose estimation for augmented reality and visual tracking applications for a while and I think that although there is a lot of detailed information on the task, there are still a lot of confussions and missunderstandings.
I think next questions deserve a detailed step by step answer.

What are camera intrinsics?
What are camera extrinsics?
How do I compute homography from a planar marker?
If I have homography how can I get the camera pose?

It is important to understand that the only problem here is to obtain the extrinsic parameters. Camera intrinsics can be measured off-line and there are lots of applications for that purpose.
What are camera intrinsics?
Camera intrinsic parameters is usually called the camera calibration matrix, $K$. We can write
$$K = \begin{bmatrix}\alpha_u&s&u_0\\0&\alpha_v&v_0\\0&0&1\end{bmatrix}$$
where

$\alpha_u$ and $\alpha_v$  are the scale factor in the $u$ and $v$ coordinate directions, and are proportional to the focal length $f$ of the camera: $\alpha_u = k_u f$ and $\alpha_v = k_v f$. $k_u$ and $k_v$ are the number of pixels per unit distance in $u$ and $v$ directions.

$c=[u_0,v_0]^T$ is called the principal point, usually the coordinates of the image center.

$s$ is the skew, only non-zero if $u$ and $v$ are non-perpendicular.

A camera is calibrated when intrinsics are known. This can be done easily so it is not consider a goal in computer-vision, but an off-line trivial step.

Some links:
ftp://svr-ftp.eng.cam.ac.uk/pub/reports/mendonca_self-calibration.pdf

What are camera extrinsics?
Camera extrinsics or External Parameters $[R|t]$ is a $3\times4$ matrix  that corresponds to the euclidean transformation from a world coordinate system to the camera coordinate system. $R$  represents a $3\times3$ rotation matrix and $t$ a translation.
Computer-vision applications focus on estimating this matrix.
$$[R|t] = \begin{bmatrix} R_{11}&R_{12}&R_{13}&T_x\\R_{21}&R_{22}&R_{23}&T_y\\R_{31}&R_{32}&R_{33}&T_z \end{bmatrix}$$
How do I compute homography from a planar marker?
Homography is an homogeneaous $3\times3$ matrix that relates a 3D plane and its image projection. If we have a plane $Z=0$ the homography $H$ that maps a point $M=(X,Y,0)^T$ on to this plane and its corresponding 2D point $m$ under the projection $P=K[R|t]$ is
$$\tilde m = K \begin{bmatrix} R^1 & R^2 & R^3 & t \end{bmatrix} \begin{bmatrix} X \\ Y \\ 0 \\ 1 \end{bmatrix}$$
$$= K \begin{bmatrix}R^1&R^2&t\end{bmatrix} \begin{bmatrix} X \\ Y \\ 1 \end{bmatrix}$$
$$H = K \begin{bmatrix}R^1 & R^2 & t \end{bmatrix}$$
In order to compute homography we need point pairs world-camera. If we have a planar marker, we can process an image of it to extract features and then detect those features in the scene to obtain matches.
We just need 4 pairs to compute homography using Direct Linear Transform.
If I have homography how can I get the camera pose?
The homography $H$ and the camera pose $K[R|t]$ contain the same information and it is easy to pass from one to another. The last column of both is the translation vector. Column one $H^1$ and two $H^2$ of homography are also column one $R^1$ and two $R^2$ of camera pose matrix. It is only left column three $R^3$ of $[R|t]$, and as it has to be orthogonal it can be computed as the crossproduct of columns one and two:
$$R^3 = R^1 \otimes R^2$$
Due to redundancy it is necessary to normalize $[R|t]$ dividing by, for example, element [3,4] of the matrix.


Question:
I have been fascinated by the Collatz problem since I first heard about it in high school.

Take any natural number $n$. If $n$ is even, divide it by $2$ to get $n / 2$, if $n$ is odd multiply it by $3$ and add $1$ to obtain $3n + 1$. Repeat the process indefinitely. The conjecture is that no matter what number you start with, you will always eventually reach $1$. [...]
Paul Erdős said about the Collatz conjecture: "Mathematics is not yet ready for such problems." He offered $500 USD for its solution.

QUESTIONS:
How important do you consider the answer to this question to be? Why?
Would you speculate on what might have possessed Paul Erdős to make such an offer?
EDIT: Is there any reason to think that a proof of the Collatz Conjecture would be complex (like the FLT) rather than simple (like PRIMES is in P)?  And can this characterization of FLT vs. PRIMES is in P be made more specific than a bit-length comparison?

Most of the answers so far have been along the general lines of 'Why hard problems are important', rather than 'Why the Collatz conjecture is important'; I will try to address the latter.
I think the basic question being touched on is:

In what ways does the prime factorization of $a$ affect the prime factorization of $a+1$?

Of course, one can always multiply out the prime factorization, add one, and then factor again, but this throws away the information of the prime factorization of $a$.  Note that this question is also meaningful in other UFDs, like $\mathbb{C}[x]$.
It seems very hard to come up with answers to this question that don't fall under the heading of 'immediate', such as distinct primes in each factorization.  This seems to be in part because a small change in the prime factorization for $a$ (multiplication by a prime, say) can have a huge change in the prime factorization for $a+1$ (totally distinct prime support perhaps).  Therefore, it is tempting to regard the act of adding 1 as an essentially-random shuffling of the prime factorization.
The most striking thing about the Collatz conjecture is that it seems to be making a deep statement about a subtle relation between the prime factorizations of $a$ and $a+1$.  Note that the Collatz iteration consists of three steps; two of which are 'small' in terms of the prime factorization, and the other of which is adding one:

multiplying by 3 has a small effect on the factorization.
adding 1 has a (possibly) huge effect on the factorization.
factoring out a power of 2 has a small effect on the factorization (in that it doesn't change the other prime powers in the factorization).

So, the Collatz conjecture seems to say that there is some sort of abstract quantity like 'energy' which cannot be arbitrarily increased by adding 1.  That is, no matter where you start, and no matter where this weird prime-shuffling action of adding 1 takes you, eventually the act of pulling out 2s takes enough energy out of the system so that you reach 1.  I think it is for reasons like this that mathematicians suspect that a solution of the Collatz conjecture will open new horizons and develop new and important techniques in number theory.


Question:
My teacher didn't answer this properly:

Is toothpaste solid or liquid?

You can't say toothpaste is a solid because solid material have a fixed shape but toothpaste doesn't. However, you can't say it's a liquid because liquids flow easily but toothpaste needs a certain force to push it out of the tube. So is it a solid or liquid? And are there any other example just like toothpaste?

Toothpaste is what is called a non-newtonian fluid, more specifically toothpaste is a Bingham plastic.  This means that the viscosity of the fluid is linearly dependent on the shear stress, but with an offset called the yield stress (see figure below). This yield stress is what makes it hard to say whether it is liquid or solid. The fact that toothpaste is viscous alone is not sufficient to explain this, because water is also viscous, but doesn't behave like a solid (unless frozen, but that's another phenomenon).

What the yield stress does is the following. Below a certain shear threshold the fluid responds as if it were a solid, as you can see happening when you have put toothpaste on your toothbrush, it just sits there without flowing away. A highly viscous but newtonian fluid would flow away (although slowly as pointed out by @ron in his comment to the answer of @freddy).
Now if you put sufficient shear stress on the toothpaste, when you squeeze the tube of paste, it will start flowing and respond as a liquid.
Other examples, as mentioned in the Wikipedia link in my first sentence, are e.g. mayonnaise and mustard. Another example is silly putty.


Question:
Assume the following first order IIR Filter:
$$ y[n] = \alpha x[n] + (1 - \alpha) y[n - 1] $$
How can I choose the parameter $ \alpha $ s.t. the IIR approximates as good as possible the FIR which is the arithmetic mean of the last $ k $ samples:
$$ z[n] = \frac{1}{k}x[n] + \frac{1}{k}x[n-1] + \ldots + \frac{1}{k}x[n-k+1] $$
Where $ n \in [k, \infty) $, meaning the input for the IIR might be longer than $ k $ and yet I'd like to have the best approximation of the mean of last $ k $ inputs.
I know the IIR has infinite impulse response, hence I'm looking for the best approximation.
I'd be happy for analytic solution whether it is for $ {L}_{2} $ or $ {L}_{1} $ cost function.
How could this optimization problems can be solved given only 1st order IIR.
Thanks.

OK, let's try to derive the best:
$$
\begin{array}{lcl}
y[n] &=& \alpha x[n] + (1 - \alpha) y[n - 1] \\
&=&  \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 y[n - 2]\\
&=&  \alpha x[n] + (1 - \alpha) \alpha x[n-1] + (1 - \alpha)^2 \alpha x[n-2] + (1 - \alpha)^3 y[n - 3]\\
\end{array}
$$
so that the coefficient of $x[n-m]$ is $\alpha(1-\alpha)^m$.
The best mean-square approximation will minimize:
$$
\begin{array}{lcl}
J(\alpha) &=& \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2 + \sum_{m=k}^\infty \alpha^2(1-\alpha)^{2m}\\
&=& \sum_{m=0}^{k-1} \left(\alpha^2(1-\alpha)^{2m} - \frac{2}{k}\alpha(1-\alpha)^m + \frac{1}{k^2}\right) + \alpha^2 (1-\alpha)^{2k} \sum_{m=0}^\infty (1-\alpha)^{2m} \\
&=& \alpha^2\frac{1- (1-\alpha)^{2k}}{1 - (1-\alpha)^2} + \frac{2\alpha}{k} \frac{1 - (1 - \alpha)^k}{1 - (1 - \alpha)} + \frac{\alpha^2(1-\alpha)^{2k}}{1 - (1 - \alpha)^2}+ \frac{1}{k}\\
&=& \frac{\alpha^2}{1 - (1 - \alpha)^2} + \frac{2}{k} (1-(1-\alpha)^k) + \frac{1}{k}\\
&=& \frac{\alpha^2}{2\alpha - \alpha^2 }+ \frac{2}{k} (1-(1-\alpha)^k)+ \frac{1}{k}\\
&=& \frac{\alpha}{2 - \alpha }+ \frac{2}{k} (1-(1-\alpha)^k)+ \frac{1}{k}\\
\end{array}
$$
because the FIR coefficients are zero for $m > k - 1$.
Next step is to take derivatives and equate to zero.

Looking at a plot of the derived $J$ for $K = 1000$ and $\alpha$ from 0 to 1, it looks like the problem (as I've set it up) is ill-posed, because the best answer is $\alpha = 0$.

I think there's a mistake here.
The way it should be according to my calculations is:
$$
\begin{array}{lcl}
J(\alpha) &=& \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2 + \sum_{m=k}^\infty \alpha^2(1-\alpha)^{2m} \\
&=& \sum_{m=0}^{k-1} \left(\alpha^2(1-\alpha)^{2m} - \frac{2}{k}\alpha(1-\alpha)^m + \frac{1}{k^2}\right) + \alpha^2 (1-\alpha)^{2k} \sum_{m=0}^\infty (1-\alpha)^{2m} \\
&=& \alpha^2\frac{1- (1-\alpha)^{2k}}{1 - (1-\alpha)^2} - \frac{2\alpha}{k} \frac{1 - (1 - \alpha)^k}{1 - (1 - \alpha)} + \frac{1}{k} + \frac{\alpha^2(1-\alpha)^{2k}}{1 - (1 - \alpha)^2}
\end{array}
$$
Simplifying it according to Mathematica yields:
$$ J(\alpha) = \frac{\alpha}{2 - \alpha} + \frac{2 {(1 - \alpha)}^{k} -1}{k} $$
Using the following code on MATLAB yields something equivalent though different:
syms a k;

expr1 = (a ^ 2) * ((1 - ((1 - a) ^ (2 * k))) / (1 - ((1 - a) ^ 2)));
expr2 = ((2 * a) / k) * ((1 - ((1 - a) ^ (k))) / (1 - (1 - a)));
expr3 = (1 / k);
expr4 = ((a ^ 2) * ((1 - a) ^ (2 * k))) / (1 - ((1 - a) ^ (2)));

simpExpr = simplify(expr1 - expr2 + expr3 + expr4);

$$ J(\alpha) = \frac{-2}{\alpha - 2} - \frac{k - 2{(1 - \alpha)}^{k} + 1}{k} $$
Anyhow, those functions do have minimum.

So let's assume that we really only care about the approximation over the support (length) of the FIR filter. In that case, the optimization problem is just:
$$
J_2(\alpha) = \sum_{m=0}^{k-1} (\alpha(1-\alpha)^m - \frac{1}{k})^2
$$
Plotting $J_2(\alpha)$ for various values of $K$ versus $\alpha$ results in the date in the plots and table below.

For $K$ = 8.     $\alpha_{\tt min}$ = 0.1533333
     For $K$ = 16.    $\alpha_{\tt min}$ = 0.08
     For $K$ = 24.    $\alpha_{\tt min}$ = 0.0533333
     For $K$ = 32.    $\alpha_{\tt min}$ = 0.04
     For $K$ = 40.    $\alpha_{\tt min}$ = 0.0333333
     For $K$ = 48.    $\alpha_{\tt min}$ = 0.0266667
     For $K$ = 56.    $\alpha_{\tt min}$ = 0.0233333
     For $K$ = 64.    $\alpha_{\tt min}$ = 0.02
     For $K$ = 72.    $\alpha_{\tt min}$ = 0.0166667

The red dashed lines are $1/K$ and the green lines are $\alpha_{\tt min}$, the value of $\alpha$ that minimizes $J_2(\alpha)$ (chosen from $\tt alpha = [0:.01:1]/3;$).


Question:
I'm looking at the melting temperature of metallic elements, and notice that the metals with high melting temperature are all grouped in some lower-left corner of the $\mathrm{d}$-block. If I take for example the periodic table with physical state indicated at $\pu{2165 K}$:

I see that (apart from boron and carbon) the only elements still solid at that temperature form a rather well-defined block around tungsten (which melts at $\pu{3695 K}$). So what makes this group of metals melt at such high temperature?

Some factors were hinted, but let me put them in an order of importance and mention some more:

metals generally have a high melting point, because metallic interatomic bonding by delocalized electrons ($\ce{Li}$ having only a few electrons for this "electron sea") between core atoms is pretty effective in those pure element solids compared to alternative bonding types (ionic $\pu{6-20 eV/atom}$ bond energy, covalent 1-7, metallic 1-5, van-der-Waals much lower). Also, ionic lattices like $\ce{NaCl}$ have a higher lattice and bonding energy, they have weak interatomic long-range bonding, unlike most metals. They break apart or are easily solvable, metals are malleable but don't break, the electron sea is the reason for their welding ability.
the crystal structure and mass play an inferior role among your filtered elements (just look up the crystal structure of those elements), as metallic bonding is not directional unlike covalent bonding (orbital symmetry). Metals often have half filled $\mathrm{s}$ and $\mathrm{p}$ bands (stronger delocalized than $\mathrm{d}$ and $\mathrm{f}$) at the Fermi-edge (meaning high conductivity) and therefore many delocalised electrons which can move into unoccupied energy states yielding the biggest electron sea with half or less fill bands.
noble metals like $\ce{Au,Ag}$ have a full $\mathrm{d}$ orbital, therefore low reactivity/electronegativity and are often used as contact materials (high conductivity because of "very fluid" electron sea consisting only of $\mathrm{s}$-orbital electrons. Unlike tungsten with half or less occupied $\mathrm{d}$-orbitals they show no interatomic $\mathrm{d-d}$ bonding by delocalized $\mathrm{d}$-electrons, and more importantly, a half filled $\mathrm{d}$-orbital contributes 5 electrons to the energy band, while a $\mathrm{s}$ only 1, $\mathrm{p}$ only 3, the electron sea is bigger among the $\mathrm{d}$-group.
The "packaging" of core atoms in the lattice (interatomic distance) among the high $Z$ atoms (compared to e.g. $\ce{Li}$) is denser (more protons, stronger attraction of shell electrons, smaller interatomic radius), means stronger interatomic bonding transmitted by the electron sea:

You can see here that in each series ($\ce{Li,\ Na,\ K}$) the melting points rise to a maximum and then decrease with increasing atomic number (lacking unoccupied energy states for delocalized $\mathrm{d}$-electrons), bigger electron sea being here a stronger factor than a bit more dense packaging.

Boron as a semi-metal shows metallic and covalent bonding, Carbon strong directional covalent bonding and is able to build a network of bonds unlike other non-metal elements showing covalent intramolecular bonding, e.g., in diatomic molecules but not strong intermolecular bonding in macromolecules because of lacking unpaired electrons.

So there are some bigger trends for melting points explaining the high melting points of $\mathrm{d}$-metals, but also some minor exceptions to the rule like $\ce{Mn}$.


Question:
I understand the formal differences between them, what I want to know is when it is more relevant to use one vs. the other.

Do they always provide complementary insight about the performance of a given classification/detection system?
When is it reasonable to provide them both, say, in a paper? instead of just one?
Are there any alternative (maybe more modern) descriptors that capture the relevant aspects of both ROC and precision recall for a classification system?

I am interested in arguments for both binary and multi-class (e.g. as one-vs-all) cases.

The key difference is that ROC curves will be the same no matter what the baseline probability is, but PR curves may be more useful in practice for needle-in-haystack type problems or problems where the "positive" class is more interesting than the negative class.
To show this, first let's start with a very nice way to define precision, recall and specificity.  Assume you have a "positive" class called 1 and a "negative" class called 0.  $\hat{Y}$ is your estimate of the true class label $Y$.  Then:
$$
\begin{aligned}
&\text{Precision} &= P(Y = 1 | \hat{Y} = 1)  \\
&\text{Recall} = \text{Sensitivity} &= P(\hat{Y} = 1 | Y = 1)  \\
&\text{Specificity} &= P(\hat{Y} = 0 | Y = 0)
\end{aligned}
$$
The key thing to note is that sensitivity/recall and specificity, which make up the ROC curve, are probabilities conditioned on the true class label.  Therefore, they will be the same regardless of what $P(Y = 1)$ is.  Precision is a probability conditioned on your estimate of the class label and will thus vary if you try your classifier in different populations with different baseline $P(Y = 1)$.  However, it may be more useful in practice if you only care about one population with known background probability and the "positive" class is much more interesting than the "negative" class.  (IIRC precision is popular in the document retrieval field, where this is the case.)  This is because it directly answers the question, "What is the probability that this is a real hit given my classifier says it is?".
Interestingly, by Bayes' theorem you can work out cases where specificity can be very high and precision very low simultaneously.  All you have to do is assume $P(Y = 1)$ is very close to zero.  In practice I've developed several classifiers with this performance characteristic when searching for needles in DNA sequence haystacks.
IMHO when writing a paper you should provide whichever curve answers the question you want answered (or whichever one is more favorable to your method, if you're cynical).  If your question is: "How meaningful is a positive result from my classifier given the baseline probabilities of my problem?", use a PR curve.  If your question is, "How well can this classifier be expected to perform in general, at a variety of different baseline probabilities?", go with a ROC curve.


Question: I was reading about the p-block elements and found that the inert pair effect is mentioned everywhere in this topic. However, the book does not explain it very well. So, what is the inert pair effect? Please give a full explanation (and an example would be great!).

The inert pair effect describes the preference of late p-block elements (elements of the 3rd to 6th main group, starting from the 4th period but getting really important for elements from the 6th period onward) to form ions whose oxidation state is 2 less than the group valency.
So much for the phenomenological part. But what's the reason for this preference? The 1s electrons of heavier elements have such high momenta that they move at speeds close to the speed of light which means relativistic corrections become important. This leads to an increase of the electron mass. Since it's known from the quantum mechanical calculations of the hydrogen atom that the electron mass is inversely proportional to the orbital radius, this results in a contraction of the 1s orbital. Now, this contraction of the 1s orbital leads to a decreased degree of shielding for the outer s electrons (the reason for this is a decreased "core repulsion" whose origin is explained in this answer of mine, see the part titled "Why do states with the same $n$ but lower $\ell$ values have lower energy eigenvalues?") which in turn leads to a cascade of contractions of those outer s orbitals. The result of this relativistic contraction of the s orbitals is that the valence s electrons behave less like valence electrons and more like core electrons, i.e. they are less likely to take part in chemical reactions and they are harder to remove via ionization, because the s orbitals' decreased size lessens the orbital overlap with potential reaction partners' orbitals and leads to a lower energy. So, while lighter p-block elements (like $\ce{Al}$) usually "give away" their s  and p electrons when they form chemical compounds, heavier p-block elements (like $\ce{Tl}$) tend to "give away" their p electrons but keep their s electrons. That's the reason why for example $\ce{Al(III)}$ is preferred over $\ce{Al(I)}$ but $\ce{Tl(I)}$ is preferred over $\ce{Tl(III)}$.


Question: It seems that nitrous oxide $(\ce{N2O})$ is frequently used to create whipped cream. But why can't just regular nitrogen gas $(\ce{N2})$ be used instead?

There are two ways to efficiently make an aerosol product:

Use a gas that liquifies under the pressure inside the can. For example, butane lighters. Nitrogen is one of the "fixed gases", meaning it's a gas under most conditions (but take a look at the temperatures and pressures needed for liquid nitrogen—it's not going to ever be found in consumer products).

or

Use a gas that is highly soluble in the liquid (carrier) and that will "substantially" vaporize when the higher pressure inside the can is reduced to atmospheric.

The US government restricts the pressures that can be used in aerosol cans (and requires 100% quality control testing—when's the last time you heard of an aerosol can exploding? [although it does happen]). If you cut up a can, you'll notice that it's pretty flimsy. The higher the pressure (and a gas that has been dissolved in a liquid doesn't exert much pressure), the more expensive it will be to build the container (aerosol can).
Thus, the fixed gases are almost never used, except in some medical products. Why? Because they just aren't soluble enough to help move the liquid (or, in other cases, solid) out of the can and also to disperse it into a very fine mist. The customer wants basically one thing when using an aerosol: uniform, consistent spray from first to last drop. Using a very soluble gas helps, and using one with a boiling point near room temperature also helps. But the laws of thermodynamics say that the temperature of the can will drop as you spray out its contents. This may dramatically interfere with the liquid-to-gas phase change, while solubility is less sensitive to temperature. The trick is to make a product (and I've made some) that sprays out consistently and also doesn't leave so much left behind in the can that the customer feels ripped off.


Question:
Recently, I am learning the production of soluble and insoluble salts. My friend and I have done this experiment at the school lab.
We wanted to taste them to see whether they are salty are not. The teacher luckily stopped us from doing that.
So without tasting them, I would really like to know whether all salts are salty.

No. There are sweet, bitter, and various other salts. (Likely, there are tasteless salts too). Pure salty taste is as far as I know exclusive for table salt, though I wouldn't bet on it.
Lead and Beryllium salts are said to be sweet, though toxic. Epsom salt, $\ce{MgSO4}$, is bitter. $\ce{CuSO4}$ has an incomprehensible, persistent metallic taste. (Based on personal experience. Copper salts are slightly toxic, but not extremely, so I survived with no consequences.)
Salts with hydrolysing cation (various alums) are acidic in addition to other notes.


Question:
With all the technology available today with being able to boost voltage efficiently using SMPS, why do we still use 9V batteries? Is there some secret advantage with them that I am unaware of?
If you look at the size as well, the 9V is just big and bulky and I have designed projects where I can use 2xAA batteries and boost the voltage, which will give me longer battery life than a 9V. And it takes up the same amount of space.
A lot of circuits today also need regulating, and the easiest way to do that with a 9V is a linear regulator (usually to about 5V) and I am aware this is not the case for every design, but that right there is energy wasted, and yet again, boosting the voltage from 1 or 2 AA batteries will probably give your product a better shelf life.
I saw a comparison between a 9V battery and some AA batteries, where someone found the energy available, and ended up with this data:
NOTE: These results were from Energizer Alkaline batteries. The page can be found HERE.
So with all this data, why are 9V batteries still used in designs? Are there some applications where it would be advantageous to use them? Or is it usually a better idea just to go for the AA or AAA solution?
There have been times where I have considered using a 9V battery for some of my projects but it always seems after doing my calculations, they just don't hold up as well as others, so am I missing something?
For reference, the datasheets for the compared batteries are here:
AA
9V
EDIT: I am not intending this to be an 'opinion-based' question, rather, I was intending to ask from a practical point of view, if there were advantages to choosing a 9V over any other solution (such as boosting AA batteries). Just wanted to make that clear!

A 400mAh 9V battery will last a year with a 40µA current draw.
Now consider a smoke detector. It is low power analog circuitry, most likely drawing less than the 40µA figure above. If you wanted to power it from a boost converter and AAs, then you'd need a converter with very low idle current.
But... when there is fire, now you need quite a bit of power, and enough volts, to drive the piezo loudspeaker. These need voltage. 9V is louder than 3V.
So your very low idle current DC-DC converter also needs to output high current if needed.
You also need to be able to measure state of charge accurately on the AAs.
All this will cost more than the difference between 9V and 2AA. And remember, the customer pays for the replacement batteries, not the manufacturer!


Question:
I had heard that tape is still the best medium for storing large amounts of data. So I figured I can store a relatively large amount of data on a cassette tape. I was thinking of a little project to read/write digital data on a cassette tape from my computer sound card just for the retro feeling. (And perhaps read/write that tape with an Arduino too).
But after reading up about it for a bit it turns out that they can store very small amounts of data. With baud rates varying between 300 to 2400 something between ~200KB to ~1.5MB can be stored on a 90 minute (2x45min) standard cassette tape.
Now I have a lot of problems with understanding why that is.
1- These guys can store 90 minutes of audio. Even if we assume the analog audio quality on them was equivalent of 32Kbps that's about 21MB of data. I have a hard time believing what I listened to was 300bps quality audio.
2- I read about the Kansas City standard and I can't understand why the maximum frequency they're using is 4800Hz yielding a 2400 baud. Tape (according to my internet search) can go up to 15KHz. Why not use 10KHz frequency and achieve higher bauds?
3- Why do all FSK modulations assign a frequency spacing equal to baud rate? In the Kansas example they are using 4800Hz and 2400Hz signals for '1' and '0' bits. In MFSK-16 spacing is equal to baud rate as well.
Why don't they use a MFSK system with a 256-element alphabet? With 20Hz space between each frequency the required bandwidth would be ~5KHZ. We have 10KHz in cassette tape so that should be plenty. Now even if all our symbols were the slowest one (5KHz) we would have 5*8 = 40000 baud. That's 27MB of data. Not too far from the 21MB estimation above.
4- If tape is so bad then how do they store Terabaytes on it?

I had heard that tape is still the best medium for storing large amounts of data.

well, "best" is always a reduction to a single set of optimization parameters (e.g. cost per bit, durability, ...) and isn't ever "universally true".
I can see, for example, that "large" is already a relative term, and for a small office, the optimum solution for backing up "large" amounts of data is a simple hard drive, or a hard drive array.
For a company, backup tapes might be better, depending on how often they need their data back. (Tapes are inherently pretty slow and can't be accessed at "random" points)

So I figured I can store a relatively large amount of data on a cassette tape.

Uh, you might be thinking of a Music Casette, right? Although that's magnetic tape, too, it's definitely not the same tape your first sentence referred to: It's meant to store an analog audio signal with low audible distortion for playback in a least-cost cassette player, not for digital data with low probability of bit error in a computer system.
Also, Music Cassettes are a technology from 1963 (small updates afterwards). Trying to use them for the amounts of data modern computers (even arduinos) deal with sounds like you're complaining your ox cart doesn't do 100 km/h on the autobahn.

But after reading up about it for a bit it turns out that they can store very small amounts of data. With baud rates varying between 300 to 2400 something between ~200KB to ~1.5MB can be stored on a 90 minute (2x45min) standard cassette tape.

Well, so that's a lot of data for when music-cassette-style things were last used with computers (the 1980s).
Also, where do these data rates drop from? That sounds like you're basing your analysis on 1980's technology.

These guys can store 90 minutes of audio. Even if we assume the analog audio quality on them was equivalent of 32Kbps that's about 21MB of data.

32 kb/s of what, exactly? If I play an Opus Voice, Opus Music or MPEG 4 AAC-HE file with a target bitrate of 32 kb/s next to the average audio cassette, I'm not sure the cassette will stand much of a chance, unless you want the "warm audio distortion" that casettes bring – but that's not anything you want to transport digital data.
You must be very careful here, because audio cassette formulations are optimized for specific audio properties. That means your "perceptive" quality has little to do with the "digital data capacity".

I have a hard time believing what I listened to was 300bps quality audio.

again, you're comparing apples to oranges.  Just because someone 40 to 50 years ago wrote a 300 bits per second modem that could reconstruct binary data from audio cassette-stored analog signals, doesn't mean 300 bps is the capacity of the music cassette channel.
That's like saying "my Yorkshire Terrier can run 12 km/h on this racetrack, therefore I can't believe you can't have Formula 1 cars doing 350 km/h on it".

I read about the Kansas City standard and I can't understand why the maximum frequency they're using is 4800Hz yielding a 2400 baud. Tape (according to my internet search) can go up to 15KHz. Why not use 10KHz frequency and achieve higher bauds?

Complexity, and low quality of implementation and tapes. I mean, you're literally trying to argue that what was possible in 1975 is representative for what is possible today. That's 45 years in the past, they didn't come anywhere near theoretical limits.

Why do all FSK modulations assign a frequency spacing equal to baud rate?

They don't. Some do. Most modern FSK modulations don't (they're minimum shift keying standards, instead, where you choose the spacing to be half the symbol rate).

In the Kansas example they are using 4800Hz and 2400Hz signals for '1' and '0' bits. In MFSK-16 spacing is equal to baud rate as well.

Again, 1975 != all things possible today.

Why don't they use a MFSK system with a 256-element alphabet? With 20Hz space between each frequency the required bandwidth would be ~5KHZ. We have 10KHz in cassette tape so that should be plenty. Now even if all our symbols were the slowest one (5KHz) we would have 5*8 = 40000 baud. That's 27MB of data. Not too far from the 21MB estimation above.

Well, it's not that simple, because your system isn't free from  noise and distortion, but as before:

Low cost.

They simply didn't.

If tape is so bad then how do they store Terabaytes on it?

You're comparing completely different types of tapes, and tape drives:
This 100€ LTO-8 data backup tape

vs this cassette tape type, of which child me remembers buying 5-packs at the supermarket for 9.99 DM, which, given retail overhead, probably means the individual cassette was in the < 1 DM range for business customers:

and this 2500€ tape drive stuffed with bleeding edge technology and a metric farkton of error-correction code and other fancy digital technology

vs this 9€ casette thing that is a 1990's least-cost design using components available since the 1970s, which is actually currently being cleared from Conrad's stock because it's so obsolete:

At the end of the 1980s, digital audio became the "obvious next thing", and that was the time the DAT cassette was born, optimized for digital audio storage:

These things, with pretty "old-schooley" technology (by 2020 standards) do 1.3 Gb/s when used as data cassettes (that technology was called DDS but soon parted from the audio recording standards). Anyway, that already totally breaks with the operating principles of the analog audio cassette as you're working with:

in the audio cassette, the read head is fixed, and thus, the bandwidth of the signal is naturally limited by the product of spatial resolution of the magnetic material and the head and the tape speed. There's electronic limits to the first factor, and very mechanical ones to the second (can't shoot a delicate tape at supersonic speeds through a machine standing in your living room that's still affordable, can you).
in DAT, the reading head is mounted on a rotating drum, mounted at a slant to the tape – that way, the speed of the head relative to the tape can be greatly increased, and thus, you get more data onto the same length of tape, at very moderate tape speeds (audio cassete: ~47 mm/s, DAT: ~9 mm/s)
DAT is a digital format by design. This means zero focus was put into making the amplitude response "sound nice despite all imperfections"; instead, extensive error correction was applied (if one is to believe this source, concatenated Reed-Solomon codes of an overall rate of 0.71) and 8b-10b line coding (incorporating further overhead, that should put us at an effective rate of 0.5).

Note how they do line coding on the medium: This is bits-to-tape, directly. Clearly, this leaves room for capacity increases, if one was to use the tape as the analog medium it actually is, and combined that ability with the density-enabling diagonal recording, to use the tape more like an analog noisy channel (and a slightly nonlinear at that) than a perfect 0/1 storage.
Then, you'd not need the 8b-10b line coding. Also, while re-designing the storage, you'd drop the concatenated RS channel code (that's an interesting choice, sadly I couldn't find anything on why they chose to concatenate two RS codes) and directly go for much larger codes – since a tape isn't random access, an LDPC code (a typically 10000s of bits large code) would probably be the modern choice. You'd incorporate neighbor-interference cancellation and pilots to track system changes during playback.
In essence, you'd build something that is closer to a modern hard drive on a different substrate than it would be to an audio cassette; and lo and behold, suddenly you have a very complex device that doesn't resemble your old-timey audio cassette player at all, but a the modern backup tape drive like I've linked to above.


Question: We all suffer from common cold, and that, frequently. Why have we not developed immunity against it till now? By immunity I mean immunity as a species.

Long lasting immunity is obtained by means of the adaptive immune system, and mainly involves the development of antibodies that identify specific parts (epitopes) of the pathogen's proteins. Common cold is typically caused by a type of virus called rhinovirus. Viruses have very high mutation rates, which alter the sequence of the virus proteins, modifying their antigenic properties. This consequently alters the ability of antibodies to recognize a particular antigen.
In other words, we do develop long lasting immunity against the virus that causes us a cold today, but the virus that causes us a cold a few months later is somewhat different, and the adaptive immune system has to start from scratch.


Question: I've read several websites about equipment covered with gold foil and astronaut helmet visors are coated with gold. However, their explanations are devoid of almost all physics content. Can someone explain the basic concept of why gold foil is so popular with NASA as a coating on visors?

In space, the sun transfers heat via radiation to equipment and astronauts. Although the sun’s peak emission is in the visible region (about 500 nm), you can see that there is also a fair amount of IR (infrared) and UV (ultraviolet) emitted as well at the top of the atmosphere.

To control the surface temperature of an object that is exposed to IR (heat waves), NASA wraps its equipment with a metallic reflector that reflects IR to keep it from getting “hot.” The common reflectors are aluminum, silver, copper, and gold. Below, the plot of reflectance vs. wavelength shows that all four metals are good IR-reflectors since the reflectance is close to 100% for wavelengths greater than 700 nm (λ ≥  700 nm).

So why use gold? It’s most likely the same reason why they use gold extensively in circuit boards. (i) Gold does not corrode or rust while silver and copper do, which would reduce reflectance (by the way this happens before takeoff) and (ii) it’s a lot easier to work with gold than aluminum.
The outer sun visor is made from polycarbonate plastic and coated with a thin layer of gold. This combination gives complete protection to the astronaut. Why? Your eyes can focus both visible and near IR light onto your retina equally well. Your eye has visible receptors but not IR ones. When intense visible light hits these receptors, the receptors transmit information letting you know that this is painful and will cause damage if you don’t either close them or look away. On the other hand, without IR receptors,  you wouldn’t realize that your eye was being “burned” with an intense IR source. Therefore, astronauts need IR protection from intense sunlight above the earth atmosphere. From the plot above, using a gold-coated visor reflects almost all IR, but gold will also transmit about 60% of visible as well as UV light for about λ ≤ 500 nm. According to the plot above, with the visor down you would see a blue-green hue to objects. On the other hand, about 60% of UV is transmitted through the gold, but a polycarbonate plastic visor has excellent visible transmittance but absorbs/reflects almost all UV as shown below.

PMMA (Polymethylmetacrylate, Lexan, Plexiglass..) and PC (Polycarbonate, the DVD material)


Question:
The main principle behind a vaccine is to take a deactivated virus, "show" it to the immune system so it can "learn" how it looks like, so if and when the real virus does attack us, our immune system is already prepared for it. Vaccines have been developed using this idea even in the 1880's.
If that's the case, why does it take so much time and effort to develop a vaccine, for example, against covid-19? (and why are there several variants with different measures of reliability?) Is it only about balancing how strongly we damage the original pathogen, too much damage and our body might not learn the correct identifiers, and to little damage and it might still be active enough to cause the disease?

Roni Saiba's answer does a good job of explaining what goes into current vaccine development and why it takes so much effort, but I want to directly address the question of why we can't just grow some virus, kill it with UV and have a protective vaccine.
The answer is that not all immune responses to viral antigens are helpful in fighting infections of that virus. In some cases it can be harmful; antibodies to dengue virus of one serotype will attach to viral particles of another serotype but aren't able to inactivate them. The attachment of antibodies to active viruses makes their absorption by cells more efficient, and infections where this antibody-dependent enhancement occurs are more severe than first-time dengue infections.
Some viruses have evolved mechanisms to capitalize on this. The reason we need to get a new flu shot every year is that influenza viruses present a "knob" at the end of their glycoprotein that can change its structure and still retain function. This part is much more 'visible' to the immune system than parts of the virus that can't tolerate changes, so the immune response to this variable part outcompetes and prevents an immune response that would provide long-lasting protection. Conserved stalk-targeting vaccines are being intensely investigated for this reason. SARS-CoV-2 may have a immune-faking mechanism as well: the "spike" glycoproteins responsible for binding the ACE2 receptor and entering the cell convert to their post-binding form prematurely part of the time. Antibodies that bind the "post-fusion" form of the protein don't inactivate the virus, and this form sticks out more so may serve to compete for immune attention with the pre-fusion form that would provide protection if bound by antibodies.
In this last example, we can see that a vaccine made of killed SARS-CoV-2 virus particles would be useless if all of the spike proteins had converted to the post-fusion state. The mRNA vaccines therefore don't encode the natural spike protein, but a mutated version which can't convert to the post fusion state as easily:

S-2P is stabilized in its prefusion conformation by two consecutive proline substitutions at amino acid positions 986 and 987

In conclusion, viruses and the immune system are very complicated. Simple vaccines work for some viruses, and don't work for others. When they don't work, the reason is always different, but hopefully I've communicated some general understanding of the background issues.
EDITS:
This doesn't relate to the rest of my answer but I want to respond to Ilmari Karonen's and there is not enough room in a comment.
Looking at the timeline for SARS-CoV-2 vaccine development gives a very misleading impression of how long it takes generally. This is because ~90% of the development work was already done before COVID-19 was ever identified, in the 18 years since the SARS-CoV-1 outbreak started in 2002. Vaccines against SARS were developed and tested up to phase I trials, but couldn't proceed further since the virus was eliminated. I discussed this in a previous answer to a similar question, but to expand/reformat, here's some of what we knew and had available on March 17th 2020, when the "covid vaccine timeline" begins:

Identified the receptor as ACE2, and knew that antibodies targeting the receptor binding domain (RBD) of the spike protein neutralize the virus. Protocols to test that these were also true of SARS-CoV-2 were already developed and validated. Without this there would have been a lot more trial-and-error experimentation and false starts with vaccine candidates that looked promising but didn't pan out in testing.
Animal models. There is no naturally-occurring model organism for COVID-19. This is a subtle point because other animals can be infected with the virus, and some develop morbidities because of it. However, these are different enough from what we see in humans that something that protects against the reactions we see in the animal can't be assumed to protect against the reactions that cause problems in humans. For SARS, researchers developed transgenic mice that used the human version of ACE2, and showed that the disease they got from SARS were analogous to the disease humans got. This took several years, and the colony was still available when the virus causing the outbreak in Wuhan was identified as SARS-like and researchers started looking for animal models. As an aside, in an interview on This Week in Virology that I can't find right now, one of the maintainers of that colony said they were months or weeks away from shutting it down and euthanizing all the transgenic mice when the pandemic began, so if funding had been just a bit tighter we probably would not be having this particular conversation now.
How to stabilize the pre-fusion form of coronavirus spike proteins had been determined from work on SARS and MERS vaccines.

In addition to these, a large amount of miscellaneous knowledge about coronavirus functions and the immune reactions to them had been accumulated, and this sped up development, and increased confidence in results, which allows vaccine candidate production and testing to proceed more aggressively.
Historically, vaccine development has taken years or decades of research after the need has been identified. Testing is still longer in many cases, but the current case is very unusual.


Question:
The common understanding is that, setting air resistance aside, all objects dropped to Earth fall at the same rate. This is often demonstrated through the thought experiment of cutting a large object in half—the halves clearly don't fall more slowly just from having been sliced into two pieces.
However, I believe the answer is that when two objects fall together, attached or not, they do "fall" faster than an object of less mass alone does. This is because not only does the Earth accelerate the objects toward itself, but the objects also accelerate the Earth toward themselves. Considering the formula:
$$
F_{\text{g}} = \frac{G m_1 m_2}{d^2}
$$
Given $F = ma$ thus $a = F/m$, we might note that the mass of the small object doesn't seem to matter because when calculating acceleration, the force is divided by $m$, the object's mass. However, this overlooks that a force is actually applied to both objects, not just to the smaller one. An acceleration on the second, larger object is found by dividing $F$, in turn, by the larger object's mass. The two objects' acceleration vectors are exactly opposite, so closing acceleration is the sum of the two:
$$
a_{\text{closing}} = \frac{F}{m_1} + \frac{F}{m_2}
$$
Since the Earth is extremely massive compared to everyday objects, the acceleration imparted on the object by the Earth will radically dominate the equation. As the Earth is $\sim 5.972 \times {10}^{24} \, \mathrm{kg} ,$ a falling object of $5.972 \times {10}^{1} \, \mathrm{kg}$ (a little over 13 pounds) would accelerate the Earth about $\frac{1}{{10}^{24}}$ as much, which is one part in a trillion trillion.
Thus, in everyday situations we can for all practical purposes treat all objects as falling at the same rate because this difference is so small that our instruments probably couldn't even detect it. But I'm hoping not for a discussion of practicality or what's measurable or observable, but of what we think is actually happening.
Am I right or wrong?
What really clinched this for me was considering dropping a small Moon-massed object close to the Earth and dropping a small Earth-massed object close to the Moon. This thought experiment made me realize that falling isn't one object moving toward some fixed frame of reference, and treating the Earth as just another object, "falling" consists of multiple objects mutually attracting in space.
Clarification: one answer points out that serially lifting and dropping two objects on Earth comes with the fact that during each trial, the other object adds to the Earth's mass. Dropping a bowling ball (while a feather waits on the surface), then dropping the feather afterward (while the bowling ball stays on the surface), changes the Earth's mass between the two experiments. My question should thus be considered from the perspective of the Earth's mass remaining constant between the two trials (such as by removing each of the objects from the universe, or to an extremely great distance, while the other is being dropped).

Using your definition of "falling," heavier objects do fall faster, and here's one way to justify it: consider the situation in the frame of reference of the center of mass of the two-body system (CM of the Earth and whatever you're dropping on it, for example). Each object exerts a force on the other of
$$F = \frac{G m_1 m_2}{r^2}$$
where $r = x_2 - x_1$ (assuming $x_2 > x_1$) is the separation distance. So for object 1, you have
$$\frac{G m_1 m_2}{r^2} = m_1\ddot{x}_1$$
and for object 2,
$$\frac{G m_1 m_2}{r^2} = -m_2\ddot{x}_2$$
Since object 2 is to the right, it gets pulled to the left, in the negative direction. Canceling common factors and adding these up, you get
$$\frac{G(m_1 + m_2)}{r^2} = -\ddot{r}$$
So it's clear that when the total mass is larger, the magnitude of the acceleration is larger, meaning that it will take less time for the objects to come together. If you want to see this mathematically, multiply both sides of the equation by $\dot{r}\mathrm{d}t$ to get
$$\frac{G(m_1 + m_2)}{r^2}\mathrm{d}r = -\dot{r}\mathrm{d}\dot{r}$$
and integrate,
$$G(m_1 + m_2)\left(\frac{1}{r} - \frac{1}{r_i}\right) = \frac{\dot{r}^2 - \dot{r}_i^2}{2}$$
Assuming $\dot{r}_i = 0$ (the objects start from relative rest), you can rearrange this to
$$\sqrt{2G(m_1 + m_2)}\ \mathrm{d}t = -\sqrt{\frac{r_i r}{r_i - r}}\mathrm{d}r$$
where I've chosen the negative square root because $\dot{r} < 0$, and integrate it again to find
$$t = \frac{1}{\sqrt{2G(m_1 + m_2)}}\biggl(\sqrt{r_i r_f(r_i - r_f)} + r_i^{3/2}\cos^{-1}\sqrt{\frac{r_f}{r_i}}\biggr)$$
where $r_f$ is the final center-to-center separation distance. Notice that $t$ is inversely proportional to the total mass, so larger mass translates into a lower collision time.
In the case of something like the Earth and a bowling ball, one of the masses is much larger, $m_1 \gg m_2$. So you can approximate the mass dependence of $t$ using a Taylor series,
$$\frac{1}{\sqrt{2G(m_1 + m_2)}} = \frac{1}{\sqrt{2Gm_1}}\biggl(1 - \frac{1}{2}\frac{m_2}{m_1} + \cdots\biggr)$$
The leading term is completely independent of $m_2$ (mass of the bowling ball or whatever), and this is why we can say, to a leading order approximation, that all objects fall at the same rate on the Earth's surface. For typical objects that might be dropped, the first correction term has a magnitude of a few kilograms divided by the mass of the Earth, which works out to $10^{-24}$. So the inaccuracy introduced by ignoring the motion of the Earth is roughly one part in a trillion trillion, far beyond the sensitivity of any measuring device that exists (or can even be imagined) today.


Question:
I have done a lot of research and found out methods like adaptive thresholding , watershed etc that can be used of detecting veins in leaves . However thresholding isn't good as it introduces a lot of noise
All my images are gray image please could anyone suggest what approaches to adopt while considering this problem in urgent need of help
EDIT:My original image

After thresholding

As suggested by the answer i have tried the following edge detection

Canny

Too much noise and unwanted disturbances

Sobel

Roberts

EDIT: Tried one more operation i get the following result its better than what i tried with canny and adaptive What do you feel?

You're not looking for edges (=borders between extended areas of high and low gray value), you're looking for ridges (thin lines darker or brighter than their neighborhood), so edge filters might not be ideal: An edge filter will give you two flanks (one on each side of the line) and a low response in the middle of the line:

ADD: If've been asked to explain the difference between an edge detector and a ridge detector more clearly. I apologize in advance if this answer is getting very long.
An edge detector is (usually) a first derivative operator: If you imagine the input image as a 3D landscape, an edge detector measures the steepness of the slope at each point of that landscape:

If you want to detect the border of an extended bright or dark region, this is just fine. But for the veins in the OP's image it will give you just the same: the outlines left and right of each vein:

That also explains the "double line pattern" in the Canny edge detector results:

So, how do you detect these thin lines (i.e. ridges), then? The idea is that the pixel values can be (locally) approximated by a 2nd order polynomial, i.e. if the image function is $g$, then for small values of $x$ and $y$:
$g(x,y)\approx \frac{1}{2} x^2 \frac{\partial ^2g}{\partial x^2}+x y \frac{\partial ^2g}{\partial x\, \partial y}+\frac{1}{2} y^2 \frac{\partial ^2g}{\partial y\, ^2}+x \frac{\partial g}{\partial x}+y \frac{\partial g}{\partial y}+g(0,0)$
or, in matrix form:
$g(x,y)\approx \frac{1}{2} \left(
\begin{array}{c}
 x & y
\end{array}
\right).\left(
\begin{array}{cc}
 \frac{\partial ^2g}{\partial x^2} & \frac{\partial ^2g}{\partial x\, \partial y} \\
 \frac{\partial ^2g}{\partial x\, \partial y} & \frac{\partial ^2g}{\partial y\, ^2}
\end{array}
\right).\left(
\begin{array}{cc}
 x \\
 y
\end{array}
\right)+\left(
\begin{array}{cc}
 \frac{\partial g}{\partial x} & \frac{\partial g}{\partial y}
\end{array}
\right).\left(
\begin{array}{c}
 x \\
 y
\end{array}
\right)+g(0,0)$
The second order derivative matrix $\left(
\begin{array}{cc}
 \frac{\partial ^2g}{\partial x^2} & \frac{\partial ^2g}{\partial x\, \partial y} \\
 \frac{\partial ^2g}{\partial x\, \partial y} & \frac{\partial ^2g}{\partial y\, ^2}
\end{array}
\right)$ is called the "Hessian matrix". It describes the 2nd order structure we're interested in.
The 2nd order part of this function can be transformed into the sum of two parabolas $\lambda _1 x^2 + \lambda _2 y^2$ rotated by some angle, by decomposing the Hessian matrix above to a rotation times a diagonal matrix of it's eigenvalues (Matrix decomposition). We don't care about the rotation (we want to detect ridges in any orientation), so we're only interested in $\lambda _1$ and $\lambda _2$
What kind of shapes can this function approximation have? Actually, not that many:

To detect ridges, we want to find areas in the image that look like the last of the plots above, so we're looking for areas where the major eigenvalue of the Hessian is large (compared to the minor eigenvalue). The simplest way to detect that is just to calculate the major eigenvalue at each pixel - and that's what the ridge filter below does.

A ridge filter will probably give better results. I've tried Mathematica's built in RidgeFilter (which calculates the major eigenvalue of the Hessian matrix at each pixel) on your image:

As you can see, there's only a single peak for every thin dark line. Binarizing and skeletonizing yields:

After pruning the skeleton and removing small components (noise) from the image, I get this final skeleton:

Full Mathematica code:
ridges = RidgeFilter[ColorNegate@src];
skeleton = SkeletonTransform[Binarize[ridges, 0.007]];
DeleteSmallComponents[Pruning[skeleton, 50], 50]

ADD:
I'm not a Matlab expert, I don't know if it has a built in ridge filter, but I can show you how to implement it "by hand" (again, using Matematica). As I said, the ridge filter is the major eigenvalue of the Hessian matrix. I can calculate that eigenvalue symbolically in Mathematica:
$\text{eigenvalue}=\text{Last}\left[\text{Eigenvalues}\left[\left(
\begin{array}{cc}
 H_{\text{xx}} & H_{\text{xy}} \\
 H_{\text{xy}} & H_{\text{yy}}
\end{array}
\right)\right]\right]$
=> $\frac{1}{2} \left(H_{\text{xx}}+H_{\text{yy}}+\sqrt{H_{\text{xx}}^2+4 H_{\text{xy}}^2-2 H_{\text{xx}} H_{\text{yy}}+H_{\text{yy}}^2}\right)$
So what you have to do is calculate the second derivatives $H_{\text{xx}}$, $H_{\text{xy}}$, $H_{\text{yy}}$ (using a sobel or derivative of gaussian filter) and insert them into the expression above, and you've got your ridge filter.


Question:
Assume that we are playing a game of Russian roulette (6 chambers) and that there is no shuffling after the shot is fired.
I was wondering if you have an advantage in going first?
If so, how big of an advantage?
I was just debating this with friends, and I wouldn't know what probability to use to prove it. I'm thinking binomial distribution or something like that.
If $n=2$, then there's no advantage. Just $50/50$ if the person survives or dies.
If $n=3$, then maybe the other guy has an advantage. The person who goes second should have an advantage.
Or maybe I'm wrong.

For a $2$ Player Game, it's obvious that player one will play, and $\frac16$ chance of losing.  Player $2$, has a $\frac16$ chance of winning on turn one, so there is a $\frac56$ chance he will have to take his turn. (I've intentionally left fractions without reducing them as it's clearer where the numbers came from)
Player 1 - $\frac66$ (Chance Turn $1$ happening) $\times \ \frac16$ (chance of dying) = $\frac16$
Player 2 - $\frac56$ (Chance Turn $2$ happening) $\times \ \frac15$ (chance of dying) = $\frac16$
Player 1 - $\frac46$ (Chance Turn $3$ happening) $\times \ \frac14$ (chance of dying) = $\frac16$
Player 2 - $\frac36$ (Chance Turn $4$ happening) $\times \ \frac13$ (chance of dying) = $\frac16$
Player 1 - $\frac26$ (Chance Turn $5$ happening) $\times \ \frac12$ (chance of dying) = $\frac16$
Player 2 - $\frac16$ (Chance Turn $6$ happening) $\times \ \frac11$ (chance of dying) = $\frac16$
So the two player game is fair without shuffling.
Similarly, the $3$ and $6$ player versions are fair.
It's the $4$ and $5$ player versions where you want to go last, in hopes that the bullets will run out before your second turn.
For a for $4$ player game, it's:
P1 - $\frac26$,
P2 - $\frac26$,
P3 - $\frac16$,
P4 - $\frac16$
Now, the idea in a $2$ player game is that it is best to be player $2$, because in the event you end up on turn six, you KNOW you have a chambered round, and can use it to shoot player $1$ (or your captor), thus winning, changing your total odds of losing to P1 - $\frac36$, P2 - $\frac26$, Captor -  $\frac16$


Question: How would you describe in plain English the characteristics that distinguish Bayesian from Frequentist reasoning?

Here is how I would explain the basic difference to my grandma:
I have misplaced my phone somewhere in the home. I can use the phone locator on the base of the instrument to locate the phone and when I press the phone locator the phone starts beeping.
Problem: Which area of my home should I search?
Frequentist Reasoning
I can hear the phone beeping. I also have a mental model which helps me identify the area from which the sound is coming. Therefore, upon hearing the beep, I infer the area of my home I must search to locate the phone.
Bayesian Reasoning
I can hear the phone beeping. Now, apart from a mental model which helps me identify the area from which the sound is coming from, I also know the locations where I have misplaced the phone in the past. So, I combine my inferences using the beeps and my prior information about the locations I have misplaced the phone in the past to identify an area I must search to locate the phone.


Question: I've learned about a number of edge detection algorithms, including algorithms like Sobel, Laplacian, and Canny methods. It seems to me the most popular edge detector is a Canny edge detector, but is there cases where this isn't the optimal algorithm to use? How can I decide which algorithm to use? Thanks!

There are lots of edge detection possibilities, but the 3 examples you mention happen to fall in 3 distinct categories.
Sobel
This approximates a first order derivative. Gives extrema at the gradient positions, 0 where no gradient is present. In 1D, it is = $\left[ \begin{array}{ccc} -1 & 0 & 1 \end{array} \right]$

smooth edge => local minimum or maximum, depending on the signal going up or down.
1 pixel line => 0 at the line itself, with local extrema (of different sign) right next to it. In 1D, it is = $\left[ \begin{array}{ccc} 1 & -2 & 1 \end{array} \right]$

There are other alternatives to Sobel, which have +/- the same characteristics. On the Roberts Cross page on wikipedia you can find a comparison of a few of them.
Laplace
This approximates a second order derivative. Gives 0 at the gradient positions and also 0 where no gradient is present. It gives extrema where a (longer) gradient starts or stops.

smooth edge => 0 along the edge, local extrema at the start/stop of the edge.
1 pixel line => a "double" extremum at the line, with "normal" extrema with a different sign right next to it

The effect of these 2 on different types of edges can be best viewed visually:

Canny
This is not a simple operator, but is a multi-step approach, which uses Sobel as one of the steps. Where Sobel and Laplace give you a grayscale / floating point result, which you need to threshold yourself, the Canny algorithm has smart thresholding as one of its steps, so you just get a binary yes/no result. Also, on a smooth edge, you will likely find just 1 line somewhere in the middle of the gradient.


Question:
I'd like to mix two or more PCM audio channels (eg recorded samples) digitally in an acoustically-faithful manner, preferably in near-real-time (meaning little or no peek-ahead).
The physically "correct" way to do this is summing the samples. However when you add two arbitrary samples, the resulting value could be up to twice the maximum value.
For example, if your samples are 16-bit values, the result will be up to 65536*2. This results in clipping.
The naive solution here is to divide by N, where N is the number of channels being mixed. However, this results in each sample being 1/Nth as loud, which is completely unrealistic. In the real world, when two instruments play simultaneously, each instrument does not become half as loud.
From reading around, a common method of mixing is: result = A + B - AB, where A and B are the two normalized samples being mixed, and AB is a term to ensure louder sounds are increasingly "soft-clipped".
However, this introduces a distortion of the signal. Is this level of distortion acceptable in high-quality audio synthesis?
What other methods are there to solve this problem? I'm interested in efficient lesser-quality algorithms as well as less-efficient high-quality algorithms.
I'm asking my question in the context of digital music synthesis, for the purpose of mixing multiple instrument tracks together. The tracks could be synthesised audio, pre-recorded samples, or real-time microphone input.

The physically "correct" way to do this is summing the samples. However when you add two arbitrary samples, the resulting value could be up to twice the maximum value. ... The naive solution here is to divide by N, where N is the number of channels being mixed.

That's not the "naive" solution, its the only solution.  That's what every analog and digital mixer does, because it's what the air does, and it's what your brain does.
Unfortunately, this appears to be a common misconception, as demonstrated by these other incorrect non-linear "mixing" (distortion) algorithms:

Mixing digital audio (the wrong way)
A quick-and-dirty audio sample mixing technique to avoid clipping (don't do this)

The "dividing by N" is called headroom; the extra room for peaks that's allocated above the RMS level of the waveform.  The amount of headroom required for a signal is determined by the signal's crest factor.  (Misunderstanding of digital signal levels and headroom is probably partially to blame for the Loudness war and Elephunk.)
In analog hardware, the headroom is maybe 20 dB.  In a hardware DSP, fixed-point is often used, with a fixed headroom; AD's SigmaDSP, for instance, has 24 dB of headroom.  In computer software, the audio processing is usually performed in 32 bit floating point, so the headroom is enormous.
Ideally, you wouldn't need to divide by N at all, you'd just sum the signals together, because your signals wouldn't be generated at 0 dBFS in the first place.
Note that most signals are not correlated to each other, anyway, so it's uncommon for all the channels of a mixer to constructively interfere at the same moment.  Yes, mixing 10 identical, in-phase sine waves would increase the peak level by 10 times (20 dB), but mixing 10 non-coherent noise sources will only increase the peak level by 3.2 times (10 dB).  For real signals, the value will be between these extremes.
In order to get the mixed signal out of a DAC without clipping, you simply reduce the gain of the mix.  If you want to keep the RMS level of the mix high without hard clipping, you will need to apply some type of compression to limit the peaks of the waveform, but this is not part of mixing, it's a separate step.  You mix first, with plenty of headroom, and then put it through dynamic range compression later, if desired.