Question:
Background: We're increasingly needing some way of storing lots of variant data associated with lots of subjects: think clinical trials and hospital patients, looking for disease-causing or relevant genes. A thousand subjects is where we'd start, there's talk of millions on the horizon. With various genomic medicine initiatives, this is likely a wider need.
The problem: While there's plenty of platforms out there, it's a rapidly evolving field. It's difficult to get a feel for how (and if) they perform and how they line up against each other:

What's scalable and can handle a lot of data? What sort of limits?
What's robust and not a teetering pile of hacked-together components?
What has a large community behind it and is actually used widely?
What makes for easy access and search from another service? (Commandline, REST or software APIs)
What sort of variants they handle?
What sort of parameters can be used in searching?

Solutions I've seen so far:

BigQ: used with i2b2, but its wider use is unclear
OpenCGA: looks the most developed, but I've heard complaints about the size of data it spits out
Using BigQuery over a Google Genomics db: doesn't seem to be a general solution
Gemini: recommended but is it really scalable and accessible from other services?
SciDb: a commercial general db
Quince
LOVD
Adam
Whatever platform DIVAS & RVD run on: which may not be freely available
Several graphical / graph genome solutions: We (and most other people) are probably not dealing with graph genome data at the moment, but is this a possible solution?
Roll your own: Frequently recommended but I'm sceptical this is a plausible solution for a large dataset.

Anyone with experience give a review or high-level guide to this platform space?

An epic question. Unfortunately, the short answer is: no, there are no widely used solutions.
For several thousand samples, BCF2, the binary representation of VCF, should work well. I don't see the need of new tools at this scale. For a larger sample size, ExAC people are using spark-based hail. It keeps all per-sample annotations (like GL, GQ and DP) in addition to genotypes. Hail is at least something heavily used in practice, although mostly by a few groups so far.
A simpler problem is to store genotypes only. This is sufficient to the majority of end users. There are better approaches to store and query genotypes. GQT, developed by the Gemini team, enables fast query of samples. It allows you to quickly pull samples under certain genotype configurations. As I remember, GQT is orders of magnitude faster than google genomics API to do PCA. Another tool is BGT. It produces a much smaller file and provides fast and convenient queries over sites. Its paper talks about ~32k whole-genome samples. I am in the camp who believe specialized binary formats like GQT and BGT are faster than solutions built on top of generic databases. I would encourage you to have a look if you only want to query genotypes.
Intel's GenomicDB approaches the problem in a different angle. It does not actually keep a "squared" multi-sample VCF internally. It instead keeps per-sample genotypes/annotations and generates merged VCF on the fly (this is my understanding, which could be wrong). I don't have first-hand experience with GenomicDB, but I think something in this line should be the ultimate solution in the era of 1M samples. I know GATK4 is using it at some step.
As to others in your list, Gemini might not scale that well, I guess. It is partly the reason why they work on GQT. Last time I checked, BigQuery did not query individual genotypes. It only queries over site statistics. Google genomics APIs access individual genotypes, but I doubt it can be performant. Adam is worth trying. I have not tried, though.


Question:
Protein life times are, on average, not particularly long, on a human life timescale.
I was wondering, how old is the oldest protein in a human body? Just to clarify, I mean in terms of seconds/minutes/days passed from the moment that given protein was translated. I am not sure is the same thing as asking which human protein has the longest half-life, as I think there might be "tricks" the cell uses to elongate a given protein's half-life under specific conditions.
I am pretty sure there are several ways in which a cell can preserve its proteins from degradation/denaturation if it wanted to but to what extent? I accept that a given protein post-translationally modified still is the same protein, even if cut, added to a complex, etc. etc.
And also, as correlated questions: does the answer depend on the age of the given human (starting from birth and accepting as valid proteins translated during pregnancy or even donated by the mother)? What is the oldest protein in a baby's body and what is in a elderly's body? How does the oldest protein lifetime does in comparison with the oldest nucleic acid/cell/molecule/whatever in our body?

Crystallin proteins are found in the eye lens (where their main job is probably to define the refractive index of the medium); they are commonly considered to be non-regenerated. So, your crystallins are as old as you are!
Because of this absence of regeneration, the accumulate damage over time, including proteolysis, cross-linkings etc., which is one of the main reasons why visual acuity decays after a certain age: that is where cataracts come from. The cloudy lens is the result of years of degradation events in a limited pool of non-renewed proteins.
Edit: A few references:
This article shows that one can use 14C radiodating to determine the date of synthesis of lens proteins, because of their exceptionally low turnover: Lynnerup, "Radiocarbon Dating of the Human Eye Lens Crystallines Reveal Proteins without Carbon Turnover throughout Life", PLoS One (2008) 3:e1529
This excellent review suggested by iayork (thanks!) lists long-lived proteins (including crystallins) and how they were identified as such:
Toyama & Hetzer, "Protein homeostasis: live long, won’t prosper" Nat Rev Mol Cell Biol. (2013) 14:55–61


Question:
I understand that covalent bonding is an equilibrium state between attractive and repulsive forces, but which one of the fundamental forces actually causes atoms to attract each other?
Also, am I right to think that "repulsion occurs when atoms are too close together" comes from electrostatic interaction?

I understand that covalent bonding is an equilibrium state between attractive and repulsive forces, but which one of the fundamental forces actually causes atoms to attract each other?

The role of Pauli Exclusion in bonding
It is an unfortunate accident of history that because chemistry has a very convenient and predictive set of approximations for understanding bonding, some of the details of why those bonds exist can become a bit hard to discern. It's not that they aren't there -- they most emphatically are! -- but you often have to dig a bit deeper to find them. They are found in physics, in particular in the concept of Pauli exclusion.
Chemistry as avoiding black holes
Let's take your attraction question first. What causes that? Well, in one sense that question is easy: it's electrostatic attraction, the interplay of pulls between positively charged nuclei and negatively charged electrons.
But even in saying that, something is wrong. Here's the question that points that out: If nothing else was involved except electrostatic attraction, what would be the most stable configuration of two or more atoms with a mix of positive and negative charges?
The answer to that is a bit surprising. If the charges are balanced, the only stable, non-decaying answer for conventional (classical) particles is always the same: "a very, very small black hole." Of course, you could modify that a bit by assuming that the strong force is for some reason stable, in which case the answer becomes "a bigger atomic nucleus," one with no electrons around it.
Or maybe atoms as Get Fuzzy?
At this point, some of you reading this should be thinking loudly "Now wait a minute! Electrons don't behave like point particles in atoms, because quantum uncertainty makes them 'fuzz out' as they get close to the nucleus." And that is exactly correct -- I'm fond of quoting that point myself in other contexts!
However, the issue here is a bit different, since even "fuzzed out" electrons provide a poor barrier for keeping other electrons away by electrostatic repulsion alone, precisely because their charge is so diffuse. The case of electrons that lack Pauli exclusion is nicely captured by Richard Feynman in his Lectures on Physics, in Volume III, Chapter 4, page 4-13, Figure 4-11 at the top of the page. The outcome Feynman describes is pretty boring since atoms would remain simple, smoothly spherical, and about the same size as more and more protons and electrons get added in.
While Feynman does not get into how such atoms would interact, there's a problem there too. Because the electron charges would be so diffuse in comparison to the nuclei, the atoms would pose no real barrier to each other until the nuclei themselves begin to repel each other. The result would be a very dense material that would have more in common with neutronium than with conventional matter.
For now, I'll just forge ahead with a more classical description, and capture the idea of the electron cloud simply by asserting that each electron is selfish and likes to capture as much "address space" (see below) as possible.
Charge-only is boring!
So, while you can finagle with funny configurations of charges that might prevent the inevitable for a while by pitting positive against positive and negative against negative, positively charged nuclei and negatively charged electrons with nothing much else in play will always wind up in the same bad spot: either as very puny black holes or as tiny boring atoms that lack anything resembling chemistry.
A universe full of nothing but various sizes of black holes or simple homogenous neutronium is not very interesting!
Preventing the collapse
So, to understand atomic electrostatic attraction properly, you must start with the inverse issue: What in the world is keeping these things from simply collapsing down to zero size -- that is, where is the repulsion coming from?
And that is your next question:

Also, am I right to think that "repulsion occurs when atoms are too close together" comes from electrostatic interaction?

