Feb 262016

As I am watching a speech by Donald Trump, I am beginning to have a whole new appreciation of Adolf Hitler.

Just how powerful is the message of hate!

And with each new public appearance, Trump improves his mastery of it.

Everything he says is about hate.

He tells you to hate illegal immigrants because they murder innocent Americans.

To hate Syrians because you don’t know where they came from, what they want, and where they are.

To hate gun control advocates because they are helping “these animals” who shot up 135 people in Paris.

To hate the Iranians. Common Core. Obama (of course). The (cheating and lying) media. Newspapers. Republican rivals.

Because “the American dream is dead” but Trump will fix things and “make America great again”.

Americans generally are not hateful people. In the past, they resisted the message of hate. During the Great Depression, the message of hope prevailed. During the Cold War, Joe McCarthy’s hateful witch hunt ended in disgrace.

But now… I never thought I’d see it within my lifetime, but the message of hate is back, and it may be more powerful than ever.

And it is bloody scary.

 Posted by at 2:25 pm
Feb 232016

Here is a spectacular photograph of the Moon made last night by my good friend David Ada-Winter in light-polluted New Jersey:

David explains: “I took this picture of the Moon using the so-called Sunny 16 rule, the essence of which is the following: On a clear day, with an aperture of 16, the exposition time must be the reciprocal of the ISO value. In the case of this picture, the ISO was 200, so the exposition time was 1/200 with an aperture of 16. In front of my telescopic lens, I also used a doubler that extended the focal length to 800 mm. The picture itself was made with the Canon Rebel t2i camera, which has a crop factor of 1.6, allowing the Moon to appear even larger in the image.”

Apparently, David’s wife disapproves of his pricey hobby. I’m tempted to remind her that other men of David’s age often acquire even pricier hobbies, which usually involve brightly colored sports cars and lightly clad ladies…

 Posted by at 9:46 pm
Feb 212016

Take this dystopian science-fiction story, in which a major military power is using machine intelligence to identify potential threats, which it then eliminates using unmanned drones.

The twist of the story is that even a very accurate algorithm can lead to unintended consequences when the actual threat ratio is very low. This is a classic problem known from statistics.

Imagine that out of a population of a hundred million, only 100 people represent a threat, and the algorithm is 99% accurate identifying them.

Which means that out of the 100 threats, it will miss only 1. So far, so good.

Unfortunately, it also means that out of the remaining 99,999,900, it will falsely identify 999,999 as threats even when they aren’t. So out of the 1,000,098 people who are targeted, onl 99 are genuine threats; the remaining 999,999 are innocent.

OK, improve the algorithm. Perhaps at the expense of having more false negatives, say, 50%, increase the accuracy to 99.99% when it comes to false positives. Now you have 50 of the real threats identified, and you’re still targeting 10,000 innocent people.

Now imagine that the military power in question somehow convinces itself that this algorithmic approach to security is still a good idea, and implements it in practice.

And now stop imagining it. Because apparently this is exactly what has been taking place with the targeting of US military drones in Pakistan, with the added twist that the science behind the algorithms might have been botched.

Oh, but a human is still in the loop… rubber-stamping a decision that is made by a machine, and is carried out by other machines, eliminating possibly several thousand innocent human beings.

As I said… welcome to Skynet, the dystopian network of homicidal machine intelligence from the Terminator movies.

Scared yet? Perhaps you should be. We should all be.

 Posted by at 10:21 pm
Feb 212016

Last night, when I almost managed to kill my server, I was playing with a service that I just discovered: Weather forecast in ASCII.

Well, almost ASCII. UTF-8 characters, to be precise. (And it was while messing with those xterm settings that I managed to enter a command using the wrong syntax.)

Still, it’s a nicely formatted three-day forecast suitable for text terminals. And it has pretty thorough world coverage.

I just hope the forecast holds up for Tuesday, as I’ll have quite a few errands to run that day and I’d prefer not to get stuck in a snowstorm.

 Posted by at 9:24 am
Feb 212016

Here is a message to the citizens of the United States from the “Canada Party”.

What can I say. If Trump becomes president, being way ahead may not be a bad idea.

 Posted by at 8:42 am
Feb 202016

OK, my Linux friends… try not to make the mistake that I made earlier tonight.

I was trying to stop a process in the gentlest way possible, buy sending it a hangup signal to its numerical process ID, e.g., 12345. The syntax was supposed to be this:

