Question:
On the Wikipedia page about naive Bayes classifiers, there is this line:

$p(\mathrm{height}|\mathrm{male}) = 1.5789$ (A probability distribution over 1 is OK. It is the area under the bell curve that is equal to 1.)

How can a value $>1$ be OK? I thought all probability values were expressed in the range $0 \leq p \leq 1$. Furthermore, given that it is possible to have such a value, how is that value obtained in the example shown on the page?

That Wiki page is abusing language by referring to this number as a probability.  You are correct that it is not.  It is actually a probability per foot.  Specifically, the value of 1.5789 (for a height of 6 feet) implies that the probability of a height between, say, 5.99 and 6.01 feet is close to the following unitless value:
$$1.5789\, [1/\text{foot}] \times (6.01 - 5.99)\, [\text{feet}] = 0.0316$$
This value must not exceed 1, as you know.  (The small range of heights (0.02 in this example) is a crucial part of the probability apparatus.  It is the "differential" of height, which I will abbreviate $d(\text{height})$.)  Probabilities per unit of something are called densities by analogy to other densities, like mass per unit volume.
Bona fide probability densities can have arbitrarily large values, even infinite ones.

This example shows the probability density function for a Gamma distribution (with shape parameter of $3/2$ and scale of $1/5$). Because most of the density is less than $1$, the curve has to rise higher than $1$ in order to have a total area of $1$ as required for all probability distributions.

This density (for a beta distribution with parameters $1/2, 1/10$) becomes infinite at $0$ and at $1$.  The total area still is finite (and equals $1$)!

The value of 1.5789 /foot is obtained in that example by estimating that the heights of males have a normal distribution with mean 5.855 feet and variance 3.50e-2 square feet.  (This can be found in a previous table.) The square root of that variance is the standard deviation, 0.18717 feet.  We re-express 6 feet as the number of SDs from the mean:
$$z = (6 - 5.855) / 0.18717 = 0.7747$$
The division by the standard deviation produces a relation
$$dz = d(\text{height})/0.18717$$
The Normal probability density, by definition, equals
$$\frac{1}{\sqrt{2 \pi}}\exp(-z^2/2)dz = 0.29544\ d(\text{height}) / 0.18717 = 1.5789\  d(\text{height}).$$
(Actually, I cheated: I simply asked Excel to compute NORMDIST(6, 5.855, 0.18717, FALSE).  But then I really did check it against the formula, just to be sure.)  When we strip the essential differential $d(\text{height})$ from the formula only the number $1.5789$ remains, like the Cheshire Cat's smile.  We, the readers, need to understand that the number has to be multiplied by a small difference in heights in order to produce a probability.


Question:
This has come up repeatedly recently: I have a very large text file (in the order of several GiB) and I need to perform line-based subsetting for around 10,000 lines. There exist solutions for specific scenarios (e.g. samtools view -s for randomly sampling BAM files) but sometimes my use-case doesn’t fit into these categories.
Unfortunately a naïve sed-based solution is extremely slow:
time sed -n -f <(awk -vOFS='' '{print $0, "p"}' line_numbers.txt) input_file > selected_lines.txt

Where line_numbers.txt is a file containing one line number per line.
Forget running this for 10,000 lines; it’s already grinding to a halt for a mere 1000.
How can I speed this up, ideally so that it scales only with the size of the input file, and has more or less constant runtime n the number of lines that I subset?

Turns out, simply keeping track of the next candidate line (after sorting the sample line numbers) fixes the performance issue, and most of the remaining slowness seems to be due to the overhead of actually reading the file so there’s not very much to improve.
Since I don’t know how how to do this in sed, and it’s not trivial in awk either, here’s a Perl script:
#!/usr/bin/env perl

use strict;
use warnings;

my $file = $ARGV[0];
my $lines_file = $ARGV[1];

open my $lines_fh, '<', $lines_file or die "Cannot read file $lines_file";
chomp (my @lines = <$lines_fh>);
close $lines_fh;

@lines = sort {$a <=> $b} @lines;

open my $fh, '<', $file or die "Cannot read file $file";
my $line = 1;
my $next_line = 0;
while (<$fh>) {
    last if $next_line == scalar @lines;
    if ($line++ == $lines[$next_line]) {
        $next_line++;
        print;
    }
}
close $fh;

I’ve implemented a similar function in C++ for an R package, that's only slightly longer than the Perl script. It is ~3 times faster than the Perl script on my test file.


Question:
I have a fasta file like
>sample 1 gene 1
atgc
>sample 1 gene 2
atgc
>sample 2 gene 1
atgc

I want to get the following output, with one break between the header and the sequence.
>sample 1 gene 1   atgc
>sample 1 gene 2   atgc
>sample 2 gene 1   atgc

If you have multi-line fasta files, as is very common, you can use these scripts1 to convert between fasta and tbl (sequence_name <TAB> sequence) format:

FastaToTbl
#!/usr/bin/awk -f
{
        if (substr($1,1,1)==">")
    		if (NR>1)
                    	printf "\n%s\t", substr($0,2,length($0)-1)
    		else
    			printf "%s\t", substr($0,2,length($0)-1)
            else
                    printf "%s", $0
}END{printf "\n"}

TblToFasta
#! /usr/bin/awk -f
{
  sequence=$NF

  ls = length(sequence)
  is = 1
  fld  = 1
  while (fld < NF)
  {
     if (fld == 1){printf ">"}
     printf "%s " , $fld

     if (fld == NF-1)
      {
        printf "\n"
      }
      fld = fld+1
  }
  while (is <= ls)
  {
    printf "%s\n", substr(sequence,is,60)
    is=is+60
  }
}

Save those in your $PATH, make them executable, and you can then do:
$ cat file.fa
>sequence1
ATGCGGAGCTTAGATTCTCGAGATCTCGATATCGCGCTTATAAAAGGCCCGGATTAGGGC
TAGCTAGATATCGCGATAGCTAGGGATATCGAGATGCGATACG
>sequence2
GTACTCGATACGCTACGCGATATTGCGCGATACGCATAGCTAACGATCGACTAGTGATGC
ATAGAGCTAGATCAGCTACGATAGCATCGATCGACTACGATCAGCATCAC
$ FastaToTbl file.fa
sequence1   ATGCGGAGCTTAGATTCTCGAGATCTCGATATCGCGCTTATAAAAGGCCCGGATTAGGGCTAGCTAGATATCGCGATAGCTAGGGATATCGAGATGCGATACG
sequence2   GTACTCGATACGCTACGCGATATTGCGCGATACGCATAGCTAACGATCGACTAGTGATGCATAGAGCTAGATCAGCTACGATAGCATCGATCGACTACGATCAGCATCAC

And, to get the Fasta back:
$ FastaToTbl file.fa | TblToFasta
>sequence1
ATGCGGAGCTTAGATTCTCGAGATCTCGATATCGCGCTTATAAAAGGCCCGGATTAGGGC
TAGCTAGATATCGCGATAGCTAGGGATATCGAGATGCGATACG
>sequence2
GTACTCGATACGCTACGCGATATTGCGCGATACGCATAGCTAACGATCGACTAGTGATGC
ATAGAGCTAGATCAGCTACGATAGCATCGATCGACTACGATCAGCATCAC

This can be a very useful trick when searching a fasta file for a string:
TblToFasta file.fa | grep 'foo' | FastaToTbl