No; that is simply wrong. In the absence of "something else," the charges will wiggle about and radiate until any temporary barrier posed by identical charges simply becomes irrelevant... meaning that once again you will wind up with those puny black holes.
What keeps atoms, bonds, and molecules stable is always something else entirely, a "force" that is not traditionally thought of as being a force at all, even though it is unbelievably powerful and can prevent even two nearby opposite electrical charges from merging. The electrostatic force is enormously powerful at the tiny separation distances within atoms, so anything that can stop charged particles from merging is impressive!
The "repulsive force that is not a force" is the Pauli exclusion I mentioned earlier. A simple way to think of Pauli exclusion is that identical material particles (electrons, protons, and neutrons in particular) all insist on having completely unique "addresses" to tell them apart from other particles of the same type. For an electron, this address includes: where the electron is located in space, how fast and in what direction it is moving (momentum), and one last item called spin, which can only have on of two values that are usually called "up" or "down."
You can force such material particles (called fermions) into nearby addresses, but with the exception of that up-down spin part of the address, doing so always increases the energy of at least one of the electrons. That required increase in energy, in a nutshell, is why material objects push back when you try to squeeze them. Squeezing them requires minutely reducing the available space of many of the electrons in the object, and those electrons respond by capturing the energy of the squeeze and using it to push right back at you.
Now, take that thought and bring it back to the question about where repulsion comes from when two atoms bond at a certain distance, but no closer. They are the same mechanism!
That is, two atoms can "touch" (move so close, but no closer) only because they both have a lot of electrons that require separate space, velocity, and spin addresses. Push them together and they start hissing like cats from two households who have suddenly been forced to share the same house. (If you own multiple cats, you'll know exactly what I mean by that.)
So, what happens is that the overall set of plus-and-minus forces of the two atoms is trying really hard to crush all of the charges down into a single very tiny black hole -- not into some stable state! It is only the hissing and spitting of the overcrowded and very unhappy electrons that keep this event from happening.
Orbitals as juggling acts
But just how does that work?
It's sort of a juggling act, frankly. Electrons are allowed to "sort of" occupy many different spots, speeds, and spins (mnemonic $s^3$, and no, that is not standard, I'm just using it for convenience in this answer only) at the same time, due to quantum uncertainty. However, it's not necessary to get into that here beyond recognizing that every electron tries to occupy as much of its local $s^3$ address space as possible.
Juggling between spots and speeds requires energy. So, since only so much energy is available, this is the part of the juggling act that gives atoms size and shape. When all the jockeying around wraps up, the lowest energy situations keep the electrons stationed in various ways around the nucleus, not quite touching each other. We call those special solutions to the crowding problem orbitals, and they are very convenient for understanding and estimating how atoms and molecules will combine.
Orbitals as specialized solutions
However, it's still a good idea to keep in mind that orbitals are not exactly fundamental concepts, but rather outcomes of the much deeper interplay of Pauli exclusion with the unique masses, charges,  and configurations of nuclei and electrons. So, if you toss in some weird electron-like particle such as a muon or positron, standard orbital models have to be modified significantly, and applied only with great care. Standard orbitals can also get pretty weird just from having unusual geometries of fully conventional atomic nuclei, with the unusual dual hydrogen bonding found in boron hydrides such as diborane probably being the best example. Such bonding is odd if viewed in terms of conventional hydrogen bonds, but less so if viewed simply as the best possible "electron juggle" for these compact cases.
"Jake! The bond!"
Now on to the part that I find delightful, something that underlies the whole concept of chemical bonding.
Do you recall that it takes energy to squeeze electrons together in terms of the main two parts of their "addresses," the spots (locations) and speeds (momenta)? I also mentioned that spin is different in this way: the only energy cost for adding two electrons with different spin addresses is that of conventional electrostatic repulsion. That is, there is no "forcing them closer" Pauli exclusion cost as you get for locations and velocities.
Now you might think, "but electrostatic repulsion is huge!", and you would be exactly correct. However, compared to the Pauli exclusion "non-force force" cost, the energy cost of this electrostatic repulsion is actually quite small -- so small that it can usually be ignored for small atoms. So when I say that Pauli exclusion is powerful, I mean it, since it even makes the enormous repulsion of two electrons stuck inside the same tiny sector of a single atom look so insignificant that you can usually ignore its impact!
But that's secondary because the real point is this: When two atoms approach each other closely, the electrons start fighting fierce energy-escalation battles that keep both atoms from collapsing all the way down into a black hole. But there is one exception to that energetic infighting: spin! For spin and spin alone, it becomes possible to get significantly closer to that final point-like collapse that all the charges want to do.
Spin thus becomes a major "hole" -- the only such major hole -- in the ferocious armor of repulsion produced by Pauli exclusion. If you interpret atomic repulsion due to Pauli exclusion as the norm, then spin-pairing two electrons becomes another example of a "force that is not a force," or a pseudo force. In this case, however, the result is a net attraction. That is, spin-pairing allows two atoms (or an atom and an electron) to approach each other more closely than Pauli exclusion would otherwise permit. The result is a significant release of electrostatic attraction energy. That release of energy in turn creates a stable bond since it cannot be broken unless that same energy is returned.
Sharing (and stealing) is cheaper
So, if two atoms (e.g. two hydrogen atoms) each have an outer orbital that contains only one electron, those two electrons can sort of look each other over and say, "you know, if you spin downwards and I spin upwards, we could both share this space for almost no energy cost at all!" And so they do, with a net release of energy, producing a covalent bond if the resulting spin-pair cancels out positive nuclear charges equally on both atoms.
However, in some cases, the "attractive force" of spin-pairing is so overwhelmingly greater for one of the two atoms that it can pretty much fully overcome (!) the powerful electrostatic attraction of the other atom for its own electron. When that happens, the electron is simply ripped away from the other atom. We call that an ionic bond, and we act as it if it's no big deal. But it is truly an amazing thing, one that is possible only because of the pseudo force of spin-pairing.
Bottom line: Pseudo forces are important!
My apologies for having given such a long answer, but you happened to ask a question that cannot be answered correctly without adding in some version of Pauli "repulsion" and spin-pair "attraction." For that matter, the size of an atom, the shape of its orbitals, and its ability to form bonds similarly all depend on pseudo forces.


Question: I am new to computer science and I was wondering whether half precision is supported by modern architecture in the same way as single or double precision is. I thought the 2008 revision of IEEE-754 standard introduced both quadruple and half precisions.

Intel support for IEEE float16 storage format
Intel supports IEEE half as a storage type in processors since Ivy Bridge (2013). Storage type means you can get a memory/cache capacity/bandwidth advantage but the compute is done with single precision after converting to and from the IEEE half precision format.

Intel support for BFloat16
Intel has announced support for BF16 in Cooper Lake and Sapphire Rapids.

 (the June 2020 update 319433-040 describes AMX BF16)

I work for Intel. I’m citing official sources and will not comment on rumors etc.
It is good to be curious about the relative merits of IEEE FP16 vs BF16.  There is a lot of analysis of this topic, e.g.
Non-Intel Hardware Support
The following is information on other processors.  Please verify with the vendors as necessary.
 lists the following hardware support:

AMD - MI5, MI8, MI25
ARM - NEON VFP FP16 in V8.2-A
NVIDIA - Pascal and Volta