kill -1 12345

Unfortunately this is not what I typed. Because it was an afterthought that I’d use a hangup signal (instead of the default kill signal) I entered the option after the process ID, like this:

kill 12345 -1

A second or two later, I lost my xterm session. In fact, I lost all my xterm sessions. My mail client disconnected. I could not even telnet into the server anymore. For all practical intents and purposes, it seemed dead as a doorknob.

OK, not completely dead. I was able to log back in through its physical keyboard, only to find out that apart from core processes, nothing was running. No SQL server. No Web server. No SSH demon. No name server. And so on.

What the !#@@#@!& have I done?

I looked at the command long and saw the last command that I typed. I quickly checked the man page of kill and indeed… what I typed instructed kill to terminate process 12345 (using the default kill signal) and then, using the same default kill signal, terminate all processes with a pid greater than 1.

Bravo. What a clever boy. I promise I’ll try not to do that again anytime soon.

Still, I was able to bring everything back to life without rebooting the server. I hate reboots.

 Posted by at 10:49 pm
Feb 162016

The other day, I ran across a question on Quora: Can you focus moonlight to start a fire?

The question actually had an answer on xkcd, and it’s a rare case of an incorrect xkcd answer. Or rather, it’s an answer that reaches the correct conclusion but follows invalid reasoning. As a matter of fact, they almost get it right, but miss an essential point.

The xkcd answer tells you that “You can’t use lenses and mirrors to make something hotter than the surface of the light source itself”, which is true, but it neglects the fact that in this case, the light source is not the Moon but the Sun. (OK, they do talk about it but then they ignore it anyway.) The Moon merely acts as a reflector. A rather imperfect reflector to be sure (and this will become important in a moment), but a reflector nonetheless.

But first things first. For our purposes, let’s just take the case when the Moon is full and let’s just model the Moon as a disk for simplicity. A disk with a diameter of \(3,474~{\rm km}\), located \(384,400~{\rm km}\) from the Earth, and bathed in sunlight, some of which it absorbs, some of which it reflects.

The Sun has a radius of \(R_\odot=696,000~{\rm km}\) and a surface temperature of \(T_\odot=5,778~{\rm K}\), and it is a near perfect blackbody. The Stephan-Boltzmann law tells us that its emissive power \(j^\star_\odot=\sigma T_\odot^4\sim 6.32\times 10^7~{\rm W}/{\rm m}^2\) (\(\sigma=5.670373\times 10^{-8}~{\rm W}/{\rm m}^2/{\rm K}^4\) is the Stefan-Boltzmann constant).

The Sun is located \(1~{\rm AU}\) (astronomical unit, \(1.496\times 10^{11}~{\rm m}\)) from the Earth. Multiplying the emissive power by \(R_\odot^2/(1~{\rm AU})^2\) gives the “solar constant”, aka. the irradiance (the terminology really is confusing): approx. \(I_\odot=1368~{\rm W}/{\rm m}^2\), which is the amount of solar power per unit area received here in the vicinity of the Earth.

The Moon has an albedo. The albedo determines the amount of sunshine reflected by a body. For the Moon, it is \(\alpha_\circ=0.12\), which means that 88% of incident sunshine is absorbed, and then re-emitted in the form of heat (thermal infrared radiation). Assuming that the Moon is a perfect infrared emitter, we can easily calculate its surface temperature \(T_\circ\), since the radiation it emits (according to the Stefan-Boltzmann law) must be equal to what it receives:

\[\sigma T_\circ^4=(1-\alpha_\circ)I_\odot,\]

from which we calculate \(T_\circ\sim 382~{\rm K}\) or about 109 degrees Centigrade.

It is indeed impossible to use any arrangement of infrared optics to focus this thermal radiation on an object and make it hotter than 109 degrees Centigrade. That is because the best we can do with optics is to make sure that the object on which the light is focused “sees” the Moon’s surface in all sky directions. At that point, it would end up in thermal equilibrium with the lunar surface. Any other arrangement would leave some of the deep sky exposed, and now our object’s temperature will be determined by the lunar thermal radiation it receives, vs. any thermal radiation it loses to deep space.

But the question was not about lunar thermal infrared radiation. It was about moonlight, which is reflected sunlight. Why can we not focus moonlight? It is, after all, reflected sunlight. And even if it is diminished by 88%… shouldn’t the remaining 12% be enough?