If you really want to keep the leading > of the header (which doesn't seem very useful), you could do something like this:
$ perl -0pe 's/\n//g; s/.>/\n>/g; s/$/\n/;' file.fa
>sequence1 ATGCGGAGCTTAGATTCTCGAGATCTCGATATCGCGCTTATAAAAGGCCCGGATTAGGGCTAGCTAGATATCGCGATAGCTAGGGATATCGAGATGCGATAC
>sequence2 GTACTCGATACGCTACGCGATATTGCGCGATACGCATAGCTAACGATCGACTAGTGATGCATAGAGCTAGATCAGCTACGATAGCATCGATCGACTACGATCAGCATCAC

But that will read the entire file into memory. If that's an issue, add an empty line between each fasta record, and then use perl's paragraph mode to process each "paragraph" (sequence) at a time:
perl -pe  's/>/\n>/' file.fa | perl -00pe 's/\n//g; s/.>/\n>/g; s/$/\n/;'

1Credit to Josep Abril who wrote these scripts more than a decade ago.


Question:
I am using a reference genome for mm10 mouse downloaded from NCBI, and would like to understand in greater detail the difference between lowercase and uppercase letters, which make up roughly equal parts of the genome. I understand that N is used for 'hard masking' (areas in the genome that could not be assembled) and lowercase letters for 'soft masking' in repeat regions.

What does this soft masking actually mean?
How confident can I be about the sequence in these regions?
What does a lowercase n represent?

What does this soft masking actually mean?

A lot of the sequence in genomes are repetitive. Human genome, for example, has (at least) two-third repetitive elements.[1].
These repetitive elements are soft-masked by converting the upper case letters to lower case. An important use-case of these soft-masked bases will be in homology searches: An atatatatatat will tend to appear both in human and mouse genomes but is likely non-homologous.

How confident can I be about the sequence in these regions?

As you can be about in non soft-masked based positions. Soft-masking is done after determining portions in the genome that are likely repetitive. There is no uncertainty whether a particular base is 'A' or 'G', just that it is part of a repeat and hence should be represented as an 'a'.

What does a lowercase n represent?

UCSC uses Tandom Repeat Finder and RepeatMasker for soft-masking potential repeats. NCBI most likely uses TANTAN. 'N's represents no sequence information is available for that base. It being replaced by 'n' is likely an artifact of the repeat-masking software where it soft-masks an 'N' by an 'n' to indicate that portion of the genome is likely a repeat too.
[1]


Question:
Models of structures deposited in the Protein Data Bank vary in the quality, depending both on the data quality and expertise and patience of the person who built the model. Is there a well-accepted subset of the PDB entries that has only "high quality" structures? Ideally these structures would be representative for classes of proteins in the whole PDB.
based on a real question from biology.SE

There is a very nice database, pdbcull (also known as the PISCES server in the literature). It filters the PDB for high resolution and reduced sequence identity. It also seems to be updated regularly. Depending on the cut-offs, you get between 3000 and 35000 structures.
If you are specifically interested in rotamers, you may want to look at top8000 instead, where they have checked for high resolution, and good MolProbity scores. They also provide a rotamer database.
PDB also provides their own clustering. They first cluster the sequences, and then extract a representative structure for each one, based on the quality factor (1/resolution - R_value). This has the advantage of being comprehensive, but you will have bad structures when no good ones were ever obtained.


Question:
I guess I've been somewhat ignorant when it comes to the finer details of pcb layout. Lately I've read a couple of books that try their best to lead me on the straight and narrow. Here is a couple of examples of a recent board of mine, and I have highlighted three of the decoupling caps. The MCU is a LQFP100 package and the caps are 100nF in 0402 packages. The vias connect to ground and power plane.

The top cap (C19) is placed according to best practices (as I understand them). The other two are not. I haven't noticed any problems. But then again the board has never been outside the lab.
I guess my question is: How big a deal is this? As long as the tracks are short, does it matter?
The Vref pins (reference voltage for the ADC) also have a 100nF cap across them. Vref+ comes from an onboard TL431 shunt regulator. Vref- goes to ground. Do they require special treatment like shielding or local ground?

EDIT

Thanks for great suggestions! My approach has always been to rely on an unbroken ground plane. A ground plane will have the lowest possible impedance, but this approach may be too simplistic for higher frequency signals. I've made a quick stab at adding local ground and local power under the MCU (The part is an NXP LPC1768 running at 100MHz).
The yellow bits are the decoupling caps. I'll look into paralleling caps. The local ground and power are connected to the GND layer and the 3V3 layer where indicated.
The local ground and power are made with polygons (pour). It's going to be a major rerouting job to minimize the length of the "tracks". This technique will limit how many signal tracks can be routed under and across the package.
Is this an acceptable approach?

Proper bypassing and grounding are unfortunately subjects that seem to be poorly taught and poorly understood.  They are actually two separate issues.  You are asking about the bypassing, but have also implicitly gotten into grounding.
For most signal problems, and this case is no exception, it helps to consider them both in the time domain and the frequency domain.  Theoretically you can analyse in either and convert mathematically to the other, but they each give different insights to the human brain.
Decoupling provides a near reservoir of energy to smooth out the voltage from very short term changes in current draw.  The lines back to the power supply have some inductance, and the power supply takes a little time to respond to a voltage drop before it produces more current.  On a single board it can catch up usually within a few microseconds (us) or tens of us.  However, digital chips can change their current draw a large amount in only a few nanoseconds (ns).  The decoupling cap has to be close to the digital chip power and ground leads to do its job, else the inductance in those leads gets in the way of it delivering the extra current quickly before the main power feed can catch up.
That was the time domain view.  In the frequency domain digital chips are AC current sinks between their power and ground pins.  At DC power comes from the main power supply and all is fine, so we're going to ignore DC.  This current sink generates a wide range of frequencies.  Some of the frequencies are so high that the little inductance in the relatively long leads to the main power supply start becoming a significant impedance.  That means those high frequencies will cause local voltage fluctuations unless they are dealt with.  The bypass cap is the low impedance shunt for those high frequencies.  Again, the leads to the bypass cap must be short else their inductance will be too high and get in the way of the capacitor shorting out the high frequency current generated by the chip.
In this view, all your layouts look fine.  The cap is close to the power and ground chips in each case.  However I don't like any of them for a different reason, and that reason is grounding.
Good grounding is harder to explain than bypassing.  It would take a whole book to really get into this issue, so I'm only going to mention pieces.  The first job of grounding is to supply a universal voltage reference, which we usually consider 0V since everything else is considered relative to the ground net.  However, think what happens as you run current thru the ground net.  It's resistance isn't zero, so that causes a small voltage difference between different points of the ground.  The DC resistance of a copper plane on a PCB is usually low enough so that this is not too much of a issue for most circuits.  A purely digital circuit has 100s of mV noise margins at least, so a few 10s or 100s of μV ground offset isn't a big deal.  In some analog circuits it is, but that's not the issue I'm trying to get at here.
Think what happens as the frequency of the current running across the ground plane gets higher and higher.  At some point the whole ground plane is only 1/2 wavelength across.  Now you don't have a ground plane anymore but a patch antenna.  Now remember that a microcontroller is a broad band current source with high frequency components.  If you run its immediate ground current across the ground plane for even a little bit, you have a center-fed patch antenna.
The solution I usually use, and for which I have quantitative proof it works well, is to keep the local high frequency currents off the ground plane.  You want to make a local net of the microcontroller power and ground connections, bypass them locally, then have only one connection to each net to the main system power and ground nets.  The high frequency currents generated by the microcontroller go out the power pins, thru the bypass caps, and back into the ground pins.  There can be lots of nasty high frequency current running around that loop, but if that loop has only a single connection to the board power and ground nets, then those currents will largely stay off them.
So to bring this back to your layout, what I don't like is that each bypass cap seems to have a separate via to power and ground.  If these are the main power and ground planes of the board, then that's bad.  If you have enough layers and the vias are really going to local power and ground planes, then that's OK as long as those local planes are connected to the main planes at only one point.
It doesn't take local planes to do this.  I routinely use the local power and ground nets technique even on 2 layer boards.  I manually connect all the ground pins and all the power pins, then the bypass caps, then the crystal circuit before routing anything else.  These local nets can be a star or whatever right under the microcontroller and still allow other signals to be routed around them as required.  However, once again, these local nets must have exactly one connection to the main board power and ground nets.  If you have a board level ground plane, then there will be one via some place to connect the local ground net to the ground plane.
I usually go a little further if I can.  I put 100 nF or 1 μF ceramic bypass caps as close to the power and ground pins as possible, then route the two local nets (power and ground) to a feed point and put a larger (10μF usually) cap across them and make the single connections to the board ground and power nets right at the other side of the cap.  This secondary cap provides another shunt to the high frequency currents that escaped being shunted by the individual bypass caps.  From the point of view of the rest of the board, the power/ground feed to the microcontroller is nicely behaved without lots of nasty high frequencies.
So now to finally address your question of whether the layout you have matters compared to what you think best practices are.  I think you have bypassed the power/ground pins of the chip well enough.  That means it should operate fine.  However, if each has a separate via to the main ground plane then you might have EMI problems later.  Your circuit will run fine, but you might not be able to legally sell it.  Keep in mind that RF transmission and reception are reciprocal.  A circuit that can emit RF from its signals is likewise susceptible to having those signals pick up external RF and have that be noise on top of the signal, so it's not just all someone else's problem.  Your device may work fine until a nearby compressor is started up, for example.  This is not just a theoretical scenario.  I've seen cases exactly like that, and I expect many others here have too.
Here's a anecdote that shows how this stuff can make a real difference.  A company was making little gizmos that cost them $120 to produce.  I was hired to update the design and get production cost below $100 if possible.  The previous engineer didn't really understand RF emissions and grounding.  He had a microprocessor that was emitting lots of RF crap.  His solution to pass FCC testing was to enclose the whole mess in a can.  He made a 6 layer board with the bottom layer ground, then had a custom piece of sheet metal soldered over the nasty section at production time.  He thought that just by enclosing everything in metal that it wouldn't radiate.  That's wrong, but somewhat of a aside I'm not going to get into now.  The can did reduce emissions so that they just squeaked by FCC testing with 1/2 dB to spare (that's not a lot).
My design used only 4 layers, a single board-wide ground plane, no power planes, but local ground planes for a few of the choice ICs with single point connections for these local ground planes and the local power nets as I described.  To make a long story shorter, this beat the FCC limit by 15 dB (that's a lot).  A side advantage was that this device was also in part a radio receiver, and the much quieter circuitry fed less noise into the radio and effectively doubled its range (that's a lot too).  The final production cost was $87.  The other engineer never worked for that company again.
So, proper bypassing, grounding, visualizing and dealing with the high frequency loop currents really matters.  In this case it contributed to make the product better and cheaper at the same time, and the engineer that didn't get it lost his job.  No, this really is a true story.


Question:
The IGSR has a sample for encoding structural variants in the VCF 4.0 format.
An example from the site (the first record):
#CHROM  POS   ID  REF ALT   QUAL  FILTER  INFO  FORMAT  NA00001
1 2827693   . CCGTGGATGCGGGGACCCGCATCCCCTCTCCCTTCACAGCTGAGTGACCCACATCCCCTCTCCCCTCGCA  C . PASS  SVTYPE=DEL;END=2827680;BKPTID=Pindel_LCS_D1099159;HOMLEN=1;HOMSEQ=C;SVLEN=-66 GT:GQ 1/1:13.9

How to read it? From what I can see:

This is a deletion (SVTYPE=DEL)
The end position of the variant comes before the starting position (reverse strand?)
The reference starts from 2827693 to 2827680 (13 bases on the reverse strand)
The difference between reference and alternative is 66 bases (SVLEN=-66)

This doesn't sound right to me. For instance, I don't see where exactly the deletion starts. The SVLEN field says 66 bases deleted, but where? 2827693 to 2827680 only has 13 bases between.
Q: How to read the deletion correctly from this structural VCF record? Where is the missing 66-13=53 bases?

I just received a reply from 1000Genomes regarding this. I'll post it in its entirety below:

Looking at the example you mention, I find it difficult to come up with an
  interpretation of the information whereby the stated end seems to be correct,
  so believe that this may indeed be an error.