NVIDIA Ampere has FP16 support as well (


Question:
I have an integer linear program (ILP) with some variables $x_i$ that are intended to represent boolean values.  The $x_i$'s are constrained to be integers and to hold either 0 or 1 ($0 \le x_i \le 1$).
I want to express boolean operations on these 0/1-valued variables, using linear constraints.  How can I do this?
More specifically, I want to set $y_1 = x_1 \land x_2$ (boolean AND), $y_2 = x_1 \lor x_2$ (boolean OR), and $y_3 = \neg x_1$ (boolean NOT).  I am using the obvious interpretation of 0/1 as Boolean values: 0 = false, 1 = true.  How do I write ILP constraints to ensure that the $y_i$'s are related to the $x_i$'s as desired?
(This could be viewed as asking for a reduction from CircuitSAT to ILP, or asking for a way to express SAT as an ILP, but here I want to see an explicit way to encode the logical operations shown above.)

Logical AND: Use the linear constraints $y_1 \ge x_1 + x_2 - 1$, $y_1 \le x_1$, $y_1 \le x_2$, $0 \le y_1 \le 1$, where $y_1$ is constrained to be an integer.  This enforces the desired relationship.  See also
Logical OR: Use the linear constraints $y_2 \le x_1 + x_2$, $y_2 \ge x_1$, $y_2 \ge x_2$, $0 \le y_2 \le 1$, where $y_2$ is constrained to be an integer.
Logical NOT: Use $y_3 = 1-x_1$.
Logical implication: To express $y_4 = (x_1 \Rightarrow x_2)$ (i.e., $y_4 = \neg x_1 \lor x_2$), we can adapt the construction for logical OR.  In particular, use the linear constraints $y_4 \le 1-x_1 + x_2$, $y_4 \ge 1-x_1$, $y_4 \ge x_2$, $0 \le y_4 \le 1$, where $y_4$ is constrained to be an integer.
Forced logical implication: To express that $x_1 \Rightarrow x_2$ must hold, simply use the linear constraint $x_1 \le x_2$ (assuming that $x_1$ and $x_2$ are already constrained to boolean values).
XOR: To express $y_5 = x_1 \oplus x_2$ (the exclusive-or of $x_1$ and $x_2$), use linear inequalities $y_5 \le x_1 + x_2$, $y_5 \ge x_1-x_2$, $y_5 \ge x_2-x_1$, $y_5 \le 2-x_1-x_2$, $0 \le y_5 \le 1$, where $y_5$ is constrained to be an integer.
Another helpful technique for handling complex boolean formulas is to convert them to CNF, then apply the rules above for converting AND, OR, and NOT.

And, as a bonus, one more technique that often helps when formulating problems that contain a mixture of zero-one (boolean) variables and integer variables:
Cast to boolean (version 1): Suppose you have an integer variable $x$, and you want to define $y$ so that $y=1$ if $x \ne 0$ and $y=0$ if $x=0$.  If you additionally know that $0 \le x \le U$, then you can use the linear inequalities $0 \le y \le 1$, $y \le x$, $x \le Uy$; however, this only works if you know an upper and lower bound on $x$.
Alternatively, if you know that $|x| \le U$ (that is, $-U \le x \le U$) for some constant $U$, then you can use the method described here.  This is only applicable if you know an upper bound on $|x|$.
Cast to boolean (version 2): Let's consider the same goal, but now we don't know an upper bound on $x$.  However, assume we do know that $x \ge 0$.  Here's how you might be able to express that constraint in a linear system.  First, introduce a new integer variable $t$.  Add inequalities $0 \le y \le 1$, $y \le x$, $t=x-y$.  Then, choose the objective function so that you minimize $t$.  This only works if you didn't already have an objective function.  If you have $n$ non-negative integer variables $x_1,\dots,x_n$ and you want to cast all of them to booleans, so that $y_i=1$ if $x_i\ge 1$ and $y_i=0$ if $x_i=0$, then you can introduce $n$ variables $t_1,\dots,t_n$ with inequalities $0 \le y_i \le 1$, $y_i \le x_i$, $t_i=x_i-y_i$ and define the objective function to minimize $t_1+\dots + t_n$.  Again, this only works nothing else needs to define an objective function (if, apart from the casts to boolean, you were planning to just check the feasibility of the resulting ILP, not try to minimize/maximize some function of the variables).

For some excellent practice problems and worked examples, I recommend Formulating Integer Linear Programs:
A Rogues' Gallery.


Question:
I am able to write a basic sine wave generator for audio, but I want it to be able to smoothly transition from one frequency to another. If I just stop generating one frequency and immediately switch to another there will be a discontinuity in the signal and a "click" will be heard.
My question is, what is a good algorithm to generate a wave that starts at, say 250Hz, and then transitions to 300Hz, without introducing any clicks. If the algorithm includes an optional glide/portamento time, then so much the better.
I can think of a few possible approaches such as oversampling followed by a low pass filter, or maybe using a wavetable, but I am sure this is a common enough problem that there is a standard way of tackling it.

One approach that I have used in the past is to maintain a phase accumulator which is used as an index into a waveform lookup table. A phase delta value is added to the accumulator at each sample interval:
phase_index += phase_delta

To change frequency you change the phase delta that is added to the phase accumulator at each sample, e.g.
phase_delta = N * f / Fs

where:
phase_delta is the number of LUT samples to increment
freq is the desired output frequency
Fs is the sample rate
N is the size of the LUT

This guarantees that the output waveform is continuous even if you change phase_delta dynamically, e.g. for frequency changes, FM, etc.
For smoother changes in frequency (portamento) you can ramp the phase_delta value between its old value and new value over a suitable number of samples intervals rather than just changing it instantaneously.
Note that phase_index and phase_delta both have an integer and a fractional component, i.e. they need to be floating point or fixed point. The integer part of phase_index (modulo table size) is used as an index into the waveform LUT, and the fractional part may optionally be used for interpolation between adjacent LUT values for higher quality output and/or smaller LUT size.


Question:
So this is supposed to be really simple, and it's taken from the following picture:

Text-only:

It took Marie $10$ minutes to saw a board into $2$ pieces. If she works just as fast, how long will it take for her to saw another board into
  $3$ pieces?

I don't understand what's wrong with this question.  I think the student answered the question wrong, yet my friend insists the student got the question right.
I feel like I'm missing something critical here. What am I getting wrong here?

Haha! The student probably has a more reasonable interpretation of the question.
Of course, cutting one thing into two pieces requires only one cut! Cutting something into three pieces requires two cuts!

-------------------------------  0 cuts/1 piece/0 minutes
  ---------------|---------------  1 cut/2 pieces/10 minutes
  ---------|-----------|---------  2 cuts/3 pieces/20 minutes

This is a variation of the "fence post" problem: how many posts do you need to build a 100 foot long fence with 10 foot sections between the posts?
Answer:  11  You have to draw the problem to get it...See below, and count the posts!
|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
0-----10----20----30----40----50----60----70----80----90---100


Question:
I'm sure many people will respond with links to 'let me google that for you', so I want to say that I've tried to figure this out so please forgive my lack of understanding here, but I cannot figure out how the practical implementation of a neural network actually works.
I understand the input layer and how to normalize the data, I also understand the bias unit, but when it comes to the hidden layer, what the actual computation is in that layer, and how it maps to the output is just a little foggy. I've seen diagrams with question marks in the hidden layer, boolean functions like AND/OR/XOR, activation functions, and input nodes that map to all of the hidden units and input nodes that map to only a few hidden units each and so I just have a few questions on the practical aspect. Of course, a simple explanation of the entire neural network process like you would explain to a child, would be awesome.
What computations are done in the hidden layer?
How are those computations mapped to the output layer?
How does the ouput layer work? De-normalizing the data from the hidden layer?
Why are some layers in the input layer connected to the hidden layer and some are not?

Three sentence version:

Each layer can apply any function you want to the previous layer (usually a linear transformation followed by a squashing nonlinearity).
The hidden layers' job is to transform the inputs into something that the output layer can use.
The output layer transforms the hidden layer activations into whatever scale you wanted your output to be on.

Like you're 5:
If you want a computer to tell you if there's a bus in a picture, the computer might have an easier time if it had the right tools.
So your bus detector might be made of a wheel detector (to help tell you it's a vehicle) and a box detector (since the bus is shaped like a big box) and a size detector (to tell you it's too big to be a car).  These are the three elements of your hidden layer: they're not part of the raw image, they're tools you designed to help you identify busses.
If all three of those detectors turn on (or perhaps if they're especially active), then there's a good chance you have a bus in front of you.
Neural nets are useful because there are good tools (like backpropagation) for building lots of detectors and putting them together.

Like you're an adult
A feed-forward neural network applies a series of functions to the data.  The exact functions will depend on the neural network you're using: most frequently, these functions each compute a linear transformation of the previous layer, followed by a squashing nonlinearity.  Sometimes the functions will do something else (like computing logical functions in your examples, or averaging over adjacent pixels in an image).  So the roles of the different layers could depend on what functions are being computed, but I'll try to be very general.
Let's call the input vector $x$, the hidden layer activations $h$, and the output activation $y$.  You have some function $f$ that maps from $x$ to $h$ and another function $g$ that maps from $h$ to $y$.
So the hidden layer's activation is $f(x)$ and the output of the network is $g(f(x))$.
Why have two functions ($f$ and $g$) instead of just one?
If the level of complexity per function is limited, then $g(f(x))$ can compute things that $f$ and $g$ can't do individually.

An example with logical functions:
For example, if we only allow $f$ and $g$ to be simple logical operators like "AND", "OR", and "NAND", then you can't compute other functions like "XOR" with just one of them.  On the other hand, we could compute "XOR" if we were willing to layer these functions on top of each other:
First layer functions:

Make sure that at least one element is "TRUE" (using OR)
Make sure that they're not all "TRUE" (using NAND)

Second layer function:

Make sure that both of the first-layer criteria are satisfied (using AND)

The network's output is just the result of this second function.  The first layer transforms the inputs into something that the second layer can use so that the whole network can perform XOR.

An example with images:
Slide 61 from this talk--also available here as a single image--shows (one way to visualize) what the different hidden layers in a particular neural network are looking for.
The first layer looks for short pieces of edges in the image: these are very easy to find from raw pixel data, but they're not very useful by themselves for telling you if you're looking at a face or a bus or an elephant.
The next layer composes the edges: if the edges from the bottom hidden layer fit together in a certain way, then one of the eye-detectors in the middle of left-most column might turn on.  It would be hard to make a single layer that was so good at finding something so specific from the raw pixels: eye detectors are much easier to build out of edge detectors than out of raw pixels.
The next layer up composes the eye detectors and the nose detectors into faces.  In other words, these will light up when the eye detectors and nose detectors from the previous layer turn on with the right patterns.  These are very good at looking for particular kinds of faces: if one or more of them lights up, then your output layer should report that a face is present.
This is useful because face detectors are easy to build out of eye detectors and nose detectors, but really hard to build out of pixel intensities.
So each layer gets you farther and farther from the raw pixels and closer to your ultimate goal (e.g. face detection or bus detection).

Answers to assorted other questions
"Why are some layers in the input layer connected to the hidden layer and some are not?"
The disconnected nodes in the network are called "bias" nodes. There's a really nice explanation here. The short answer is that they're like intercept terms in regression.
"Where do the "eye detector" pictures in the image example come from?"
I haven't double-checked the specific images I linked to, but in general, these visualizations show the set of pixels in the input layer that maximize the activity of the corresponding neuron.  So if we think of the neuron as an eye detector, this is the image that the neuron considers to be most eye-like.  Folks usually find these pixel sets with an optimization (hill-climbing) procedure.
In this paper by some Google folks with one of the world's largest neural nets, they show a "face detector" neuron and a "cat detector" neuron this way, as well as a second way: They also show the actual images that activate the neuron most strongly (figure 3, figure 16).  The second approach is nice because it shows how flexible and nonlinear the network is--these high-level "detectors" are sensitive to all these images, even though they don't particularly look similar at the pixel level.

Let me know if anything here is unclear or if you have any more questions.


Question:
The Fast Fourier Transform takes $\mathcal O(N \log N)$ operations, while the Fast Wavelet Transform takes $\mathcal O(N)$. But what, specifically, does the FWT compute?
Although they are often compared, it seems like the FFT and FWT are apples and oranges.  As I understand it, it would be more appropriate to compare the STFT (FFTs of small chunks over time) with the complex Morlet WT, since they're both time-frequency representations based on complex sinusoids (please correct me if I'm wrong). This is often shown with a diagram like this:

(Another example)
The left shows how the STFT is a bunch of FFTs stacked on top of each other as time passes (this representation is the origin of the spectrogram), while the right shows the dyadic WT, which has better time resolution at high frequencies and better frequency resolution at low frequencies (this representation is called a scalogram). In this example, $N$ for the STFT is the number of vertical columns (6), and a single $\mathcal O(N \log N)$ FFT operation calculates a single row of $N$ coefficients from $N$ samples. The total is 8 FFTs of 6 points each, or 48 samples in the time domain.
What I don't understand:

How many coefficients does a single $\mathcal O(N)$ FWT operation compute, and where are they located on the time-frequency chart above?
Which rectangles get filled in by a single computation?
If we calculate an equal-area block of time-frequency coefficients using both, do we get the same amount of data out?
Is the FWT still more efficient than the FFT?

Concrete example using PyWavelets:
In [2]: dwt([1, 0, 0, 0, 0, 0, 0, 0], 'haar')
Out[2]:
(array([ 0.70710678,  0.        ,  0.        ,  0.        ]),
 array([ 0.70710678,  0.        ,  0.        ,  0.        ]))

It creates two sets of 4 coefficients, so it's the same as the number of samples in the original signal. But what's the relationship between these 8 coefficients and the tiles in the diagram?
Update:
Actually, I was probably doing this wrong, and should be using wavedec(), which does a multi-level DWT decomposition:
In [4]: wavedec([1, 0, 0, 0, 0, 0, 0, 0], 'haar')
Out[4]:
[array([ 0.35355339]),
 array([ 0.35355339]),
 array([ 0.5,  0. ]),
 array([ 0.70710678,  0.        ,  0.        ,  0.        ])]

You are correct that the FWT is better thought of as a "cousin" of the STFT, rather than the FT.  In fact, the FWT is just a discrete sampling of the CWT (continuous wavelet transform), as the FFT/DFT is a discrete sampling of the Fourier transform.  This may seem like a subtle point, but it is relevant when choosing how you discretize the transform.
The CWT and STFT are both redundant analyses of a signal.  In other words, you have more "coefficients" (in the discrete case) than you need to fully represent a signal.  However, a Fourier transform (or say a wavelet transform using only one scale) integrate a signal from -infinity to +infinity.  This is not very useful on real world signals, so we truncate (i.e. window) the transforms to shorter lengths.  Windowing of a signal changes the transform -- you multiply by the window in time/space, so in transform space you have the convolution of the transform of the window with the transform of the signal.
In the case of the STFT, the windows are (usually) the same length (non-zero extent) at all time, and are frequency agnostic (you window a 10 Hz signal the same width as a 10 kHz signal).  So you get the rectangular grid spectrogram like you have drawn.
The CWT has this windowing built in by the fact that the wavelets get shorter (in time or space) as the scale decreases (like higher frequency).  Thus for higher frequencies, the effective window is shorter in duration, and you end up with a scaleogram that looks like what you have drawn for the FWT.
How you discretize the CWT is somewhat up to you, though I think there are minimum samplings in both shift and scale to fully represent a signal.  Typically (at least how I've used them), for lowest scale (highest frequency), you will sample at all shift locations (time/space).  As you get higher in scale (lower in frequency), you can sample less often.  The rationale is that low frequencies don't change that rapidly (think of a cymbal crash vs. a bass guitar -- the cymbal crash has very short transients, whereas the bass guitar would take longer to change).  In fact, at the shortest scale (assuming you sample at all shift locations), you have the full representation of a signal (you can reconstruct it using only the coefficients at this scale).  I'm not so sure about the rationale of sampling the scale.  I've seen this suggested as logarithmic, with (I think) closer spacing between shorter scales.  I think this is because the wavelets at longer scales have a broader Fourier transform (therefore they "pick up" more frequencies).
I admit I do not fully understand the FWT.  My hunch is that it is actually the minimum sampling in shift/scale, and is not a redundant representation.  But then I think you lose the ability to analyze (and mess with) a signal in short time without introducing unwanted artifacts.  I will read more about it and, if I learn anything useful, report back.  Hopefully others will like to comment.


Question: What is the reason that the windows of ships' bridges are always inclined as shown in the above picture?

Look at CandiedOrange's answer
This answer was accepted, but CandiedOrange has the right answer.  See this document page 21:

The second way in which reflection can interfer e with controller’s vision is light sources within  the  cab  (or  direct  sunlight  that enters  the  cab),  which  can  cause  disturbing  reflections during either day or night operations.  The effects of these reflections can be a loss  of  contrast  of  the  image  being  viewed, a  masking  effect  of  a  competing  image,  or
  glare.  The two ways to mitigate these effects are to reduce the reflection coefficient or to design  the  ATCT  cab  to  reduce  or  eliminate  the  probability  that  any  light  source (artificial  or  natural,  direct  or  indirect)  can  produce  a  reflection  in  the  pathway  of  a
  controller’s view out of the cab windows.

It controls glare.  Whenever the sun hits a window, it reflects off of it.  If the windows are vertical, its pretty hard to control where that glint could go.  When the sun is near the horizon, it could even be seen by other ships, but at the very least it can blind workers on your own ship.
Angling them doesn't prevent this from happening entirely, but it does substantially limit the places on the ship which can be hit by this glint to a small region around the bridge itself.
This requirement appears in specifications such as these regulations from the UK:

1.9    Windows shall meet the following requirements:
1.9.1     To help avoid reflections, the bridge front windows shall be inclined from the vertical plane top out, at an angle of not less than 10° and not more than 25°.
...

These same rules are also applied to air traffic control towers at airports:


Question:
Several gene set enrichment methods are available, the most famous/popular is the Broad Institute tool. Many other tools are available (See for example the biocView of GSE which list 82 different packages). There are several parameters in consideration :

the statistic used to order the genes,
if it competitive or self-contained,
if it is supervised or not,
and how is the enrichment score calculated.

I am using the fgsea - Fast Gene Set Enrichment Analysis package to calculate the enrichment scores and someone told me that the numbers are different from the ones on the Broad Institute despite all the other parameters being equivalent.
Are these two methods (fgsea and Broad Institute GSEA) equivalent to calculate the enrichment score?
I looked to the algorithms of both papers, and they seem fairly similar, but I don't know if in real datasets they are equivalent or not.
Is there any article reviewing and comparing how does the enrichment score method affect to the result?

According to the FGSEA preprint:

We ran reference GSEA with default parameters. The permutation number
  was set to 1000, which means that for each input gene set 1000
  independent samples were generated. The run took 100 seconds and
  resulted in 79 gene sets with GSEA-adjusted FDR q-value of less than
  10−2. All significant gene sets were in a positive mode. First, to get
  a similar nominal p-values accuracy we ran FGSEA algorithm on 1000
  permutations. This took 2 seconds, but resulted in no significant hits
  due after multiple testing correction (with FRD ≤ 1%).

Thus, FGSEA and GSEA are not identical.
And again in the conclusion:

Consequently, gene sets can be ranked more precisely in the results
  and, which is even more important, standard multiple testing
  correction methods can be applied instead of approximate ones as in
  [GSEA].

The author argues that FGSEA is more accurate, so it can't be equivalent.
If you are interested specifically in the enrichment score, that was addressed by the author in the preprint comments:

Values of enrichment scores and normalized enrichment scores are the
  same for both broad version and fgsea.

So that part seems to be the same.


Question: Why are nearly all amino acids in organisms left-handed (exception is glycine which has no isomer) when abiotic samples typical have an even mix of left- and right-handed molecules?

I know that you are referring to the commonly ribosome-translated L-proteins, but I can't help but add that there are some peptides, called nonribosomal peptides, which are not dependent on the mRNA and can incorporate D-amino acids. They have very important pharmaceutical properties. I recommend this (1) review article if you are interested in the subject. It is also worth mentioning that D-alanine and D-glutamine are incorporated into the peptidoglycane of bacteria.
I read several papers (2, 3, 4) that discuss the problem of chirality but all of them conclude that there is no apparent reason why we live in the L-world. The L-amino acids should not have chemical advantages over the D-amino acids, as biocs already pointed out.
Reasons for the occurrence of the twenty coded protein amino acids (2) has an informative and interesting outline. This is the paragraph on the topic of chirality:

This is related to the question of the origin of optical
activity in living organisms on which there is a very
large literature (Bonner 1972; Norden 1978; Brack and
Spack 1980). We do not propose to deal with this
question here, except to note that arguments presented
in this paper would apply to organisms constructed from
either D or L amino acids.

It might be possible that both L and D lives were present (L/D-amino acids, L/D-enzymes recognizing L/D-substrates), but, by random chance the L-world outcompeted the D-world.
I also found the same question in a forum where one of the answers seems intriguing. I cannot comment on the reliability of the answer, but hopefully someone will have the expertise to do so:

One, our galaxy has a chiral spin and a magnetic orientation, which causes cosmic dust particles to polarize starlight as circularly polarized in one direction only. This circularly polarized light degrades D enantiomers of amino acids more than L enantiomers, and this effect is clear when analyzing the amino acids found on comets and meteors. This explains why, at least in the milky way, L enantiomers are preferred.
Two, although gravity, electromagnetism, and the strong nuclear force are achiral, the weak nuclear force (radioactive decay) is chiral. During beta decay, the emitted electrons preferentially favor one kind of spin. That's right, the parity of the universe is not conserved in nuclear decay. These chiral electrons once again preferrentially degrade D amino acids vs. L amino acids.
Thus due to the chirality of sunlight and the chirality of nuclear radiation, L amino acids are the more stable enantiomers and therefore are favored for abiogenesis.

BIOSYNTHESIS OF NONRIBOSOMAL PEPTIDES

Reasons for the occurrence of the twenty coded protein amino acids

Molecular Basis for Chiral Selection in RNA Aminoacylation

How nature deals with stereoisomers

The adaptation of diastereomeric S-prolyl dipeptide derivatives to the quantitative estimation of R- and S-leucine enantiomers. Bonner WA, 1972

The asymmetry of life. Nordén B, 1978

Beta-Structures of polypeptides with L- and D-residues. Part III. Experimental evidences for enrichment in enantiomer. Brack A, Spach G, 1980


Question: What is the difference between thermodynamic and kinetic stability? I'd like a basic explanation, but not too simple. For example, methane does not burn until lit -- why?

To understand the difference between kinetic and thermodynamic stability, you first have to understand potential energy surfaces, and how they are related to the state of a system.
A potential energy surface is a representation of the potential energy of a system as a function of one or more of the other dimensions of a system. Most commonly, the other dimensions are spatial. Potential energy surfaces for chemical systems are usually very complex and hard to draw and visualize. Fortunately, we can make life easier by starting with simple 2-d models, and then extend that understanding to the generalized N-d case.
So, we will start with the easiest type of potential energy to understand: gravitational potential energy. This is easy for us because we live on Earth and are affected by it every day. We have developed an intuitive sense that things tend to move from higher places to lower places, if given the opportunity. For example, if I show you this picture:

You can guess that the rock is eventually going to roll downhill, and eventually come to rest at the bottom of the valley.
However, you also intuitively know that it is not going to move unless something moves it. In other words, it needs some kinetic energy to get going.
I could make it even harder for the rock to get moving by changing the surface a little bit:

Now it is really obvious that the rock isn't going anywhere until it gains enough kinetic energy to overcome the little hill between the valley it is in, and the deeper valley to the right.
We call the first valley a local minimum in the potential energy surface. In mathematical terms, this means that the first derivative of potential energy with respect to position is zero:
$$\frac{\mathrm dE}{\mathrm dx} = 0$$
and the second derivative is positive:
$$\frac{\mathrm d^2E}{\mathrm dx^2} \gt 0$$
In other words, the slope is zero and the shape is concave up (or convex).
The deeper valley to the right is the global minimum (at least as far as we can tell). It has the same mathematical properties, but the magnitude of the energy is lower – the valley is deeper.
If you put all of this together, (and can tolerate a little anthropomorphization) you could say that the rock wants to get to the global minimum, but whether or not it can get there is determined by the amount of kinetic energy it has.
It needs at least enough kinetic energy to overcome all of the local maxima along the path between its current local minimum and the global minimum.
If it doesn't have enough kinetic energy to move out of its current position, we say that it is kinetically stable or kinetically trapped. If it has reached the global minimum, we say it is thermodynamically stable.
To apply this concept to chemical systems, we have to change the potential energy that we use to describe the system. Gravitational potential energy is too weak to play much of a role at the molecular level. For large systems of reacting molecules, we instead look at one of several thermodynamic potential energies. The one we choose depends on which state variables are constant. For macroscopic chemical reactions, there is usually a constant number of particles, constant temperature, and either constant pressure or volume (NPT or NVT), and so we use the Gibbs Free Energy ($G$ for NPT systems) or the Helmholtz Free Energy ($A$ for NVT systems).
Each of these is a thermodynamic potential under the appropriate conditions, which means that it does the same thing that gravitational potential energy does: it allows us to predict where the system will go, if it gets the opportunity to do so.
For kinetic energy, we don't have to change much - the main difference between the kinetic energy of a rock on a hill and the kinetic energy of a large collection of molecules is how we measure it. For single particles, we can measure it using the velocity, but for large groups of molecules, we have to measure it using temperature. In other words, increasing the temperature increases the kinetic energy of all molecules in a system.
If we can describe the thermodynamic potential energy of a system in different states, we can figure out whether a transition between two states is thermodynamically favorable – we can calculate whether the potential energy would increase, decrease, or stay the same.
If we look at all accessible states and decide that the one we are in has the lowest thermodynamic potential energy, then we are in a thermodynamically stable state.
In your example using methane gas, we can look at Gibbs free energy for the reactants and products and decide that the products are more thermodynamically stable than the reactants, and therefore methane gas in the presence of oxygen at 1 atm and 298 K is thermodynamically unstable.
However, you would have to wait a very long time for methane to react without some outside help. The reason is that the transition states along the lowest-energy reaction path have a much higher thermodynamic potential energy than the average kinetic energy of the reactants. The reactants are kinetically trapped - or stable just because they are stuck in a local minimum. The minimum amount of energy that you would need to provide in the form of heat (a lit match) to overcome that barrier is called the activation energy.
We can apply this to lots of other systems as well. One of the most famous and still extensively researched examples is glasses.
Glasses are interesting because they are examples of kinetic stability in physical phases. Usually, phase changes are governed by thermodynamic stability. In glassy solids, the molecules would have a lower potential energy if they were arranged in a crystalline structure, but because they don't have the energy needed to get out of the local minimum, they are "stuck" with a liquid-like disordered structure, even though the phase is a solid.


Question:
In "Surely You're Joking, Mr. Feynman!," Nobel-prize winning Physicist Richard Feynman said that he challenged his colleagues to give him an integral that they could evaluate with only complex methods that he could not do with real methods:

One time I boasted, "I can do by other methods any integral anybody else needs contour integration to do."
So Paul [Olum] puts up this tremendous damn integral he had obtained by starting out with a complex function that he knew the answer to, taking out the real part of it and leaving only the complex part. He had unwrapped it so it was only possible by contour integration! He was always deflating me like that. He was a very smart fellow.

Does anyone happen to know what this integral was?

I doubt that we will ever know the exact integral that vexed Feynman.
Here is something similar to what he describes.
Suppose $f(z)$ is an analytic function on the unit disk.
Then, by Cauchy's integral formula,
$$\oint_\gamma \frac{f(z)}{z}dz = 2\pi i f(0),$$
where $\gamma$ traces out the unit circle in a counterclockwise manner.
Let $z=e^{i\phi}$.
Then
$\int_0^{2\pi}f(e^{i\phi}) d\phi = 2\pi f(0).$
Taking the real part of each side we find
$$\begin{equation*}
\int_0^{2\pi} \mathrm{Re}(f(e^{i\phi}))d\phi = 2\pi \mathrm{Re}(f(0)).\tag{1}
\end{equation*}$$
(We could just as well take the imaginary part.)
Clearly we can build some terrible integrals by choosing $f$ appropriately.
Example 1.
Let $\displaystyle f(z) = \exp\frac{2+z}{3+z}$.
This is a mild choice compared to what could be done ...
In any case, $f$ is analytic on the disk.
Applying (1), and after some manipulations of the integrand, we find
$$\int_0^{2\pi}
\exp\left(\frac{7+5 \cos\phi}{10+6\cos\phi}\right)
\cos \left(
\frac{\sin\phi}{10+6 \cos\phi}
\right)
d\phi = 2\pi e^{2/3}.$$
Example 2.
Let $\displaystyle f(z) = \exp \exp \frac{2+z}{3+z}$.
Then
\begin{align*}\int_0^{2\pi} &
\exp\left(
	\exp\left(
		\frac{7+5 \cos \phi}{10+6 \cos \phi}
	\right)
	\cos\left(
		\frac{\sin \phi}{10+6 \cos \phi}
	\right)
\right) \\
& \times\cos\left(
	\exp\left(
    	\frac{7+5 \cos \phi}{10+6 \cos \phi}
    \right)
	\sin\left(
    	\frac{\sin \phi}{10+6 \cos \phi}
    \right)
\right) = 2\pi e^{e^{2/3}}.
\end{align*}


Question:
I have to do cross correlation of two audio file to prove they are similar.
I have taken the FFT of the two audio files and have their power spectrum values in separate arrays.
How should I proceed further to cross-correlate them and prove that they're similar? Is there a better way to do it? Any basic ideas will be helpful for me to learn and apply it.

Cross-correlation and convolution are closely related.  In short, to do convolution with FFTs, you

zero-pad the input signals a and b (add zeros to the end of each. The zero padding should fill the vectors until they reach a size of at least N = size(a)+size(b)-1)
take the FFT of both signals
multiply the results together (element-wise multiplication)
do the inverse FFT

conv(a, b) = ifft(fft(a_and_zeros) * fft(b_and_zeros))
You need to do the zero-padding because the FFT method is actually circular cross-correlation, meaning the signal wraps around at the ends.  So you add enough zeros to get rid of the overlap, to simulate a signal that is zero out to infinity.
To get cross-correlation instead of convolution, you either need to time-reverse one of the signals before doing the FFT, or take the complex conjugate of one of the signals after the FFT:

corr(a, b) = ifft(fft(a_and_zeros) * fft(b_and_zeros[reversed]))
corr(a, b) = ifft(fft(a_and_zeros) * conj(fft(b_and_zeros)))

whichever is easier with your hardware/software.  For autocorrelation (cross-correlation of a signal with itself), it's better to do the complex conjugate, because then you only need to calculate the FFT once.
If the signals are real, you can use real FFTs (RFFT/IRFFT) and save half your computation time by only calculating half of the spectrum.
Also you can save computation time by padding to a larger size that the FFT is optimized for (such as a 5-smooth number for FFTPACK, a ~13-smooth number for FFTW, or a power of 2 for a simple hardware implementation).
Here's an example in Python of FFT correlation compared with brute-force correlation:
This will give you the cross-correlation function, which is a measure of similarity vs offset.  To get the offset at which the waves are "lined up" with each other, there will be a peak in the correlation function:

The x value of the peak is the offset, which could be negative or positive.
I've only seen this used to find the offset between two waves.  You can get a more precise estimate of the offset (better than the resolution of your samples) by using parabolic/quadratic interpolation on the peak.
To get a similarity value between -1 and 1 (a negative value indicating one of the signals decreases as the other increases) you'd need to scale the amplitude according to the length of the inputs, length of the FFT, your particular FFT implementation's scaling, etc.  The autocorrelation of a wave with itself will give you the value of the maximum possible match.
Note that this will only work on waves that have the same shape.  If they've been sampled on different hardware or have some noise added, but otherwise still have the same shape, this comparison will work, but if the wave shape has been changed by filtering or phase shifts, they may sound the same, but won't correlate as well.


Question:
Last night my daughter was asking why a mirror "always does that" (referring to reflecting a spot of light). To help her figure it out, I grabbed my green laser pointer so she could see the light traveling from the source and reflecting off the mirror.
But as we were playing, I noticed something strange.
Rather than one spot, there were several. When I adjusted the angle to something fairly obtuse

The effect became quite pronounced

And when you looked closely, you could actually see several beams

(Of course, the beams actually looked like beams in real life. The picture gives the beams an elongated hourglass shape because those parts are out of focus.)
I made these observations:

The shallower the angle, the greater the spread of the split beams and resulting dots.
The directionality of the reflection is due to the orientation of the mirror, not the laser pointer itself. Indeed, by rotating the mirror 360° the string of dots would make a full rotation as well.
I can count at least 8 individual dots on the wall, but I could only see 6 beams with the naked eye.
If you look at the split beam picture you can see a vertical line above the most intense dots. I didn't observe any intense spots of light there.

And when I looked closely at the spot where the beam hit the mirror

you can see a double image. This was not due to camera shake, just the light reflecting off the dust on the surface of the glass, and a reflection of that light from the rear surface of the mirror.
It's been a few years since college physics, I remembered doing things like the double split experiment. I also remembered that light seems like it does some strange things when it enters liquid/prisms. I also know that the green laser has a certain wavelength, and you can measure the speed of light with a chocolate bar and a microwave.
Why does the mirror split the laser beam? How does that explain the effects that I saw? Is there any relation to the double split experiment, or the wavelength/speed of light?

You are getting reflections from the front (glass surface) and back (mirrored) surface, including (multiple) internal reflections:

It should be obvious from this diagram that the spots will be further apart as you move to a more glancing angle of incidence. Depending on the polarization of the laser pointer, there is an angle (the Brewster angle) where you can make the front (glass) surface reflection disappear completely. This takes some experimenting.
The exact details of the intensity as a function of angle of incidence are described by the Fresnel Equations. From that Wikipedia article, here is a diagram showing how the intensity of the (front) reflection changes with angle of incidence and polarization:

This effect is independent of wavelength (except inasmuch as the refractive index is a weak function of wavelength... So different colors of light will have a slightly different Brewster angle); the only way in which laser light is different from "ordinary" light in this case is the fact that laser light is typically linearly polarized, so that the reflection coefficient for a particular angle can be changed simply by rotating the laser pointer.
As Rainer P pointed out in a comment, if there is a coefficient of reflection $c$ at the front face, then $(1-c)$ of the intensity makes it to the back; and if the coefficient of reflection at the inside of the glass/air interface is $r$, then the successive reflected beams will have intensities that decrease geometrically:
$$c, (1-c)(1-r), (1-c)(1-r)r, (1-c)(1-r)r^2, (1-c)(1-r)r^3, ...$$
Of course the reciprocity theorem tells us that when we reverse the direction of a beam, we get the same reflectivity, so $r=c$ . This means the above can be simplified; but I left it in this form to show better what interactions the rays undergo. The above also assumes perfect reflection at the silvered (back) face: it should be easy to see how you could add that term...


Question:
I do not remember precisely what the equations or who the relevant mathematicians and physicists were, but I recall being told the following story. I apologise in advance if I have misunderstood anything, or just have it plain wrong. The story is as follows.

A quantum physicist created some equations to
  model what we already know about sub-atomic particles. His equations
  and models are amazingly accurate, but they only seem to be
  able to hold true if a mysterious particle,
  currently unknown to humanity, exists.
More experiments are run and lo and
  behold, that 'mysterious particle' in actual fact exists! It was found to be a quark/dark-matter/anti-matter, or something of the sort.

What similar occurrences in history have occurred, where the mathematical model was so accurate/good, that it 'accidentally' led to the discovery of something previously unknown?
If you have an answer, could you please provide the specific equation(s), or the name of the equation(s), that directly led to this?
I can recall one other example.

Maxwell's equations predicted the existence of radio waves, which were
  then found by Hertz.

The planet Neptune's discovery was an example of something similar to this. It was known that Newtons's Equations gave the wrong description of the motion of Uranus and Mercury. Urbain Le Verrier sat down and tried to see what would happen if we assumed that the equations were right and the universe was wrong. He set up a complicated system of equations that incorporated a lot of ways contemporary knowledge of the universe could wrong, including the number of planets, the location and mass of the planets, and the presences of the forces other than gravity. He would eventually find a solution to the equations where the dominating error was the presence of another, as of yet undetected, planet. His equations gave the distance from the sun and the mass of the planet correctly, as well as enough detail about the planet's location in the sky that it was found with only an hour of searching.
Mercury's orbit's issues would eventually be solved by General Relativity.


Question:
There is an obvious difference between finite difference and the finite volume method (moving from point definition of the equations to integral averages over cells). But I find FEM and FVM to be very similar; they both use integral form and average over cells.
What is the FEM method doing that the FVM is not? I have read a little background on the FEM I understand that the equations are written in the weak form, this gives the method a slightly different stating point than the FVM. However, I don't understand on a conceptual level what the differences are. Does FEM make some assumption regarding how the unknown varies inside the cell, can't this also be done with FVM?
I am mostly coming from 1D perspective so maybe FEM has advantages with more than one dimension?
I haven't found much information available on this topic on the net. Wikipedia has a section on how the FEM is different from finite difference method, but that is about it,

Finite Element: volumetric integrals, internal polynomial order
Classical finite element methods assume continuous or weakly continuous approximation spaces and ask for volumetric integrals of the weak form to be satisfied.  The order of accuracy is increased by raising the approximation order within elements.  The methods are not exactly conservative, thus often struggle with stability for discontinuous processes.
Finite Volume: surface integrals, fluxes from discontinuous data, reconstruction order
Finite volume methods use piecewise constant approximation spaces and ask for integrals against piecewise constant test functions to be satisfied.  This yields exact conservation statements.  The volume integral is converted to a surface integral and the entire physics is specified in terms of fluxes in those surface integrals.  For first-order hyperbolic problems, this is a Riemann solve.  Second order/elliptic fluxes are more subtle.  Order of accuracy is increased by using neighbors to (conservatively) reconstruct higher order representations of the state inside elements (slope reconstruction/limiting) or by reconstructing fluxes (flux limiting).  The reconstruction process is usually nonlinear to control oscillations around discontinuous features of the solution, see total variation diminishing (TVD) and essentially non-oscillatory (ENO/WENO) methods.  A nonlinear discretization is necessary to simultaneously obtain both higher than first order accuracy in smooth regions and bounded total variation across discontinuities, see Godunov's theorem.
Comments
Both FE and FV are easy to define up to second order accuracy on unstructured grids.  FE is easier to go beyond second order on unstructured grids.  FV handles non-conforming meshes more easily and robustly.
Combining FE and FV
The methods can be married in multiple ways.  Discontinuous Galerkin methods are finite element methods that use discontinuous basis functions, thus acquiring Riemann solvers and more robustness for discontinuous processes (especially hyperbolic).  DG methods can be used with nonlinear limiters (usually with some reduction in accuracy), but satisfy a cell-wise entropy inequality without limiting and can thus be used without limiting for some problems where other schemes require limiters.  (This is especially useful for adjoint-based optimization since it makes the discrete adjoint more representative of the continuous adjoint equations.)  Mixed FE methods for elliptic problems use discontinuous basis functions and after some choices of quadrature, can be reinterpreted as standard finite volume methods, see this answer for more.  Reconstruction DG methods (aka. $P_N P_M$ or "Recovery DG") use both FV-like conservative reconstruction and internal order enrichment, and are thus a superset of FV and DG methods.


Question:
I just came back from my Number Theory course, and during the lecture there was mention of the Collatz Conjecture.
I'm sure that everyone here is familiar with it; it describes an operation on a natural number – $n/2$ if it is even, $3n+1$ if it is odd.
The conjecture states that if this operation is repeated, all numbers will eventually wind up at $1$ (or rather, in an infinite loop of $1-4-2-1-4-2-1$).
I fired up Python and ran a quick test on this for all numbers up to $5.76 \times 10^{18}$ (using the powers of cloud computing and dynamic programming magic).  Which is millions of millions of millions. And all of them eventually ended up at $1$.
Surely I am close to testing every natural number? How many natural numbers could there be?  Surely not much more than millions of millions of millions. (I kid.)
I explained this to my friend, who told me, "Why would numbers suddenly get different at a certain point?  Wouldn't they all be expected to behave the same?"
To which I said, "No, you are wrong!  In fact, I am sure there are many conjectures which have been disproved by counterexamples that are extremely large!"
And he said, "It is my conjecture that there are none! (and if any, they are rare)".
Please help me, smart math people.  Can you provide a counterexample to his conjecture?  Perhaps, more convincingly, several?  I've only managed to find one! (Polya's conjecture). One, out of the many thousands (I presume) of conjectures. It's also one that is hard to explain the finer points to the layman. Are there any more famous or accessible examples?

Another example: Euler's sum of powers conjecture, a generalization of Fermat's Last Theorem. It states:
If the equation $\sum_{i=1}^kx_i^n=z^n$ has a solution in positive integers, then $n \leq k$ (unless $k=1$). Fermat's Last Theorem is the $k=2$ case of this conjecture.
A counterexample for $n=5$ was found in 1966: it's
$$
61917364224=27^5+84^5+110^5+133^5=144^5
$$
The smallest counterexample for $n=4$ was found in 1988:
$$
31858749840007945920321 = 95800^4+217519^4+414560^4=422481^4
$$
This example used to be even more useful in the days before FLT was proved, as an answer to the question "Why do we need to prove FLT if it has been verified for thousands of numbers?" :-)