Well, if we can focus sunlight on an object through a filter that reduces the intensity by 88%, the object’s temperature is given by

\[\sigma T^4=\alpha_\circ\sigma T_\odot^4,\]

which is easily solved to give \(T=3401~{\rm K}\), more than hot enough to start a fire.

Suppose the lunar disk was a mirror. Then, we could set up a suitable arrangement of lenses and mirrors to ensure that our object sees the Sun, reflected by the Moon, in all sky directions. So we get the same figure, \(3401~{\rm K}\).

But, and this is where we finally get to the real business of moonlight, the lunar disk is not a mirror. It is not a specular reflector. It is a diffuse reflector. What does this mean?

Well, it means that even if we were to set up our optics such that we see the Moon in all sky directions, most of what we would see (or rather, wouldn’t see) is not reflected sunlight but reflections of deep space. Or, if you wish, our “seeing rays” would go from our eyes to the Moon and then to some random direction in space, with very few of them actually hitting the Sun.

What this means is that even when it comes to reflected sunlight, the Moon acts as a diffuse emitter. Its spectrum will no longer be a pure blackbody spectrum (as it is now a combination of its own blackbody spectrum and that of the Sun) but that’s not really relevant. If we focused moonlight (including diffusely reflected light and absorbed light re-emitted as heat), it’s the same as focusing heat from something that emits heat or light at \(j^\star_\circ=I_\odot\). That something would have an equivalent temperature of \(394~{\rm K}\), and that’s the maximum temperature to which we can heat an object using optics that ensures that it “sees” the Moon in all sky directions.

So then let me ask another question… how specular would the Moon have to be for us to be able to light a fire with moonlight? Many surfaces can be characterized as though they were a combination of a diffuse and a specular reflector. What percentage of sunlight would the Moon have to reflect like a mirror, which we could then collect and focus to produce enough heat, say, to combust paper at the famous \(451~{\rm F}=506~{\rm K}\)? Very little, as it turns out.

If the Moon had a specularity coefficient of only \(\sigma_\circ=0.00031\), with a suitable arrangement of optics (which may require some mighty big mirrors in space, but never mind that, we’re talking about a thought experiment here), we could concentrate reflected sunlight and lunar heat to reach an intensity of

\[I=\alpha_\circ\sigma_\circ j^\star_\odot+(1-\alpha_\circ\sigma_\circ)j^\star_\circ=3719~{\rm W}/{\rm m}^2,\]

which, according to Ray Bradbury, is enough heat to make a piece of paper catch a flame.

So if it turns out that the Moon is not a perfectly diffuse emitter but has a little bit of specularity, it just might be possible to use its light to start a fire.

 Posted by at 4:49 pm
Feb 132016

This is what greeted me earlier this morning when I looked at my outdoor thermometer:

Brrrr. And tomorrow it’s supposed to get even colder. Where is that global warming that we were promised?

 Posted by at 11:59 am
Feb 122016

I saw a question on Quora about humans and gravitational waves. How would a human experience an event like GW150914 up close?

Forget for a moment that those black holes likely carried nasty accretion disks and whatnot, and that the violent collision of matter outside the black holes’ respective event horizons probably produced deadly heat and radiation. Pretend that these are completely quiescent black holes, and thus the merger event produced only gravitational radiation.

A gravitational wave is like a passing tidal force. It squeezes you in one direction and stretches you in a perpendicular direction. If you are close enough to the source, you might feel this as a force. But the effect of gravitational waves is very weak. For your body to be stretched by one part in a thousand, you’d have to be about 15,000 kilometers from the coalescing black hole. At that distance, the gravitational acceleration would be more than 3.6 million g-s, which is rather unpleasant, to say the least. And even if you were in a freefalling orbit, there would be strong tidal forces, too, not enough to rip your body apart but certainly enough to make you feel very uncomfortable (about 0.25 g-forces over one meter.) So sensing a gravitational wave would be the least of your concerns.

But then… you’d not really be sensing it anyway. You would be hearing it.

Most of the gravitational wave power emitted by GW150914 was in the audio frequency range. A short chip rising in both pitch and amplitude. And the funny thing is… you would hear it, as the gravitational wave passed through your body, stretching every bit a little, including your eardrums.

The power output of GW150914 was stupendous. Its peak power was close to \(10^{56}\) watts, which exceeds the total power output of the entire visible universe by several orders of magnitude. So for a split second, GW150914 was by far the largest loudspeaker in the known universe.