Since the v4.0 was created, however, new versions of VCF have been introduced,
  improving and correcting the specification. The current version is v4.3
  ( I believe the first record shown on
  page 11 provides an accurate example of this type of deletion.
I will update the web page to include this information.

So we can take this as official confirmation that we were all correct in suspecting the example was just wrong.


Question:
If an observer starts moving at relativistic speeds will he observe the temperature of objects to change as compared to their rest temperatures?
Suppose the rest temperature measured is $T$ and the observer starts moving with speed $v$. What will be the new temperature observed by him?

This is a very good question. Einstein himself, in a 1907 review (available in translation as Am. J. Phys. 45, 512 (1977), e.g. here), and Planck, one year later, assumed the first and second law of thermodynamics to be covariant, and derived from that the following transformation rule for the temperature:
$$
T' = T/\gamma, \quad \gamma = \sqrt{1/(1-v^2/c^2)}.
$$
So, an observer would see a system in relativistic motion "cooler" than if he were in its rest frame.
However, in 1963 Ott (Z. Phys. 175 no. 1 (1963) 70) proposed as the appropriate transformation
$$
T' = \gamma T
$$
suggesting that a moving body appears "relatively" warmer.
Later on Landsberg (Nature 213 (1966) 571 and 214 (1967) 903) argued that the thermodynamic quantities that are statistical in nature, such as temperature, entropy and internal energy, should not be expected to change for an observer who sees the center of mass of the system moving uniformly.
This approach, leads to the conclusion that some thermodynamic relationships such as the second law are not covariant and results in the transformation rule:
$$
T' = T
$$
So far it seems there isn't a general consensus on which is the appropriate transformation, but I may be not aware of some "breakthrough" experiment on the topic.
Main reference:

M.Khaleghy, F.Qassemi. Relativistic Temperature Transformation Revisited, One hundred years after Relativity Theory (2005). arXiv:physics/0506214.


Question:
I've been checking life expectancy figures for men versus women in many countries of the world and the figures for men sometimes are terrifying. Countries like Russia have a 12 years gap in disfavor of men. Developed countries have usually a 4-5 years gap in disfavor of men. My country Argentina has a 7 years gap. African countries and middle east countries where supposedly women have a harder life because of religion have usually a 3 years gap in disfavor of men. So far I haven't found a single country where men lives more than women.
Now I know there are more men than women who dies in homicides, suicides, work accidents, wars, etc. men are more likely to get addictions because of depression, etc. but aside of all that, is there any biological reason why men lives less than women everywhere?

There are both biological and  social factor for that:
Biological

Females have two X chromosomes. When mutations in genes of the X chromosome occur, females have a second X to compensate. Males, on the other hand gave just one chromosome X and all genes its genes express themselves, even those lethal or deleterious.
Females have better resistance to biological aging and hormones and the role of women in reproduction are known to be associated to greater longevity (e.g. estrogen offers some protection against heart disease because it facilitates elimination of bad cholesterol while testosterone has been linked to violence and risk taking).
The female body evolved to accommodate the needs of pregnancy and breast feeding hence deals better with making reservation. This ability has been linked to a female's better ability to cope with overeating and eliminating excess food

Social
This "advantage" women seem to have was once nullified by the status and life conditions they had back then, as the risks and the burden of pregnancy and the lack of attention to health and rights women had in a way more misogynist world.
Given the economic, social and political changes that the world experienced, a general progress in female life conditions took place and women have not only regained their biological advantage, but have gone beyond it, achieving higher life expectation. Social and comportamental factor are involved in this higher longevity:

Women tend to engage in fewer risky and bad for health behaviors than men do, e.g. men have more problems than women with alcoholism, smoking and road accidents.
The world is still very sexist and the gender roles to be played would expose men to higher risks. Regarding to work, for instance, although women nowadays participate in the work force, their professional activities remain different and are less prejudicial to their health (on average).
Also regarding to  very sexist gender roles, men are expected to be strong and manly and powerful and women are expected to be gracious young and beautiful. As a result of that, women are more attentive to their body and health, engage themselves in more healthy activities and benefit more from medicine and science. Men on the other hand submit their bodies to challenges from early ages and tend to neglect their bodies needs.

You can have access to detailed statistics (male/female, country by country, life expectancy and other health data) here:

And also, read more about the issue here:


Question:
As far as I understand, both SURF and SIFT are patent protected.
Are there any alternative methods that can be used in a commercial application freely?
For more info on the patent check out:

Both SIFT and SURF authors require license fees for usage of their original algorithms.
I have done some research about the situation and here are the possible alternatives:
Keypoint detector:

Harris corner detector
Harris-Laplace - scale-invariant version of Harris detector (an affine invariant version also exists, presented by Mikolajczyk and Schmidt, and I believe is also patent free).
Multi-Scale Oriented Patches (MOPs) - athough it is patented, the detector is basically the multi-scale Harris, so there would be no problems with that (the descriptor is 2D wavelet-transformed image patch)
LoG filter - since the patented SIFT uses DoG (Difference of Gaussian) approximation of LoG (Laplacian of Gaussian) to localize interest points in scale, LoG alone can be used in modified, patent-free algorithm, tough the implementation could run a little slower
FAST
BRISK (includes a descriptor)
ORB (includes a descriptor)
KAZE - free to use, M-SURF descriptor (modified for KAZE's nonlinear scale space), outperforms both SIFT and SURF
A-KAZE - accelerated version of KAZE, free to use, M-LDB descriptor (modified fast binary descriptor)

Keypoint descriptor:

Normalized gradient - simple, working solution
PCA transformed image patch
Wavelet transformed image patch - details are given in MOPs paper, but can be implemented differently to avoid the patent issue (e.g. using different wavelet basis or different indexing scheme)
Histogram of oriented gradients
GLOH
LESH
BRISK
ORB
FREAK
LDB

Note that if you assign orientation to the interest point and rotate the image patch accordingly, you get rotational invariance for free. Even Harris corners are rotationally invariant and the descriptor may be made so as well.
Some more complete solution is done in Hugin, because they also struggled to have a patent-free interest point detector.


Question: Is there a way, using some established Python package (e.g. SciPy) to define my own probability density function (without any prior data, just $f(x) = a x + b$), so I can then make calculations with it (such as obtaining the variance of the continuous random variable)? Of course I could take, say, SymPy or Sage, create a symbolic function and do the operations, but I'm wondering whether instead of doing all this work myself I can make use of an already-implemented package.

You have to subclass the rv_continuous class in scipy.stats
import scipy.stats as st

class my_pdf(st.rv_continuous):
    def _pdf(self,x):
        return 3*x**2  # Normalized over its range, in this case [0,1]

my_cv = my_pdf(a=0, b=1, name='my_pdf')

now my_cv is a continuous random variable with the given PDF and range [0,1]
Note that in this example my_pdf and my_cv are arbitrary names (that could have been anything), but _pdf is not arbitrary; it and _cdf are methods in st.rv_continuous one of which must be overwritten in order for the subclassing to work.


Question:
I have a signal of some length, say 1000 samples. I would like to extend this signal to 5000 samples, sampled at the same rate as the original (i.e., I want to predict what the signal would be if I continued to sample it for a longer period of time). The signal is composed of several sinusoidal components added together.
The method that first came to me was to take the entire FFT, and extend it, but this leaves a very strong discontinuity at frame 1001. I've also considered only using the part of the spectrum near the peaks, and while this seems to improve the signal somewhat, it doesn't seem to me that the phase is guaranteed to be correct. What is the best method for extending this signal?
Here's some MATLAB code showing an idealized method of what I want. Of course, I won't know beforehand that there are exactly 3 sinusoidal components, nor their exact phase and frequency. I want to make sure that the function is continuous, that there isn't a jump as we move to point 501,
vals = 1:50;
signal = 100+5*sin(vals/3.7+.3)+3*sin(vals/1.3+.1)+2*sin(vals/34.7+.7); % This is the measured signal
% Note, the real signal will have noise and not be known exactly.
output_vals = 1:200;
output_signal = 100+5*sin(output_vals/3.7+.3)+3*sin(output_vals/1.3+.1)+2*sin(output_vals/34.7+.7); % This is the output signal

figure;
plot(output_signal);
hold all;
plot(signal);

Basically, given the green line, I want to find the blue line.

I think linear predictive coding (otherwise known as an auto-regressive moving average) is what you are looking for.  LPC extrapolates a time series by first fitting a linear model to the time series, in which each sample is assumed to be a linear combination of previous samples.  After fitting this model to the existing time series, it can be run forward to extrapolate further values while maintaining a stationary(?) power spectrum.
Here is a little example in Matlab, using the lpc function to estimate the LPC coefficients.
N = 150;    % Order of LPC auto-regressive model
P = 500;    % Number of samples in the extrapolated time series
M = 150;    % Point at which to start predicting

t = 1:P;

x = 5*sin(t/3.7+.3)+3*sin(t/1.3+.1)+2*sin(t/34.7+.7); %This is the measured signal

a = lpc(x, N);

y = zeros(1, P);

% fill in the known part of the time series
y(1:M) = x(1:M);

% in reality, you would use `filter` instead of the for-loop
for ii=(M+1):P
    y(ii) = -sum(a(2:end) .* y((ii-1):-1:(ii-N)));
end

plot(t, x, t, y);
l = line(M*[1 1], get(gca, 'ylim'));
set(l, 'color', [0,0,0]);
legend('actual signal', 'extrapolated signal', 'start of extrapolation');

Of course, in real code you would use filter to implement the extrapolation, by using the LPC coefficients a as an IIR filter and pre-loading the known timeseries values into the filter state; something like this:
% Run the initial timeseries through the filter to get the filter state
[~, zf] = filter(-[0 a(2:end)], 1, x(1:M));

% Now use the filter as an IIR to extrapolate
y((M+1):P) = filter([0 0], -a, zeros(1, P-M), zf);

Here is the output:

It does a reasonable job, though the prediction dies off with time for some reason.
I don't actually know much about AR models and would also be curious to learn more.
--
EDIT: @china and @Emre are right, the Burg method appears to work much better than LPC.  Simply by changing lpc to arburg in the above code yields the following results:

The code is available here:


Question:
What would be the ideal way to find the mean and standard deviation of a signal for a real time application.  I'd like to be able to trigger a controller when a signal was more than 3 standard deviation off of the mean for a certain amount of time.
I'm assuming a dedicated DSP would do this pretty readily, but is there any "shortcut" that may not require something so complicated?

There's a flaw in Jason R's answer, which is discussed in Knuth's "Art of Computer Programming" vol. 2. The problem comes if you have a standard deviation which is a small fraction of the mean: the calculation of E(x^2) - (E(x)^2) suffers from severe sensitivity to floating point rounding errors.
You can even try this yourself in a Python script:
ofs = 1e9
A = [ofs+x for x in [1,-1,2,3,0,4.02,5]]
A2 = [x*x for x in A]
(sum(A2)/len(A))-(sum(A)/len(A))**2

I get -128.0 as an answer, which clearly isn't computationally valid, since the math predicts that the result should be nonnegative.
Knuth cites an approach (I don't remember the name of the inventor) for calculating running mean and standard deviation which goes something like this:
 initialize:
    m = 0;
    S = 0;
    n = 0;

 for each incoming sample x:
    prev_mean = m;
    n = n + 1;
    m = m + (x-m)/n;
    S = S + (x-m)*(x-prev_mean);

and then after each step, the value of m is the mean, and the standard deviation can be calculated as sqrt(S/n) or sqrt(S/n-1) depending on which is your favorite definition of standard deviation.
The equation I write above is slightly different than the one in Knuth, but it's computationally equivalent.
When I have a few more minutes, I'll code up the above formula in Python and show that you'll get a nonnegative answer (that hopefully is close to the correct value).

update: here it is.
test1.py:
import math

def stats(x):
  n = 0
  S = 0.0
  m = 0.0
  for x_i in x:
    n = n + 1
    m_prev = m
    m = m + (x_i - m) / n
    S = S + (x_i - m) * (x_i - m_prev)
  return {'mean': m, 'variance': S/n}

def naive_stats(x):
  S1 = sum(x)
  n = len(x)
  S2 = sum([x_i**2 for x_i in x])
  return {'mean': S1/n, 'variance': (S2/n - (S1/n)**2) }

x1 = [1,-1,2,3,0,4.02,5]
x2 = [x+1e9 for x in x1]

print "naive_stats:"
print naive_stats(x1)
print naive_stats(x2)

print "stats:"
print stats(x1)
print stats(x2)

result:
naive_stats:
{'variance': 4.0114775510204073, 'mean': 2.0028571428571427}
{'variance': -128.0, 'mean': 1000000002.0028572}
stats:
{'variance': 4.0114775510204073, 'mean': 2.0028571428571431}
{'variance': 4.0114775868357446, 'mean': 1000000002.0028571}

You'll note that there's still some rounding error, but it's not bad, whereas naive_stats just pukes.

edit: Just noticed Belisarius's comment citing Wikipedia which does mention the Knuth algorithm.


Question:
I've been using Ruby to write scripts for research, but I want to get into some heavier stuff that Ruby is just too slow for. I noticed there are a few things written in C and C++, but there is an oddly large proportion of software used in computational chemistry that is written in FORTRAN (in which I have zero experience.)
Why is FORTRAN used in computational chemistry? From what I understand, FORTRAN is kind of on the ancient side (“punchcard” old.) I was a bit shocked to find fairly recently written tutorials for FORTRAN.
Is it a sort of, "this is how we've always done it," thing or is there an efficiency aspect to FORTRAN I'm overlooking?
Note: I may have FORTRAN confused with later programming languages with similar names.

I don't think that's really true anymore.
Some Fortran use is historical (i.e., early codes were developed in FORTRAN because that was the best programming language for number crunching in the 70s and 80s). Heck, the name stands for "formula translation."
Some Fortran use is because of performance. The language was designed to be:

especially suited to numeric computation and scientific computing.

Many times, I find chemistry coders sticking to Fortran because they know it and have existing highly optimized numeric code-bases.
I think the performance side isn't necessarily true anymore when using modern, highly optimizing C and C++ compilers.
I write a lot of code in C and C++ for performance and glue a lot of things with Python. I know some quantum programs are written exclusively or primarily in C++. Here are a few open source examples:

Psi4 - Written in C++ and Python
MPQC - Written in C++
LibInt - Written in C++ for efficient quantum integrals.
LibXC - Written in C with Fortran "bindings" for DFT exchange-correlation functionals

This is my opinion, but my recommendation for faster performance in chemistry would be Python with some C or C++ mixed in.
I find I'm more efficient coding in Python, partly because of the language, partly because of the many packages, partly since I don't have to compile, and that's all important.
Also, you can run Python scripts and functions in parallel, on the GPU, and even compile them, e.g. with Numba. As I said, if I think performance is crucial, I'll write pieces in C or usually C++ and link to Python as needed.


Question: Millions of colors in the visible spectrum can be generated by mixing red, green and blue - the RGB color system. Is there a basic set of smells that, when mixed, can yield all, or nearly all detectable smells ?

There are about 100 (Purves, 2001) to 400 (Zozulya et al., 2001) functional olfactory receptors in man. While the total tally of olfactory receptor genes exceeds 1000, more than half of them are inactive pseudogenes. The combined activity of the expressed functional receptors accounts for the number of distinct odors that can be discriminated by the human olfactory system, which is estimated to be about 10,000 (Purves, 2001).
Different receptors are sensitive to subsets of chemicals that define a “tuning curve.” Depending on the particular olfactory receptor molecules they contain, some olfactory receptor neurons exhibit marked selectivity to particular chemical stimuli, whereas others are activated by a number of different odorant molecules. In addition, olfactory receptor neurons can exhibit different thresholds for a particular odorant. How these olfactory responses encode a specific odorant is a complex issue that is unlikely to be explained at the level of the primary neurons (Purves, 2001).
So in a way, the answer to your question is yes, as there are approximately 100 to 400 olfactory receptors. Just like the photoreceptors in the visual system, each sensory neuron in the olfactory epithelium in the nose expresses only a single receptor gene (Kimball). In the visual system for color vision there are just three (red, green and blue cones - RGB) types of sensory neurons, so it's a bit more complicated in olfaction.
References
- Purves et al, Neuroscience, 2nd ed. Sunderland (MA): Sinauer Associates; 2001
- Zozulya et al., Genome Biol (2001); 2(6): research0018.1–0018.12
Sources
- Kimball's Biology Pages


Question: I read the Wikipedia entry about "List of NP-complete problems" and found that games like super mario, pokemon, tetris or candy crush saga are np-complete. How can I imagine np-completeness of a game?  Answers don't need to be too precise. I just want to get an overview what it means that games can be np-complete.

It just means that you can create levels or puzzles within these games that encode NP-Hard problems. You can take a graph coloring problem, create an associated Super Mario Bros. level, and that level is beatable if and only if the graph is 3-colorable.
If you want to see the specific way the NP-Complete problems are translated into the games, I recommend the paper "Classic Nintendo Games are (Computationally) Hard". It's well written and easy to follow.
An important caveat to keep in mind is that the NP-hardness requires generalizing the games in "obvious" ways. For example, Tetris normally has a fixed size board but the hardness proof requires the game to allow arbitrarily large boards. Another example is off-screen enemies in Super Mario Bros: the proof is for a variant of the game where off-screen enemies continue moving as if they were onscreen, instead of ceasing to exist and being reset to their starting position when Mario comes back.


Question:
I have noticed that some applications or algorithms that are built on a programming language, say C++/Rust run faster or snappier than those built on say, Java/Node.js, running on the same machine. I have a few question regarding this:

Why does this happen?
What governs the "speed" of a programming language?
Has this anything to do with memory management?

I'd really appreciate if someone broke this down for me.

In programming language design and implementation, there is a large number of choices that can affect performance. I'll only mention a few.
Every language ultimately has to be run by executing machine code. A "compiled" language such as C++ is parsed, decoded, and translated to machine code only once, at compile-time. An "interpreted" language, if implemented in a direct way, is decoded at runtime, at every step, every time. That is, every time we run a statement, the intepreter has to check whether that is an if-then-else, or an assignment, etc. and act accordingly. This means that if we loop 100 times, we decode the same code 100 times, wasting time. Fortunately, interpreters often optimize this through e.g. a just-in-time compiling system. (More correctly, there's no such a thing as a "compiled" or "interpreted" language -- it is a property of the implementation, not of the language. Still, each language often has one widespread implementation, only.)
Different compilers/interpreters perform different optimizations.
If the language has automatic memory management, its implementation has to perform garbage collection. This has a runtime cost, but relieves the programmer from an error-prone task.
A language might be closer to the machine, allowing the expert programmer to micro-optimize everything and squeeze more performance out of the CPU. However, it is arguable if this is actually beneficial in practice, since most programmers do not really micro-optimize, and often a good higher level language can be optimized by the compiler better than what the average programmer would do.
(However, sometimes being farther from the machine might have its benefits too! For instance, Haskell is extremely high level, but thanks to its design choices is able to feature very lightweight green threads.)
Static type checking can also help in optimization. In a dynamically typed, interpreted language, every time one computes x - y, the interpreter often has to check whether both x,y are numbers and (e.g.) raise an exception otherwise. This check can be skipped if types were already checked at compile time.
Some languages always report runtime errors in a sane way. If you write a[100] in Java where a has only 20 elements, you get a runtime exception. This requires a runtime check, but provides a much nicer semantics to the programmer than in C, where that would cause undefined behavior, meaning that the program might crash, overwrite some random data in memory, or even perform absolutely anything else (the ISO C standard poses no limits whatsoever).
However, keep in mind that, when evaluating a language, performance is not everything. Don't be obsessed about it. It is a common trap to try to micro-optimize everything, and yet fail to spot that an inefficient algorithm/data structure is being used. Knuth once said "premature optimization is the root of all evil".
Don't underestimate how hard it is to write a program right. Often, it can be better to choose a "slower" language which has a more human-friendly semantics. Further, if there are some specific performance critical parts, those can always be implemented in another language. Just as a reference, in the 2016 ICFP programming contest, these were the languages used by the winners:
1   700327  Unagi                       Java,C++,C#,PHP,Haskell
2   268752  天羽々斬                     C++, Ruby, Python, Haskell, Java, JavaScript
3   243456  Cult of the Bound Variable  C++, Standard ML, Python

None of them used a single language.


Question:
Last year, I read a blog post from Brendan O'Connor entitled "Statistics vs. Machine Learning, fight!" that discussed some of the differences between the two fields.  Andrew Gelman responded favorably to this:
Simon Blomberg:

From R's fortunes
package: To paraphrase provocatively,
'machine learning is statistics minus
any checking of models and
assumptions'.
-- Brian D. Ripley (about the difference between machine learning
and statistics) useR! 2004, Vienna
(May 2004) :-) Season's Greetings!

Andrew Gelman:

In that case, maybe we should get rid
of checking of models and assumptions
more often. Then maybe we'd be able to
solve some of the problems that the
machine learning people can solve but
we can't!

There was also the "Statistical Modeling: The Two Cultures" paper by Leo Breiman in 2001 which argued that statisticians rely too heavily on data modeling, and that machine learning techniques are making progress by instead relying on the predictive accuracy of models.
Has the statistics field changed over the last decade in response to these critiques?  Do the two cultures still exist or has statistics grown to embrace machine learning techniques such as neural networks and support vector machines?

I think the answer to your first question is simply in the affirmative. Take any issue of Statistical Science, JASA, Annals of Statistics of the past 10 years and you'll find papers on boosting, SVM, and neural networks, although this area is less active now. Statisticians have appropriated the work of Valiant and Vapnik, but on the other side, computer scientists have absorbed the work of Donoho and Talagrand. I don't think there is much difference in scope and methods any more. I have never bought Breiman's argument that CS people were only interested in minimizing loss using whatever works. That view was heavily influenced by his participation in Neural Networks conferences and his consulting work; but PAC, SVMs, Boosting have all solid foundations. And today, unlike 2001, Statistics is more concerned with finite-sample properties, algorithms and massive datasets.
But I think that there are still three important differences that are not going away soon.

Methodological Statistics papers are still overwhelmingly formal and deductive, whereas Machine Learning researchers are more tolerant of new approaches even if they don't come with a proof attached;
The ML community primarily shares new results and publications in conferences and related proceedings, whereas statisticians use journal papers. This slows down progress in Statistics and identification of star researchers. John Langford has a nice post on the subject from a while back;
Statistics still covers areas that are (for now) of little concern to ML, such as survey design, sampling, industrial Statistics etc.


Question:
When you look at all the genome files available from Ensembl. You are presented with a bunch of options. Which one is the best to use/download?
You have a combination of choices.
First part options:

dna_sm - Repeats soft-masked (converts repeat nucleotides to lowercase)
dna_rm - Repeats masked (converts repeats to to N's)
dna - No masking

Second part options:

.toplevel - Includes haplotype information (not sure how aligners deal with this)
.primary_assembly - Single reference base per position

Right now I usually use a non-masked primary assembly for analysis, so in the case of humans:
Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
Does this make sense for standard RNA-Seq, ChIP-Seq, ATAC-Seq, CLIP-Seq, scRNA-Seq, etc... ?
In what cases would I prefer other genomes? Which tools/aligners take into account softmasked repeat regions?

There's rarely a good reason to use a hard-masked genome (sometimes for blast, but that's it). For that reason, we use soft-masked genomes, which only have the benefit of showing roughly where repeats are (we never make use of this for our *-seq experiments, but it's there in case we ever want to).
For primary vs. toplevel, very few aligners can properly handle additional haplotypes. If you happen to be using BWA, then the toplevel assembly would benefit you, but only if you use a dedicated wrapper to handle the ALT information, see bwakit. If you use BWA (bwa-mem) right from the command line without this wrapper then do not use the toplevel assembly. For STAR/hisat2/bowtie2/BBmap/etc. the haplotypes will just cause you problems due to increasing multimapper rates incorrectly. Note that none of these actually use soft-masking.


Question:
The following equation is standard in thermodynamics:
$$
\Delta G^\circ=-RT\log(K)
$$
where $K$ is the equilibrium constant.  In dimensional analysis, Bridgman's theorem tells us that the argument of a transcendental function (like $\log$) must always be dimensionless.  But $K$ may have dimensions (depending on the particular equilibrium).  Why is this OK?

Note: working out dimensions explicitly gives:
\begin{align}
[R]&=EN^{-1}\Theta^{-1}\\
[T]&=\Theta\\
[\Delta G^\circ]&=EN^{-1}
\end{align}
where $\Theta$ is the dimensions of temperature, $N$ is the dimensions of number and $E$ = dimensions of energy = $MLT^{-2}$.  From these, we see that the quantity $\log(K)$ ought to be dimensionless, implying that $K$ should be dimensionless as well.  But it isn't always.
Furthermore, suppose $K$ has dimensions $NL^{-3}$ (for an equilibrium of the form $A+B\leftrightarrow AB$, say).  Suppose now that we scale the units for number by a factor $a$.  Then we get new values for $K,R,\Delta G^\circ$, given by:
\begin{align}
\hat K&=K/a\\
\hat R&=aR\\
\hat{\Delta G^\circ}&=a\Delta G^\circ
\end{align}
From our original equation:
\begin{align}
\Delta G^\circ&=-RT\log(K)\\
a\Delta G^\circ&=-aRT\log(K)\\
\hat{\Delta G^\circ}&=-\hat RT\log(a\hat K)\\
\hat{\Delta G^\circ}&=-\hat RT\log(\hat K)-\hat RT\log(a)
\end{align}
So the new quantities do not satisfy the old equation.  Rather, they satisfy the old equation, but with a constant factor of $-\hat RT\log(a)$ added on.  What is going on here?

The problem is that people are often sloppy with the definition of quantities. The equilibrium constant $K$ in your first equation is indeed a dimensionless quantity while the equilibrium constant $K_c$ that is usually used to describe an equilibrium in a solution is not. I will take some detour to show where they come from and how they are connected.
From thermodynamics it is known that the Gibbs free energy of reation is given by
\begin{equation}
 \Delta G = \left( \frac{\partial G}{\partial \xi} \right)_{p,T} = \sum \nu_{i} \mu_{i} \ ,
\end{equation}
where $\xi$ is the extent of reaction and $\nu_{i}$ and $\mu_{i}$ are the stochiometric coefficient and the chemical potential of the $i^{\text{th}}$ component in the reaction, respectively.
Now, imagine the situation for a ideal system consisting of two phases, one purely consisting of component $i$ and the other being a mixed phase comprised of components $1, 2, \dots, k$, in equilibrium.
Since the system is in equilibrium and shows ideal behavior we know that the chemical potential of component $i$ in the mixed phase (having the temperature $T$ and the total pressure $p$), $\mu_{i}(p, T)$, must be equal to the chemical potential, $\mu^{*}_{i}(p_{i}, T)$, of the pure phase having the same temperature but a different pressure $p_{i}$, whereby $p_{i}$ is equal to the partial pressure of component $i$ in the mixed phase, namely
\begin{equation}
 \mu_{i}(p, T)= \mu^{*}_{i}(p_{i}, T).
\end{equation}
From Maxwell's relations it is known that
\begin{equation}
 \left( \frac{\partial \mu^{*}_{i}}{\partial p} \right)_{T} = \left( \frac{\partial}{\partial p} \biggl(\frac{\partial G^{*}}{\partial n_{i}}\biggr) \right)_{T} = \Biggl( \frac{\partial}{\partial n_{i}} \underbrace{\biggl(\frac{\partial G^{*}_{i}}{\partial p}\biggr)}_{=\, V_{i}} \Biggr)_{T} = \left( \frac{\partial V_{i}}{\partial n_{i}} \right)_{T}
\end{equation}
but since $\mu^{*}_{i}$ is associated with a pure phase, $\left( \frac{\partial V_{i}}{\partial n_{i}} \right)_{T}$ can be simplified to
\begin{equation}
 \left(\frac{\partial V_{i}}{\partial n_{i}} \right)_{T} = \frac{V_{i}}{n_{i}} = v_{i}
\end{equation}
and one gets
\begin{equation}
 \left( \frac{\partial \mu^{*}_{i}}{\partial p} \right)_{T} = v_{i} \ ,
\end{equation}
where $p$ is the total pressure and $v_i$ is the molar volume of the $i^{\text{th}}$ component in the pure phase.
Substituting $v_{i}$ via the ideal gas law and subsequently integrating this equation w.r.t. pressure using the total pressure $p$ as the upper and the partial pressure $p_{i}$ as the lower bound for the integration we get
\begin{equation}
 \int^{\mu^{*}_{i}(p)}_{\mu^{*}_{i}(p_{i})} \mathrm{d} \mu^{*}_{i} = \int_{p_{i}}^{p} \underbrace{v_{i}}_{=\frac{RT}{p}} \mathrm{d} p = R T \int_{p_{i}}^{p} \frac{1}{p} \mathrm{d} p = RT \int_{p_{i}}^{p} \mathrm{d} \ln p   \ ,
\end{equation}
so that, introducing the mole fraction $x_{i}$,
\begin{equation}
 \mu_{i}^{*} (p_{i}, T) = \mu_{i}^{*}(p, T) + RT \ln \Bigl(\underbrace{\frac{p_{i}}{p}}_{= x_{i}}\Bigr) = \mu_{i}^{*}(p, T) + RT \ln x_{i} \ .
\end{equation}
Please, note that there is a dimensionless quantity inside the logarithm.
Now, for real gases one has to adjust this equation a little bit: one has to correct the pressure for the errors introduced by the interactions present in real gases. Thus, one introduces the (dimensionless) activity $a_{i}$ by scaling the pressure with the (dimensionless) fugacity coefficient $\varphi_{i}$
\begin{equation}
a_{i} = \frac{\varphi_{i} p_{i}}{p^0}
\end{equation}
where $p^{0}$ is the standard pressure for which $\varphi_{i}=1$ by definition.
When this is in turn substituted into the equilibrium equation, whereby the total pressure is chosen to be the standard pressure $p = p^{0}$, the following equation arises
\begin{equation}
 \mu_{i} (p, T) = \underbrace{\mu_{i}^{*}(p^{0}, T)}_{= \, \mu_{i}^{0}} + RT \ln a_{i} \ .
\end{equation}
Substituting all this togther in our equation for $\Delta G$ and noting that the sum of logarithms can be written as a logarithm of products, $\sum_{i} \ln i = \ln \prod_i i$, one gets
\begin{equation}
 \Delta G = \underbrace{\sum_i \nu_{i} \mu_{i}^{0}}_{= \, \Delta G^{0}} + RT \underbrace{\sum_i \nu_{i} \ln a_{i}}_{= \, \ln \prod_{i} [a_{i}]^{\nu_{i}}} = \Delta G^{0} + RT \ln \prod_{i} [a_{i}]^{\nu_{i}} \ ,
\end{equation}
where the standard Gibbs free energy of reaction $\Delta G^{0}$ has been introduced by asserting that the system is under standard pressure.
Now, we are nearly finished. One only has to note that $\Delta G = 0$ since the system is in equilibrium and then one can introduce the equilibrium constant $K$, so that
\begin{equation}
\ln \underbrace{\prod_i [a_{i}]^{\nu_{i}}}_{= \, K} = -\frac{\Delta G^{0}}{RT} \qquad \Rightarrow \qquad \ln K = -\frac{\Delta G^{0}}{RT} \ .
\end{equation}
So, you see this quantity is dimensionless. The problem is that activities are hard to come by. Concentrations $c_{i}$ or pressures are much easier to measure. So, what one does now, is to introduce a different equilibrium constant
\begin{equation}
 K_{c} = \prod_i [c_{i}]^{\nu_{i}} \ .
\end{equation}
which is much easier to measure since it depends on concentrations rather than activities. It is not dimensionless but being connected with the "real" dimensionless equilibrium constant via
\begin{equation}
 K = \prod_i [\varphi_{i}]^{\nu_{i}} \left(\frac{RT}{p^{0}}\right)^{\sum_i \nu_{i}} K_{c} \ .
\end{equation}
it is more or less proportional to $K$ and thus gives qualitatively the same information.
Edit: If the solution at hand behaves like an ideal solution then by definition it's activity/fugacity coefficient is equal to one. Furthermore the state of ideality is defined with respect to standard states: for an ideal solution this is $c^{\ominus} = 1 \, \text{mol}/\text{L}$. Using this together with the ideal gas law on the relation between $K$ and $K_{c}$
\begin{equation}
 K = \prod_i [\underbrace{\varphi_{i}}_{= \, 1}]^{\nu_{i}} \Bigl(\underbrace{\frac{RT}{p^{0}}}_{\substack{= \, 1/c^{\ominus} \, = \, 1 \, \text{L} / \text{mol} \\ \text{per definition}}}\Bigr)^{\sum_i \nu_{i}} K_{c} \qquad \Rightarrow \qquad K = \left(\frac{L}{\text{mol}} \right)^{\sum_i \nu_{i}} K_{c} \ .
\end{equation}
one sees that for an ideal solution $K_{c}$ is identical to $K$ scaled by a dimensional prefactor.
Edit: I forgot to mention there are also "versions" of the equilibrium constants that are defined in terms of partial pressures or mole fractions which provide a more suitable description for gas equlibria but all those "versions" can be traced back to the original equilibrium constant.


Question:
In this MO post, I ran into the following family of polynomials: $$f_n(x)=\sum_{m=0}^{n}\prod_{k=0}^{m-1}\frac{x^n-x^k}{x^m-x^k}.$$
In the context of the post, $x$ was a prime number, and $f_n(x)$ counted the number of subspaces of an $n$-dimensional vector space over $GF(x)$ (which I was using to determine the number of subgroups of an elementary abelian group $E_{x^n}$).
Anyway, while I was investigating asymptotic behavior of $f_n(x)$ in Mathematica, I got sidetracked and (just for fun) looked at the set of complex roots when I set $f_n(x)=0$.  For $n=24$, the plot looked like this: (The real and imaginary axes are from $-1$ to $1$.)

Surprised by the unusual symmetry of the solutions, I made the same plot for a few more values of $n$.  Note the clearly defined "tails" (on the left when even, top and bottom when odd) and "cusps" (both sides).

You can see that after approximately $n=60$, the "circle" of solutions starts to expand into a band of solutions with a defined outline.  To fully absorb the weirdness of this, I animated the solutions from $n=2$ to $n=112$. The following is the result:

Pretty weird, right!?  Anyhow, here are my questions:

First, has anybody ever seen anything at all like this before?
What's up with those "tails?"  They seem to occur only on even $n$, and they are surely distinguishable from the rest of the solutions.
Look how the "enclosed" solutions rotate as $n$ increases.  Why does this happen? [Explained in edits.]
Anybody have any idea what happens to the solution set as $n\rightarrow \infty$?
  Thanks to @WillSawin, we now know that all the roots are contained in an annulus that converges to the unit circle, which is fantastic.  So, the final step in understanding the limit of the solution sets is figuring out what happens on the unit circle.  We can see from the animation that there are many gaps, particularly around certain roots of unity; however, they do appear to be closing.

The natural question is, which points on the unit circle "are roots in the limit"? In other words, what are the accumulation points of $\{z\left|z\right|^{-1}:z\in\mathbb{C}\text{ and }f_n(z)=0\}$?
Is the set of accumulation points dense?  @NoahSnyder's heuristic of considering these as a random family of polynomials suggests it should be- at least, almost surely.

These are polynomials in $\mathbb{Z}[x]$.  Can anybody think of a way to rewrite the formula (perhaps recursively?) for the simplified polynomial, with no denominator?  If so, we could use the new formula to prove the series converges to a function on the unit disc, as well as cut computation time in half. [See edits for progress.]
Does anybody know a numerical method specifically for finding roots of high degree polynomials?  Or any other way to efficiently compute solution sets for high $n$? [Thanks @Hooked!]

Thanks everyone.  This may not turn out to be particularly mathematically profound, but it sure is neat.

EDIT: Thanks to suggestions in the comments, I cranked up the working precision to maximum and recalculated the animation.  As Hurkyl and mercio suspected, the rotation was indeed a software artifact, and in fact evidently so was the thickening of the solution set.  The new animation looks like this:

So, that solves one mystery: the rotation and inflation were caused by tiny roundoff errors in the computation.  With the image clearer, however, I see the behavior of the cusps more clearly.  Is there an explanation for the gradual accumulation of "cusps" around the roots of unity?  (Especially 1.)

EDIT: Here is an animation $Arg(f_n)$ up to $n=30$.  I think we can see from this that $f_n$ should converge to some function on the unit disk as $n\rightarrow \infty$.  I'd love to include higher $n$, but this was already rather computationally exhausting.

Now, I've been tinkering and I may be onto something with respect to point $5$ (i.e. seeking a better formula for $f_n(x)$).  The folowing claims aren't proven yet, but I've checked each up to $n=100$, and they seem inductively consistent.  Here denote $\displaystyle f_n(x)=\sum_{m}a_{n,m}x^m$, so that $a_{n,m}\in \mathbb{Z}$ are the coefficients in the simplified expansion of $f_n(x)$.

First, I found $\text{deg}(f_n)=\text{deg}(f_{n-1})+\lfloor \frac{n}{2} \rfloor$.  The solution to this recurrence relation is $$\text{deg}(f_n)=\frac{1}{2}\left({\left\lceil\frac{1-n}{2}\right\rceil}^2 -\left\lceil\frac{1-n}{2}\right\rceil+{\left\lfloor \frac{n}{2} \right\rfloor}^2 + \left\lfloor \frac{n}{2} \right\rfloor\right)=\left\lceil\frac{n^2}{4}\right\rceil.$$
If $f_n(x)$ has $r$ more coefficients than $f_{n-1}(x)$, the leading $r$ coefficients are the same as the leading $r$ coefficients of $f_{n-2}(x)$, pairwise.
When $n>m$, $a_{n,m}=a_{n-1,m}+\rho(m)$, where $\rho(m)$ is the number of integer partitions of $m$.  (This comes from observation, but I bet an actual proof could follow from some of the formulas here.)  For $n\leq m$ the $\rho(m)$ formula first fails at $n=m=6$, and not before for some reason.  There is probably a simple correction term I'm not seeing - and whatever that term is, I bet it's what's causing those cusps.

Anyhow, with this, we can make almost make a recursive relation for $a_{n,m}$,
$$a_{n,m}= \left\{
     \begin{array}{ll}
       a_{n-2,m+\left\lceil\frac{n-2}{2}\right\rceil^2-\left\lceil\frac{n}{2}\right\rceil^2} & : \text{deg}(f_{n-1}) < m \leq \text{deg}(f_n)\\
       a_{n-1,m}+\rho(m) & : m \leq \text{deg}(f_{n-1})  \text{ and } n > m \\
       ? & : m \leq \text{deg}(f_{n-1})  \text{ and } n \leq m
     \end{array}
   \right.
$$
but I can't figure out the last part yet.

EDIT:
Someone pointed out to me that if we write $\lim_{n\rightarrow\infty}f_n(x)=\sum_{m=0}^\infty b_{m} x^m$, then it appears that $f_n(x)=\sum_{m=0}^n b_m x^m + O(x^{n+1})$.  The $b_m$ there seem to me to be relatively well approximated by the $\rho(m)$ formula, considering the correction term only applies for a finite number of recursions.
So, if we have the coefficients up to an order of $O(x^{n+1})$, we can at least prove the polynomials converge on the open unit disk, which the $Arg$ animation suggests is true.  (To be precise, it looks like $f_{2n}$ and $f_{2n+1}$ may have different limit functions, but I suspect the coefficients of both sequences will come from the same recursive formula.)  With this in mind, I put a bounty up for the correction term, since from that all the behavior will probably be explained.

EDIT: The limit function proposed by Gottfriend and Aleks has the formal expression $$\lim_{n\rightarrow \infty}f_n(x)=1+\prod_{m=1}^\infty \frac{1}{1-x^m}.$$
I made an $Arg$ plot of $1+\prod_{m=1}^r \frac{1}{1-x^m}$ for up to $r=24$ to see if I could figure out what that ought to ultimately end up looking like, and came up with this:

Purely based off the plots, it seems not entirely unlikely that $f_n(x)$ is going to the same place this is, at least inside the unit disc.  Now the question is, how do we determine the solution set at the limit?  I speculate that the unit circle may become a dense combination of zeroes and singularities, with fractal-like concentric "circles of singularity" around the roots of unity...  :)

First, has anybody ever seen anything at all like this before?

Yes, and in fact the interesting patterns that arise here are more than just a mathematical curiosity, they can be interpreted to have a physical context.
Statistical Mechanics
In a simple spin system, say the Ising model, a discrete set of points are arranged on a grid. In physics, we like to define the energy of the system by the Hamiltonian, which gives the energy of any particular microstate. In this system, if the spins are aligned they form a bond. This favorable and the energy is negative. If they are misaligned, the energy is positive. Let's consider a simple system of two points, adjacent to each other. Furthermore, let each site point up (1) or down (-1). For an Ising-like system we would write the Hamiltonian as:
$$
H = - \sum_{ij} J \sigma_i \sigma_j
$$
where $\sigma_i$ is the spin of the $i$th point and the summation runs over all pairs of adjacent sites. $J$ is the strength of the bond (which we can set to one for our example).
In our simple system we have only four possible states:
0 - 0     H = -J
1 - 0     H =  0
0 - 1     H =  0
1 - 1     H = -J

Now we can write the partition function $\mathcal{Z}$, a term which encompasses all information of the Hamiltonian from the perspective of statistical mechanics:
$$
\mathcal{Z} = \sum_s \exp (H(s)/kT)
$$
Here the summation runs over all possible (micro)states of the system. The partition function is really useful as it is related to the free energy $A = -kT \ln{\mathcal{Z} }$. When the partition function goes to zero, the free energy explodes and this signifies a  phase change - a physically interesting event.
What about our simple system?
$$
\mathcal{Z} = 2 \exp({\beta J}) + 2 = 2x + 2
$$
You'll notice that I changed $x=\exp({\beta J})$ to make things a little neater. You may also notice that $\mathcal{Z}$ looks like polynomial. Which means if we want to find the interesting events in the system we find the zeros of the partition function $\mathcal{Z}=0$. This zero will correspond to a particular temperature $T$. In this case the only temperature we get is a complex one ...
Complex Temperatures?
Before you discount the idea that a temperature not on the real number line is impossible (and that $T<0$ is strange as well), let's see where this takes us. If we continue the to add sites to our simple little system, our polynomial will get a bit more complicated and we will find more roots on the complex plane. In fact, as we take ever more roots the points appear to form a pattern, much like the pattern you've shown above.
For a finite spin system, you'll never find a zero on the real axis, however...

Anybody have any idea what happens to the solution set as n→∞?

At the thermodynamic limit (which corresponds to an infinite number of sites) the points become dense on the plane. At this limit the points can touch the real axis (corresponding to a phase change in the system). For example, in the 2D Ising model the points do touch the real axis (and make a beautiful circle on the complex plane) where the system undergoes a phase transition from ordered to disordered.
Prior work
The study of these zeros (from a physics perspective) is fascinating and started with the seminal papers by Yang and Lee:
Yang, C. N.; Lee, T. D. (1952), "Statistical Theory of Equations of State and Phase Transitions. I. Theory of Condensation", Physical Review 87: 404–409, doi:10.1103/PhysRev.87.404
Lee, T. D.; Yang, C. N. (1952), "Statistical Theory of Equations of State and Phase Transitions. II. Lattice Gas and Ising Model", Physical Review 87: 410–419, doi:10.1103/PhysRev.87.410
Which are surprisingly accessible. For a good time, search for images of Yang-Lee zeros. In addition you can extend the fugacity to the complex plane, these are called the Fisher zeros and make even more complex patterns!


Question:
One of my friends said that I would die if I drank distilled water (we were using it in a chemistry experiment) I gave it a go and surprisingly did not die.
I did a bit of Googling and found this
It said that drinking only this kind of water could definitely cause death, as distilled water was highly hypotonic and it would make the blood cells expand and finally explode and ultimately cause death.
I wanted to know exactly how much of this water on an average was needed to be consumed to cause death.

I'm extremely skeptical of @leonardo's answer.  I suspect that what would happen if you drank only distilled water is nothing perceptible.  The only place where concentrations of distilled water would ever be high enough to conceivably matter is in the tissues of the mouth and throat, and even there, the effect would be temporary.
Compare drinking 8 glasses of either distilled or tap water every day.  With tap water, you're looking at less than 200 ppm of Mg, Na, K, and Ca combined.  That's less than 400mg of total mineral content per day.  Given that the combined RDA of all of those minerals is on the order of 7g for an adult male, this is not nothing, but it's certainly small.  Your dietary intake of these minerals probably varies by more than this daily, and your intestines, kidneys, sweat glands and mineral storage organs (like your bones and muscles) are constantly maintaining the mineral blood levels within a very narrow range, despite handling a throughput of several pounds of water and food daily.  They might have to work slightly harder to manage this range if you drank nothing but distilled water, but in a healthy adult, normal intakes already vary by more than this amount without major problems.  For example, the average American consumes more than 3.4 grams of sodium daily, while a low-sodium diet is on the order of 2g.  Low-sodium diets have been widely studied in the medical literature, and are considered safe.
As for pH, the lowered pH is caused by increased carbon-dioxide absorption to form carbonic acid.  Just as carbon dioxide is more soluble in distilled water, it is less soluble in stomach acid, and may be burped out.  Would you die of acidosis from drinking seltzer water all the time?  If that were the case, I'm sure there would be big health warnings about drinking soda, while it seems relatively benign. Furthermore, your body produces and excretes (through the lungs) around 1kg of CO2 daily, dwarfing any extra CO2 you might get by drinking distilled water.  If the small amounts of CO2 found in distilled water were dangerous, jogging would be invariably fatal.
If you were to drink nothing but distilled water, and eat no food, you probably would die of hyponatremia within a few weeks.  But you would also die of hyponatremia if you were to drink nothing but tap water, though perhaps slightly more slowly.


Question:
Artificial intelligence website defines off-policy and on-policy learning as follows:

"An off-policy learner learns the value of the optimal policy independently of the agent's actions. Q-learning is an off-policy learner. An on-policy learner learns the value of the policy being carried out by the agent including the exploration steps."

I would like to ask your clarification regarding this, because they don't seem to make any difference to me. Both the definitions seem like they are identical. What I actually understood are the model-free and model-based learning, and I don't know if they have anything to do with the ones in question.
How is it possible that the optimal policy is learned independently of the agent's actions? Isn't the policy learned when the agent performs the actions?

First of all, there's no reason that an agent has to do the greedy action;  Agents can explore or they can follow options.   This is not what separates on-policy from off-policy learning.
The reason that Q-learning is off-policy is that it updates its Q-values using the Q-value of the next state $s'$ and the greedy action $a'$.  In other words, it estimates the return (total discounted future reward) for state-action pairs assuming a greedy policy were followed despite the fact that it's not following a greedy policy.
The reason that SARSA is on-policy is that it updates its Q-values using the Q-value of the next state $s'$ and the current policy's action $a''$.  It estimates the return for state-action pairs assuming the current policy continues to be followed.
The distinction disappears if the current policy is a greedy policy.  However, such an agent would not be good since it never explores.
Have you looked at the book available for free online?  Richard S. Sutton and Andrew G. Barto. Reinforcement learning: An introduction. Second edition,
MIT Press, Cambridge, MA, 2018.


Question:
In the book Thomas's Calculus (11th edition) it is mentioned (Section 3.8 pg 225) that the derivative $\frac{\textrm{d}y}{\textrm{d}x}$ is not a ratio. Couldn't it be interpreted as a ratio, because according to the formula $\textrm{d}y = f'(x)\textrm{d}x$ we are able to plug in values for $\textrm{d}x$ and calculate a $\textrm{d}y$ (differential). Then if we rearrange we get $\frac{\textrm{d}y}{\textrm{d}x}$ which could be seen as a ratio.
I wonder if the author say this because $\mbox{d}x$ is an independent
variable, and $\textrm{d}y$ is a dependent variable, for $\frac{\textrm{d}y}{\textrm{d}x}$ to be a ratio both variables need to be independent.. maybe?

Historically, when Leibniz conceived of the notation, $\frac{dy}{dx}$ was supposed to be a quotient: it was the quotient of the "infinitesimal change in $y$ produced by the change in $x$" divided by the "infinitesimal change in $x$".
However, the formulation of calculus with infinitesimals in the usual setting of the real numbers leads to a lot of problems. For one thing, infinitesimals can't exist in the usual setting of real numbers! Because the real numbers satisfy an important property, called the Archimedean Property: given any positive real number $\epsilon\gt 0$, no matter how small, and given any positive real number $M\gt 0$, no matter how big, there exists a natural number $n$ such that $n\epsilon\gt M$. But an "infinitesimal" $\xi$ is supposed to be so small that no matter how many times you add it to itself, it never gets to $1$, contradicting the Archimedean Property. Other problems: Leibniz defined the tangent to the graph of $y=f(x)$ at $x=a$ by saying "Take the point $(a,f(a))$; then add an infinitesimal amount to $a$, $a+dx$, and take the point $(a+dx,f(a+dx))$, and draw the line through those two points." But if they are two different points on the graph, then it's not a tangent, and if it's just one point, then you can't define the line because you just have one point. That's just two of the problems with infinitesimals. (See below where it says "However...", though.)
So Calculus was essentially rewritten from the ground up in the following 200 years to avoid these problems, and you are seeing the results of that rewriting (that's where limits came from, for instance). Because of that rewriting, the derivative is no longer a quotient, now it's a limit:
$$\lim_{h\to0 }\frac{f(x+h)-f(x)}{h}.$$
And because we cannot express this limit-of-a-quotient as a-quotient-of-the-limits (both numerator and denominator go to zero), then the derivative is not a quotient.
However, Leibniz's notation is very suggestive and very useful; even though derivatives are not really quotients, in many ways they behave as if they were quotients. So we have the Chain Rule:
$$\frac{dy}{dx} = \frac{dy}{du}\;\frac{du}{dx}$$
which looks very natural if you think of the derivatives as "fractions". You have the Inverse Function theorem, which tells you that
$$\frac{dx}{dy} = \frac{1}{\quad\frac{dy}{dx}\quad},$$
which is again almost "obvious" if you think of the derivatives as fractions. So, because the notation is so nice and so suggestive, we keep the notation even though the notation no longer represents an actual quotient, it now represents a single limit.  In fact, Leibniz's notation is so good, so superior to the prime notation and to Newton's notation, that England fell behind all of Europe for centuries in mathematics and science because, due to the fight between Newton's and Leibniz's camp over who had invented Calculus and who stole it from whom (consensus is that they each discovered it independently), England's scientific establishment decided to ignore what was being done in Europe with Leibniz notation and stuck to Newton's... and got stuck in the mud in large part because of it.
(Differentials are part of this same issue: originally, $dy$ and $dx$ really did mean the same thing as those symbols do in $\frac{dy}{dx}$, but that leads to all sorts of logical problems, so they no longer mean the same thing, even though they behave as if they did.)
So, even though we write $\frac{dy}{dx}$ as if it were a fraction, and many computations look like we are working with it like a fraction, it isn't really a fraction (it just plays one on television).
However... There is a way of getting around the logical difficulties with infinitesimals; this is called nonstandard analysis. It's pretty difficult to explain how one sets it up, but you can think of it as creating two classes of real numbers: the ones you are familiar with, that satisfy things like the Archimedean Property, the Supremum Property, and so on, and then you add another, separate class of real numbers that includes infinitesimals and a bunch of other things. If you do that, then you can, if you are careful, define derivatives exactly like Leibniz, in terms of infinitesimals and actual quotients; if you do that, then all the rules of Calculus that make use of $\frac{dy}{dx}$ as if it were a fraction are justified because, in that setting, it is a fraction. Still, one has to be careful because you have to keep infinitesimals and regular real numbers separate and not let them get confused, or you can run into some serious problems.


Question:
Are there any advantages to use a window approach over Parks-McClellan (further abbreviated here as PMcC) or Least Squares algorithms for FIR filter design of a low pass filter?  Assume with today's computational power that the complexity of the algorithms themselves is not a factor.
This question is not comparing PMcC to Least Squares but specifically if there is any reason to use any window FIR design technique instead of those algorithms, or were windowing techniques to filter design obsoleted by those algorithms and relegated to didactic purposes?
Below is one comparison where I had compared a Hamming window to my favored design approach with Least-Squared, using the same number of taps. I widened the passband in the Least Squared approach to closely match that of the Hamming Window, and in this case it was quite clear that the Least-Squared would outperform (offering significantly more stop band rejection). I have not done this with all windows, which leads me to the question if you could ever out-perform PMcC and least-squares, or if there are other applications for a FIR low pass filter where a windowing approach would be preferred?

Update:
I am adding here lessons learned since first posting this question:

As Matt points out below and RBJ suggests in the comments, the least squares solution will be optimum in the least squares sense (when it converges within its operational range) while the solution with the Kaiser window specifically comes close to that achieved by the least squares algorithm. (The DPSS window, which the Kaiser well approximates, is another excellent choice).

A very high dynamic range filter is another example where the least squares algorithm (at least for the implementation in Python and Octave I could not get a stop band rejection lower than -180 dB; well surpassing this was no issue with a filter designed with the Kaiser window). This led me to further questions as detailed here.

I agree that the windowing filter design method is not one of the most important design methods anymore, and it might indeed be the case that it is overrepresented in traditional textbooks, probably due to historical reasons.
However, I think that its use can be justified in certain situations. I do not agree that computational complexity is no issue anymore. This depends on the platform. Sitting at our desktop computer and designing a filter, we indeed don't need to worry about complexity. However, on specific platforms and in situations where the design needs to be done in quasi-realtime, computational complexity is an issue, and a simple suboptimal design technique will be preferred over an optimal technique that is much more complex. As an example, I once worked on a system for beamforming where the filter (beamformer) would need to be re-designed on the fly, and so computational complexity was indeed an issue.
I'm also convinced that in many practical situations we don't need to worry about the difference between the optimal and the suboptimal design. This becomes even more true if we need to use fixed-point arithmetic with quantized coefficients and quantized results of arithmetic operations.
Another issue is the numerical stability of the optimal filter design methods and their implementations. I've come across several cases where the Parks-McClellan algorithm (I should say, the implementation I used) did simply not converge. This will happen if the specification doesn't make much sense, but it can also happen with totally reasonable specs. The same is true for the least squares design method where a system of linear equations needs to be solved, which can become an ill-conditioned problem. Under these circumstances, the windowing method will never let you down.
A remark about your comparison between the window method and the least squares design: I do not think that this comparison shows any general superiority of the least squares method over the windowing method. First, you seem to look at stop band attenuation, which is no design goal for either of the two methods. The windowing method is not optimal in any sense, and the least squares design minimizes the stop band energy, and doesn't care at all about stop band ripple size. What can be seen is that the pass band edge of the window design is larger than the one of the least squares design, whereas the stop band edge is smaller. Consequently, the transition band width of the filter designed by windowing is smaller which will result in higher stop band ripples. The difference in transition band width may be small, but filter properties are very sensitive to this parameter. There is no doubt that the least squares filter outperforms the other filter when it comes to stop band energy, but that's not as easy to see as ripple size. And the question remains if that difference would actually make a difference in a practical application.
Let me show you that such comparisons can often be made to look the way one would like them to look. In the figure below I compare a least squares optimal low pass filter designed with the Matlab/Octave function firls.m (blue) to a low pass filter designed with the window method using a Kaiser window (red).

From the figure, one could even conclude that the filter designed by windowing is slightly better than the least squares optimal filter. This is of course non-sense because we didn't even define "better", and the least squares filter must have a smaller mean squared approximation error. However, you don't see that directly in the figure. Anyway, this is just to support my claim that one must be very careful and clear when doing such comparisons.
In sum, apart from being useful to learn for DSP students for purely didactical reasons, I think that despite the technological advances since the 1970's the use of the windowing method can be justified in certain practical scenarios, and I don't think that that will change very soon.


Question:
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey.
I want to ask, does a particle exert a force on itself?
EDIT–
Thanks for the respectful answers and comments. I have edited this question in order to elaborate on it.
I just want to convey that I assumed the particle to be a standard model of point mass in classical mechanics. As I don't know why there is a minimum requirement of two particles to interact with fundamental forces of nature,in the similar manner I wanted to ask does a particle exerts a force on itself?

This is one of those terribly simple questions which is also astonishingly insightful and surprisingly a big deal in physics.  I'd like to commend you for the question!
The classical mechanics answer is "because we say it doesn't."  One of the peculiarities about science is that it doesn't tell you the true answer, in the philosophical sense.  Science provides you with models which have a historical track record of being very good at letting you predict future outcomes.  Particles do not apply forces to themselves in classical mechanics because the classical models which were effective for predicting the state of systems did not have them apply forces.
Now one could provide a justification in classical mechanics.  Newton's laws state that every action has an equal and opposite reaction.  If I push on my table with 50N of force, it pushes back on me with 50N of force in the opposite direction.  If you think about it, a particle which pushes on itself with some force is then pushed back by itself in the opposite direction with an equal force.  This is like you pushing your hands together really hard.  You apply a lot of force, but your hands don't move anywhere because you're just pushing on yourself.  Every time you push, you push back.
Now it gets more interesting in quantum mechanics.  Without getting into the details, in quantum mechanics, we find that particles do indeed interact with themselves.  And they have to interact with their own interactions, and so on and so forth.  So once we get down to more fundamental levels, we actually do see meaningful self-interactions of particles.  We just don't see them in classical mechanics.
Why?  Well, going back to the idea of science creating models of the universe, self-interactions are messy.  QM has to do all sorts of clever integration and normalization tricks to make them sane.  In classical mechanics, we didn't need self-interactions to properly model how systems evolve over time, so we didn't include any of that complexity.  In QM, we found that the models without self-interaction simply weren't effective at predicting what we see.  We were forced to bring in self-interaction terms to explain what we saw.
In fact, these self-interactions turn out to be a real bugger.  You may have heard of "quantum gravity."  One of the things quantum mechanics does not explain very well is gravity.  Gravity on these scales is typically too small to measure directly, so we can only infer what it should do.  On the other end of the spectrum, general relativity is substantially focused on modeling how gravity works on a universal scale (where objects are big enough that measuring gravitational effects is relatively easy).  In general relativity, we see the concept of gravity as distortions in space time, creating all sorts of wonderful visual images of objects resting on rubber sheets, distorting the fabric it rests on.
Unfortunately, these distortions cause a huge problem for quantum mechanics.  The normalization techniques they use to deal with all of those self-interaction terms don't work in the distorted spaces that general relativity predicts.  The numbers balloon and explode off towards infinity.  We predict infinite energy for all particles, and yet there's no reason to believe that is accurate.  We simply cannot seem to combine the distortion of space time modeled by Einstein's relativity and the self-interactions of particles in quantum mechanics.
So you ask a very simple question.  It's well phrased.  In fact, it is so well phrased that I can conclude by saying the answer to your question is one of the great questions physics is searching for to this very day.  Entire teams of scientists are trying to tease apart this question of self-interaction and they search for models of gravity which function correctly in the quantum realm!


Question:
I know the general concept of recursion.  I came across the concept of tail recursion while studying the quicksort algorithm.  In this video of quick sort algorithm from MIT at 18:30 seconds the professor says that this is a tail recursive algorithm.  It is not clear to me what tail recursion really means.
Can someone explain the concept with a proper example?
Some answers provided by the SO community here.

Tail recursion is a special case of recursion where the calling function does no more computation after making a recursive call.  For example, the function

int f(int x, int y) {
  if (y == 0) {
    return x;
  }

  return f(x*y, y-1);
}

is tail recursive (since the final instruction is a recursive call) whereas this function is not tail recursive:

int g(int x) {
  if (x == 1) {
    return 1;
  }

  int y = g(x-1);

  return x*y;
}

since it does some computation after the recursive call has returned.
Tail recursion is important because it can be implemented more efficiently than general recursion.  When we make a normal recursive call, we have to push the return address onto the call stack then jump to the called function.  This means that we need a call stack whose size is linear in the depth of the recursive calls.  When we have tail recursion we know that as soon as we return from the recursive call we're going to immediately return as well, so we can skip the entire chain of recursive functions returning and return straight to the original caller.  That means we don't need a call stack at all for all of the recursive calls, and can implement the final call as a simple jump, which saves us space.


Question:
I have matrices $A$ and $G$. $A$ is sparse and is $n\times n$ with $n$ very large (can be on the order of several million.) $G$ is an $n\times m$ tall matrix with $m$ rather small ($1 \lt m \lt 1000$) and each column can only have a single $1$ entry with the rest being $0$'s, such that $G^TG = I$. $A$ is huge, so it is really tough to invert, and I can solve a linear system such as $Ax = b$ iteratively using a Krylov subspace method such as $\mathrm{BiCGStab}(l)$, but I do not have $A^{-1}$ explicitly.
I want to solve a system of the form: $(G^TA^{-1}G)x = b$, where $x$ and $b$ are $m$ length vectors. One way to do it is to use an iterative algorithm within an iterative algorithm to solve for $A^{-1}$ for each iteration of the outer iterative algorithm. This would be extremely computationally expensive, however. I was wondering if there is a computationally easier way to go about solving this problem.

Introduce the vector $y:=-A^{-1}Gx$ and solve the large coupled system $Ay+Gx=0$, $G^Ty=-b$ for $(y,x)$ simultaneously, using an iterative method. If $A$ is symmetric (as seems likely though you don't state it explicitly) then the system is symmetric (but indefinite, though quasidefinite if $A$ is positive definite), which might help you to choose an appropriate method. (relevant keywords: KKT matrix, quasidefinite matrix).
Edit: As $A$ is complex symmetric, so is the augmented matrix, but there is no quasidefiniteness. You can however use the $Ax$ routine to compute $A^*x=\overline{A\overline x}$; therefore you could adapt a method such as QMR ftp://ftp.math.ucla.edu/pub/camreport/cam92-19.pdf (designed for real systems, but you can easily rewrite it for complex systems, using the adjoint in place of the transpose) to solve your problem.
Edit2: Actually, the (0,1)-structure of $G$ means that you can eliminate $x$ amd the components of $G^Ty$ symbolically, thus ending up with a smaller system to solve. This means messing with the structure of $A$, and pays only when $A$ is given explicitly in sparse format rather than as a linear operator.


Question:
I was asked today in class why you divide the sum of square error by $n-1$ instead of with $n$, when calculating the standard deviation.
I said I am not going to answer it in class (since I didn't wanna go into unbiased estimators), but later I wondered - is there an intuitive explanation for this?!

The standard deviation calculated with a divisor of $n-1$ is a standard deviation calculated from the sample as an estimate of the standard deviation of the population from which the sample was drawn. Because the observed values fall, on average, closer to the sample mean than to the population mean, the standard deviation which is calculated using deviations from the sample mean underestimates the desired standard deviation of the population. Using $n-1$ instead of $n$ as the divisor corrects for that by making the result a little bit bigger.
Note that the correction has a larger proportional effect when $n$ is small than when it is large, which is what we want because when n is larger the sample mean is likely to be a good estimator of the population mean.
When the sample is the whole population we use the standard deviation with $n$ as the divisor because the sample mean is population mean.
(I note parenthetically that nothing that starts with "second moment recentered around a known, definite mean" is going to fulfil the questioner's request for an intuitive explanation.)