Question:
As Wikipedia says:

[...] the kinetic energy of a non-rotating object of mass $m$ traveling at a speed $v$ is $\frac{1}{2}mv^2$.

Why does this not increase linearly with speed? Why does it take so much more energy to go from $1\ \mathrm{m/s}$ to $2\ \mathrm{m/s}$ than it does to go from $0\ \mathrm{m/s}$ to $1\ \mathrm{m/s}$?
My intuition is wrong here, please help it out!

The previous answers all restate the problem as "Work is force dot/times distance". But this is not really satisfying, because you could then ask "Why is work force dot distance?" and the mystery is the same.
The only way to answer questions like this is to rely on symmetry principles, since these are more fundamental than the laws of motion. Using Galilean invariance, the symmetry that says that the laws of physics look the same to you on a moving train, you can explain why energy must be proportional to the mass times the velocity squared.
First, you need to define kinetic energy. I will define it as follows: the kinetic energy $E(m,v)$ of a ball of clay of mass $m$ moving with velocity $v$ is the amount of calories of heat that it makes when it smacks into a wall. This definition does not make reference to any mechanical quantity, and it can be determined using thermometers. I will show that, assuming Galilean invariance, $E(v)$ must be the square of the velocity.
$E(m,v)$, if it is invariant, must be proportional to the mass, because you can smack two clay balls side by side and get twice the heating, so
$$ E(m,v) = m E(v)$$
Further, if you smack two identical clay balls of mass $m$ moving with velocity $v$ head-on into each other, both balls stop, by symmetry. The result is that each acts as a wall for the other, and you must get an amount of heating equal to $2m E(v)$.
But now look at this in a train which is moving along with one of the balls before the collision. In this frame of reference, the first ball starts out stopped, the second ball hits it at $2v$, and the two-ball stuck system ends up moving with velocity $v$.
The kinetic energy of the second ball is $mE(2v)$ at the start, and after the collision, you have $2mE(v)$ kinetic energy stored in the combined ball. But the heating generated by the collision is the same as in the earlier case. So there are now two $2mE(v)$ terms to consider: one representing the heat generated by the collision, which we saw earlier was $2mE(v)$, and the other representing the energy stored in the moving, double-mass ball, which is also $2mE(v)$. Due to conservation of energy, those two terms need to add up to the kinetic energy of the second ball before the collision:
$$ mE(2v) = 2mE(v) + 2mE(v)$$
$$ E(2v) = 4 E(v)$$
which implies that $E$ is quadratic.
Non-circular force-times-distance
Here is the non-circular version of the force-times-distance argument that everyone seems to love so much, but is never done correctly. In order to argue that energy is quadratic in velocity, it is enough to establish two things:

Potential energy on the Earth's surface is linear in height
Objects falling on the Earth's surface have constant acceleration

The result then follows.
That the energy in a constant gravitational field is proportional to the height is established by statics. If you believe the law of the lever, an object will be in equilibrium with another object on a lever when the distances are inversely proportional to the masses (there are simple geometric demonstrations of this that require nothing more than the fact that equal mass objects balance at equal center-of-mass distances). Then if you tilt the lever a little bit, the mass-times-height gained by 1 is equal to the mass-times-height gained by the other. This allows you to lift objects and lower them with very little effort, so long as the mass-times-height added over all the objects is constant before and after.This is Archimedes' principle.
Another way of saying the same thing uses an elevator, consisting of two platforms connected by a chain through a pulley, so that when one goes up, the other goes down. You can lift an object up, if you lower an equal amount of mass down the same amount. You can lift two objects a certain distance in two steps, if you drop an object twice as far.
This establishes that for all reversible motions of the elevator, the ones that do not require you to do any work (in both the colloquial sense and the physics sense--- the two notions coincide here), the mass-times-height summed over all the objects is conserved. The "energy" can now be defined as that quantity of motion which is conserved when these objects are allowed to move with a non-infinitesimal velocity. This is Feynman's version of Archimedes.
So the mass-times-height is a measure of the effort required to lift something, and it is a conserved quantity in statics. This quantity should be conserved even if there is dynamics in intermediate stages. By this I mean that if you let two weights drop while suspended on a string, let them do an elastic collision, and catch the two objects when they stop moving again, you did no work. The objects should then go up to the same total mass-times-height.
This is the original demonstration of the laws of elastic collisions by Christian Huygens, who argued that if you drop two masses on pendulums, and let them collide, their center of mass has to go up to the same height, if you catch the balls at their maximum point. From this, Huygens generalized the law of conservation of potential energy implicit in Archimedes to derive the law of conservation of square-velocity in elastic collisions. His principle that the center of mass cannot be raised by dynamic collisions is the first statement of conservation of energy.
For completeness, the fact that an object accelerates in a constant gravitational field with uniform acceleration is a consequence of Galilean invariance, and the assumption that a gravitational field is frame invariant to uniform motions up and down with a steady velocity. Once you know that motion in constant gravity is constant acceleration, you know that
$$ mv^2/2 + mgh = C $$
so that Huygens dynamical quantity which is additively conserved along with Archimedes mass times height is the velocity squared.