And this is actually a better analogy than I initially thought. Because, arguably, those gravitational waves were a form of sound.

Now wait a cotton-picking minute you ask. Everybody knows that sounds don’t travel in space! Well… true to some extent. In empty space, there is indeed no medium that would carry the kind of mechanical disturbance that we call sound. But for gravitational waves, space is the medium. And in a very real sense, they are a form of mechanical disturbance, just like sound: they compress and stretch space (and time) as they pass by, just as a sound wave compresses and stretches the medium in which it travels.

But wait… isn’t it true that gravitational waves travel at the speed of light? Well, they do. But… so what? For cosmologists, this just means that spacetime might be represented as a “perfect fluid with a stiff equation of state”, i.e., its energy density and pressure would be equal.

Is this a legitimate thing to say? Maybe not, but I don’t know a reason off the top of my head why. It would be unusual, to be sure, but hey, we do ascribe effective equations of state to the cosmological constant and spatial curvature, so why not this? And I find it absolutely fascinating to think of the signal from GW150914 as a cosmic sound wave. Emitted by a speaker so loud that LIGO, our sensitive microphone, could detect it a whopping 1.3 billion light years away.

 Posted by at 11:26 pm
Feb 112016

If this discovery withstands the test of time, the plots will be iconic:

The plots depict an event that took place five months ago, on September 14, 2015, when the two observatories of the LIGO experiment simultaneously detected a signal typical of a black hole merger.

The event is attributed to a merger of two black holes, 36 and 29 solar masses in size, respectively, approximately 410 Mpc from the Earth. As the black holes approach each other, their relative velocity approaches the speed of light; after the merger, the resulting object settles down to a rotating Kerr black hole.

When I first heard rumors about this discovery, I was a bit skeptical; black holes of this size (~30 solar masses) have never been observed before. However, I did not realize just how enormous the distance is between us and this event. In such a gigantic volume, it is far less outlandish for such an oddball pair of two very, very massive (but not supermassive!) black holes to exist.

I also didn’t realize just how rapid this event was. I spoke with people previously who were studying the possibility of observing a signal, rising in amplitude and frequency, hours, days, perhaps even weeks before the event. But here, the entire event lasted no more than a quarter of a second. Bang! And something like three solar masses worth of mass-energy are emitted in the form of ripples in spacetime.

The paper is now accepted for publication and every indication is that the group’s work was meticulous. Still, there were some high profile failures recently (OPERA’s faster-than-light neutrinos, BICEP2’s CMB polarization due to gravitational waves) so, as they say, extraordinary claims require extraordinary evidence; let’s see if this detection is followed by more, let’s see what others have to say who reanalyze the data.

But if true, this means that the last great prediction of Einstein is now confirmed through direct observation (indirect observations have been around for about four decades, in the form of the change in the orbital period of close binary pulsars) and also, the last great observational confirmation of the standard model of fundamental physics (the standard model of particle physics plus gravity) is now “in the bag”, so to speak.

All in all, a memorable day.

 Posted by at 12:58 pm
Feb 062016

I just came across this gem of an example of bad coding in the C language.

Most C implementations allow arrays as function arguments. What is less evident (unless you actually bothered to read the standard, or at least, your copy of Kernighan and Ritchie from cover to cover) is that array arguments are silently converted to pointers. This can lead to subtle, difficult-to-spot, but deadly programming errors.

Take this simple function, for instance:

void fun(int arr[100])
    printf("REPORTED SIZE: %d\n", sizeof(arr));

Can you guess what its output will be? Why, arr is declared as an array argument of 100 ints, so the output should be, on most systems, 400 (ints being 4 bytes in length), right?

Not exactly. Let me show you:

int main(int argc, char *argv[])
    int theArr[100];

    printf("THE REAL SIZE: %d\n", sizeof(theArr));
    return 0;

On a 64-bit Linux box, this program compiles cleanly, and produces the following output:


Similarly, on Windows, using a 32-bit version of Microsoft’s C compiler, I once again get a clean compile and the program outputs this:


The morale of this story: Array arguments are pure, unadulterated evil. Avoid them when possible. They offer no advantage over pointer arguments, but they can badly mislead even the most experienced programmer. Compilers still allow array arguments, mainly for historical/compatibility reasons I guess, but it is unconscionable that they don’t even provide a warning when this abuse of syntax happens.

 Posted by at 9:45 am