Question:
I understand that GPUs are generally used to do LOTS of calculations in parallel. I understand why we would want to parallelize processes in order to speed things up. However, GPUs aren't always better than CPUs, as far as  I know.
What kinds of tasks are GPUs bad at? When would we prefer CPU over GPU for processing?

GPUs are bad at doing one thing at a time.  A modern high-end GPU may have several thousand cores, but these are organized into SIMD blocks of 16 or 32.  If you want to compute 2+2, you might have 32 cores each compute an addition operation, and then discard 31 of the results.
GPUs are bad at doing individual things fast.  GPUs only recently topped the one-gigahertz mark, something that CPUs did more than twenty years ago.  If your task involves doing many things to one piece of data, rather than one thing to many pieces of data, a CPU is far better.
GPUs are bad at dealing with data non-locality.  The hardware is optimized for working on contiguous blocks of data.  If your task involves picking up individual pieces of data scattered around your data set, the GPU's incredible memory bandwidth is mostly wasted.


Question:
Okay, so everyone knows the usual methods of solving integrals, namely u-substitution, integration by parts, partial fractions, trig substitutions, and reduction formulas. But what else is there? Every time I search for "Advanced Techniques of Symbolic Integration" or "Super Advanced Integration Techniques", I get the same results which end up only talking about the methods mentioned above. Are there any super obscure and interesting techniques for solving integrals?
As an example of something that might be obscure, the formula for "general integration by parts " for $n$ functions $f_j, \ j = 1,\cdots,n$ is given by
$$
\int{f_1'(x)\prod_{j=2}^n{f_j(x)}dx} = \prod_{i=1}^n{f_i(x)} - \sum_{i=2}^n{\int{f_i'(x)\prod_{\substack{j=1 \\ j \neq i}}^n{f_j(x)}dx}}
$$
which is not necessarily useful nor difficult to derive, but is interesting nonetheless.
So out of curiosity, are there any crazy unknown symbolic integration techniques?

Here are a few. The first one is included because it's not very well known and is not general, though the ones that follow are very general and very useful.

A great but not very well known way to find the primitive of $f^{-1}$ in terms of  the primitive of $f$, $F$, is (very easy to prove: just differentiate both sides and use the chain rule):
$$
\int f^{-1}(x)\, dx = x \cdot f^{-1}(x)-(F \circ f^{-1})(x)+C.
$$

Examples:

$$
\begin{aligned}
\displaystyle \int \arcsin(x)\, dx
&= x \cdot \arcsin(x)- (-\cos\circ \arcsin)(x)+C \\
&=x \cdot \arcsin(x)+\sqrt{1-x^2}+C.
\end{aligned}
$$
$$
\begin{aligned}
\int \log(x)\, dx
&= x \cdot \log(x)-(\exp \circ \log)(x) + C \\
&= x \cdot \left( \log(x)-1 \right) + C.
\end{aligned}
$$

This one is more well known, and extremely powerful, it's called differentiating under the integral sign. It requires ingenuity most of the time to know when to apply, and how to apply it, but that only makes it more interesting. The technique uses the simple fact that
$$
\frac{\mathrm d}{\mathrm d x} \int_a^b f \left({x, y}\right) \mathrm d y = \int_a^b \frac{\partial f}{\partial x} \left({x, y}\right) \mathrm d y.
$$

Example:

We want to calculate the integral $\int_{0}^{\infty} \frac{\sin(x)}{x} dx$. To do that, we unintuitively consider the more complicated integral $\int_{0}^{\infty} e^{-tx} \frac{\sin(x)}{x} dx$ instead.
Let $$ I(t)=\int_{0}^{\infty} e^{-tx} \frac{\sin(x)}{x} dx,$$ then $$ I'(t)=-\int_{0}^{\infty} e^{-tx} \sin(x) dx=\frac{e^{-t x} (t \sin (x)+\cos (x))}{t^2+1}\bigg|_0^{\infty}=\frac{-1}{1+t^2}.$$
Since both $I(t)$ and $-\arctan(t)$ are primitives of $\frac{-1}{1+t^2}$, they must differ only by a constant, so that $I(t)+\arctan(t)=C$. Let $t\to \infty$, then $I(t) \to 0$ and $-\arctan(t) \to -\pi/2$, and hence $C=\pi/2$, and $I(t)=\frac{\pi}{2}-\arctan(t)$.
Finally,
  $$
\int_{0}^{\infty} \frac{\sin(x)}{x} dx = I(0) = \frac{\pi}{2}-\arctan(0) = \boxed{\frac{\pi}{2}}.
$$

This one is probably the most commonly used "advanced integration technique", and for good reasons. It's referred to as the "residue theorem" and it states that if $\gamma$ is a counterclockwise simple closed curve, then $\displaystyle \int_\gamma f(z) dz = 2\pi i \sum_{k=1}^n \operatorname{Res} ( f, a_k )$ . It will be difficult for you to understand this one without knowledge in complex analysis, but you can get the gist of it with the wiki article.
Example:

We want to compute $\int_{-\infty}^{\infty} \frac{x^2}{1+x^4} dx$.  The poles of our function $f(z)=\frac{x^2}{1+x^4}$ in the upper half plane are  $a_1=e^{i \frac{\pi}{4}}$ and $a_2=e^{i \frac{3\pi}{4}}$. The residues of our function at those points are
  $$\operatorname{Res}(f,a_1)=\lim_{z\to a_1} (z-a_1)f(z)=\frac{e^{i \frac{-\pi}{4}}}{4},$$
  and
  $$\operatorname{Res}(f,a_2)=\lim_{z\to a_2} (z-a_2)f(z)=\frac{e^{i \frac{-3\pi}{4}}}{4}.$$
  Let $\gamma$ be the closed path around the boundary of the semicircle of radius $R>1$ on the upper half plane, traversed in the counter-clockwise direction. Then the residue theorem gives us ${1 \over 2\pi i} \int_\gamma f(z)\,dz=\operatorname{Res}(f,a_1)+\operatorname{Res}(f,a_2)={1 \over 4}\left({1-i \over \sqrt{2}}+{-1-i \over \sqrt{2}}\right)={-i \over 2 \sqrt{2}}$ and $ \int_\gamma f(z)\,dz= {\pi \over \sqrt{2}}$.
  Now, by the definition of $\gamma$, we have:
  $$\int_\gamma f(z)\,dz = \int_{-R}^R \frac{x^2}{1+x^4} dx + \int_0^\pi {i (R e^{it})^3 \over 1+(R e^{it})^4} dz = {\pi \over \sqrt{2}}.$$
  For the integral on the semicircle
  $$
\int_0^\pi {i (R e^{it})^3 \over 1+(R e^{it})^4} dz,
$$
  we have
  $$
\begin{aligned}
\left| \int_0^\pi {i (R e^{it})^3 \over 1+(R e^{it})^4} dz \right|
&\leq \int_0^\pi \left| {i (R e^{it})^3 \over 1+(R e^{it})^4} \right| dz \\
&\leq \int_0^\pi {R^3 \over R^4-1} dz={\pi R^3 \over R^4-1}.
\end{aligned}
$$
  Hence, as $R\to \infty$, we have ${\pi R^3 \over R^4-1} \to 0$, and hence $\int_0^\pi {i (R e^{it})^3 \over 1+(R e^{it})^4} dz \to 0$.
  Finally,
  $$
\begin{aligned}
\int_{-\infty}^\infty \frac{x^2}{1+x^4} dx
&= \lim_{R\to \infty} \int_{-R}^R \frac{x^2}{1+x^4} dx  \\
&= \lim_{R\to \infty} {\pi \over \sqrt{2}}-\int_0^\pi {i (R e^{it})^3 \over 1+(R e^{it})^4} dz =\boxed{{\pi \over \sqrt{2}}}.
\end{aligned}
$$

My final "technique" is the use of the mean value property for complex analytic functions, or Cauchy's integral formula in other words:
$$
\begin{aligned}
f(a)
&= \frac{1}{2\pi i} \int_\gamma \frac{f(z)}{z-a}\, dz \\
&= \frac{1}{2\pi} \int_{0}^{2\pi} f\left(a+e^{ix}\right) dx.
\end{aligned}
$$

Example:

We want to compute the very messy looking integral $\int_0^{2\pi} \cos (\cos (x)+1) \cosh (\sin (x)) dx$. We first notice that
  $$
\begin{aligned}
&\hphantom{=} \cos [\cos (x)+1] \cosh [\sin (x)] \\
&=\Re\left\{
\cos [\cos (x)+1] \cosh [\sin (x)]
-i\sin [\cos (x)+1] \sinh [\sin (x)]
\right\} \\
&= \Re \left[ \cos \left( 1+e^{i x} \right) \right].
\end{aligned}
$$
  Then, we have
  $$
\begin{aligned}
\int_0^{2\pi} \cos [\cos (x)+1] \cosh [\sin (x)] dx
&= \int_0^{2\pi} \Re \left[ \cos \left( 1+e^{i x} \right) \right] dx \\
&= \Re \left[ \int_0^{2\pi} \cos \left( 1+e^{i x} \right) dx \right] \\
&= \Re \left( \cos(1) \cdot 2 \pi \right)= \boxed{2 \pi \cos(1)}.
\end{aligned}
$$


Question: When people get sick, they often develop a fever. What is the effect of an increased body temperature on viruses and bacteria in the body? Is it beneficial to the infected body? Importantly, often fever-reducing agents like aspirin are prescribed when people are sick. Doesn't this counteract any benefits of fever?

Fever is a trait observed in warm and cold-blooded vertebrates that has been conserved for hundreds of millions of years (Evans, 2015).
Elevated body temperature stimulates the body's immune response against infectious viruses and bacteria. It also makes the body less favorable as a host for replicating viruses and bacteria, which are temperature sensitive (Source: Sci Am).
The innate system is stimulated by increasing the recruitment, activation and bacteriolytic activity of neutrophils. Likewise, natural killer cells' cytotoxic activity is enhanced and their recruitment is increased, including that to tumors. Macrophages and dendritic cells increase their activity in clearing up the mess associated with infection.
Also the adaptive immune response is enhanced by elevated temperatures. For example, the circulation of T cells to the lymph nodes is increased and their proliferation is stimulated.
In fact, taking pain killers that reduce fever have been shown to lead to poorer clearance of pathogens from the body (Evans, 2015). In adults, when body temperature reaches 104 oF (40 oC) it can become dangerous and fever reducing agents like aspirin are recommended (source: eMedicine)
Reference
- Evans, Nat Rev Immunol (2015); 15(6): 335–49


Question:
I have a bag of about 50 non-rechargeable AA batteries (1.5 V) that I have collected over the years.  I bought a multimeter recently and would like to know the best way to test these batteries to determine which ones I should keep and which I should toss.
Sometimes a battery will be useless for certain high-power devices (e.g. children's toys) but are still perfectly suitable for low-power devices such as TV remote controls.  Ideally, I'd like to divide the batteries into several arbitrary categories:

As-new condition (suitable for most devices)
Suitable for low-powered devices such as remote controls
Not worth keeping

Should I be measuring voltage, current, power or a combination of several of these?  Is there a simple metric I can use to determine what to keep and what to toss?

**WARNING: Lithium Ion cells **

While this question relates to non-rechargeable AA cells it is possible that someone may seek to extend the advice to testing other small cells.
In the case Of Li-Ion rechargeable cells (AA, 18650, other) this can be a very bad idea in some cases.

Shorting Lithium Ion cells as in test 2 is liable to be a very bad idea indeed.
Depending on design, some Li-Ion cells will provide short circuit current of many times the cell mAh rating - eg perhaps 50+ amps for an 18650 cell, and perhaps 10's of amps for an AA size Li-Ion cell.

This level of discharge can cause injury and worst case may destroy the cell, in some uncommon cases with substantial release of energy in the form of flame and hot material.

AA  non-rechargeable cells:
1) Ignore the funny answers
Generally speaking, if a battery is more than 1 year old then only Alkaline batteries are worth keeping. Shelf life of non-Alkaline can be some years but they deteriorate badly with time. Modern Alkaline have gotten awesome, as they still retain a majority of charge at 3 to 5 years.
Non brand name batteries are often (but not always) junk.
Heft battery in hand. Learn to get the feel of what a "real" AA cell weighs. An Eveready or similar Alkaline will be around 30 grams/one ounce. An AA NiMH 2500 mAh will be similar. Anything under 25g is suspect. Under 20g is junk. Under 15g is not unknown.
2) Brutal but works
Set multimeter to high current range (10A or 20A usually). Needs both dial setting and probe socket change in most meters.
Use two sharpish probes.
If battery has any light surface corrosion scratch a clean bright spot with probe tip. If it has more than surface corrosion consider binning it. Some Alkaline cells leak electrolyte over time, which is damaging to gear and annoying (at least) to skin.
Press negative probe against battery base. Move slightly to make scratching contact. Press firmly. DO NOT slip so probe jumps off battery and punctures your other hand. Not advised. Ask me how I know.
Press positive probe onto top of battery. Hold for maybe 1 second. Perhaps 2. Experience will show what is needed. This is thrashing the battery, decreasing its life and making it sad. Try not to do this often or for very long.

Top AA Alkaline cells new will give 5-10 A. (NiMH AA will approach 10A for a good cell).

Lightly used AA or ones which have had bursts of heavy use and then recovered will typically give a few amps.
Deader again will be 1-3A.
Anything under 1 A you probably want to discard unless you have a micropower application.
Non Alkaline will usually be lower. I buy ONLY Alkaline primary cells as other "quality" cells are usually not vastly cheaper but are of much lower capacity.
Current will fall with time. A very good cell will fall little over 1 to maybe 2 seconds. More used cells will start lower and fall faster. Well used cells may plummet.
I place cells in approximate order of current after testing. The top ones can be grouped and wrapped with a rubber band. The excessively keen may mark the current given on the cell with a marker. Absolute current is not the point - it serves as a measure of usefulness.
3) Gentler - but works reasonably well.
Set meter to 2V range or next above 2V if no 2V range.
Measure battery unloaded voltage.
New unused Alkaline are about 1.65V. Most books don't tell you that.
Unused but sat on the shelf 1 year + Alkaline will be down slightly. Maybe 1.55 - 1.6V
Modestly used cells will be 1.5V+
Used but useful may be 1.3V - 1.5V range
After that it's all downhill. A 1V OC cell is dodo dead. A 1.1V -.2V cell will probably load down to 1V if you look at it harshly. Do this a few times and you will get a feel for it.
4) In between.
Use a heavyish load and measure voltage. Keep a standard resistor for this.
SOLDER the wires on that you use as probes. A twisted connection has too much variability.
Resistor should draw a heavy load for battery type used.
100 mA - 500 mA is probably OK.
Battery testers usually work this way.
5) Is this worth doing?
Yes, it is. As well as returning a few batteries to the fold and making your life more exciting when some fail to perform, it teaches you a new skill that can be helpful in understanding how batteries behave in real life and the possible effect on equipment. The more you know, the more you get to know, and this is one more tool along the path towards knowing everything :-). [The path is rather longer than any can traverse, but learning how to run along it can be fun].


Question: The AIC and BIC are both methods of assessing model fit penalized for the number of estimated parameters.  As I understand it, BIC penalizes models more for free parameters than does AIC.  Beyond a preference based on the stringency of the criteria, are there any other reasons to prefer AIC over BIC or vice versa?

Your question implies that AIC and BIC try to answer the same question, which is not true. The AIC tries to select the model that most adequately describes an unknown, high dimensional reality. This means that reality is never in the set of candidate models that are being considered.  On the contrary, BIC tries to find the TRUE model among the set of candidates. I find it quite odd the assumption that reality is instantiated in one of the models that the researchers built along the way. This is a real issue for BIC.
Nevertheless, there are a lot of researchers who say BIC is better than AIC, using model recovery simulations as an argument. These simulations consist of generating data from models A and B, and then fitting both datasets with the two models. Overfitting occurs when the wrong model fits the data better than the generating. The point of these simulations is to see how well AIC and BIC correct these overfits. Usually, the results point to the fact that AIC is too liberal and still frequently prefers a more complex, wrong model over a simpler, true model. At first glance these simulations seem to be really good arguments, but the problem with them is that they are meaningless for AIC. As I said before, AIC does not consider that any of the candidate models being tested is actually true. According to AIC, all models are approximations to reality, and reality should never have a low dimensionality. At least lower than some of the candidate models.
My recommendation is to use both AIC and BIC. Most of the times they will agree on the preferred model, when they don't, just report it.
If you are unhappy with both AIC and BIC and have free time to invest, look up Minimum Description Length (MDL), a totally different approach that overcomes the limitations of AIC and BIC. There are several measures stemming from MDL, like normalized maximum likelihood or the Fisher Information approximation. The problem with MDL is that its mathematically demanding and/or computationally intensive.
Still, if you want to stick to simple solutions, a nice way for assessing model flexibility (especially when the number of parameters are equal, rendering AIC and BIC useless) is doing Parametric Bootstrap, which is quite easy to implement. Here is a link to a paper on it.
Some people here advocate for the use of cross-validation. I personally have used it and don't have anything against it, but the issue with it is that the choice among the sample-cutting rule (leave-one-out, K-fold, etc) is an unprincipled one.