The Daily Parker

Politics, Weather, Photography, and the Dog

Late afternoon reading

Meetings and testing all day have put these on my list for reading tomorrow:

And with that, it's the weekend.

O is for O(n) Notation

Blogging A to ZFor day 15 of the Blogging A-to-Z challenge I want to talk about something that computer scientists use but application developers typically don't.

Longtime readers of the Daily Parker know that I put a lot of stock in having a liberal arts education in general, and having one in my profession in specific. I have a disclosed bias against hiring people with computer science (CS) degrees unless they come from universities with rigorous liberal arts core requirements. Distilled down to the essence, I believe that CS majors at most schools spend too much time on how computers work and not enough time on how people work.

But CS majors do have a lexicon that more liberally-educated developers don't really have. For example, when discussing how well code performs, CS majors use "Big O" notation.

In Big O notation, the O stands for "order of growth," meaning how much time could the algorithm could grow to take up given worst-case inputs.

The simplest notation is O(1), where the code always takes the same amount of time to execute no matter what the inputs are:

int q = 1;
int r = 2;
var s = q + r;

Adding two integers in .NET always takes the same amount of time, no matter what the integers are.

The titular notation for this post, O(n), means that the execution time grows linearly based on the input. Each item you add to the input increases the time the algorithm takes by exactly one unit, as in a simple for loop:

public long LoopExample(int[] numbers)
{
	long sum;
	for(var x = 0; x < numbers.Length; x++)
	{
		sum += numbers[x];
	}
	return sum;
}

In that example, each item you add to the array numbers increases the time the loop takes by exactly one unit of time, whatever that unit may be. (On most computers today that would be measured in units of milliseconds, or even hundreds of nanoseconds.)

Other algorithms may be slower or faster than these examples, except that no algorithm can be faster than O(1). The parenthetical can be any expression of n. Some algorithms grow by the logarithm of n, some grow by the double of n, some grow by the square of n.

This notation enables people to communicate precisely about how well code performs. If you find that your code takes O(n2) time to run, you may want to find a fix that reduces it to O(log n). And you can communicate to people how you increased efficiency in just that way.

So as much as I want application developers to have broad liberal educations, it's worth remembering that computer science fits into a liberal education as well.

What really was the Cuban sonic weapon?

About a year ago, a number of American diplomats and their families in Cuba were injured by what our military speculated might be a sonic weapon. A sonic weapon directs sonic energy at a target to disable, but not necessarily permanently damage, the person. Over a few months, people reported "blaring, grinding noise," hearing loss, speech problems, nausea, disequilibrium...exactly what a sonic weapon could cause.

Via Bruce Schneier, a team at the University of Michigan working in association with the IEEE has published a paper speculating on the variety of weapon how it might have worked:

On the face of it, it seems impossible. For one thing, ultrasonic frequencies—20 kilohertz or higher—are inaudible to humans, and yet the sounds heard by the diplomats were obviously audible. What’s more, those frequencies don’t propagate well through air and aren’t known to cause direct harm to people except under rarefied conditions. Acoustic experts dismissed the idea that ultrasound could be at fault.

Then, about six months ago, an editor from The Conversation sent us a link to a video from the Associated Press, reportedly recorded in Cuba during one of the attacks.

To make the problem tractable, we began by assuming that the source of the audible sounds in Cuba was indeed ultrasonic. Reviewing the OSHA guidance, Fu theorized that the sound came from the audible subharmonics of inaudible ultrasound. In contrast to harmonics, which are produced at integer multiples of a sound’s fundamental frequency, subharmonics are produced at integer divisors (or submultiples) of the fundamental frequency, such as 1/2 or 1/3. For instance, the second subharmonic of an ultrasonic 20-kHz tone is a clearly audible 10 kHz. Subharmonics didn’t quite explain the AP video, though: In the video, the spectral plot indicates tones evenly spaced every 180 Hz, whereas subharmonics would have appeared at progressively smaller fractions of the original frequency. Such a plot would not have the constant 180-Hz spacing.

Of course, to this day, no one knows exactly why the attacks occurred, and even to say "attacks" makes a reasonable but not certain assumption.

The Athropic Shadow

An article in this month's Atlantic points out that we humans can wonder how we got here only because we got here:

After all, there are 100-mile impact craters on our planet’s surface from the past billion years, but no 600-mile craters. But of course, there couldn’t be scars this big. On worlds where such craters exist, there is no one around afterward to ponder them. In a strange way, truly gigantic craters don’t appear on the planet’s surface because we’re here to look for them. Just as the wounds of the returning planes could reflect only the merely survivable, so too for our entire planet’s history. It could be that we’ve been shielded from these existential threats by our very existence.

“Observer selection effects are really the kind of effects where the data you get is going to be dependent, in some sense, on survival, or that you as an observer exist,” [Anders Sandberg, a senior research fellow at University of Oxford’s Future of Humanity Institute] says. “Now this gets really interesting and scary when we apply it to our own survival.”

“Maybe the universe is super dangerous and Earth-like planets are destroyed at a very high rate,” Sandberg says. “But if the universe is big enough, then when observers do show up on some very, very rare planets, they’ll look at the record of meteor impacts and disasters and say, ‘The universe looks pretty safe!’ But the problem is, of course, that their existence depends on them being very, very lucky. They’re actually living in an unsafe universe and next Tuesday they might get a very nasty surprise.”

If this is true, it might explain why our radio telescopes have reported only a stark silence from our cosmic neighborhood. Perhaps we’re truly extreme oddballs, held aloft by a near-impossible history—one free from lifeless water world.

We see this on smaller scales when, for example, extremely lucky people start to think they succeeded entirely because of their own efforts. But that's a different topic. Sort of.

Long weekend; just catching up

Saturday and Sunday, the Apollo Chorus sang Verdi's "Requiem" three times in its entirety (one dress rehearsal, two performances), not including going back over specific passages before Sunday's performance to clean up some bits. So I'm a little tired.

Here are some of the things I haven't had time to read yet:

Other stuff is going on, which I'll report when I have confirmation.

A mollusk told a crustacean to GFY. What happened next will terrify you

In all seriousness, self-cloning crayfish are kind of freaky:

In 2003, scientists confirmed that the marbled crayfish were indeed making clones of themselves. They sequenced small bits of DNA from the animals, which bore a striking similarity to a group of crayfish species called Procambarus, native to North America and Central America.

For nearly two decades, marbled crayfish have been multiplying like Tribbles on the legendary “Star Trek” episode. “People would start out with a single animal, and a year later they would have a couple hundred,” said [German biologist Frank] Lyko.

Many owners apparently drove to nearby lakes and dumped their marmorkrebs. And it turned out that the marbled crayfish didn’t need to be pampered to thrive. Marmorkrebs established growing populations in the wild, sometimes walking hundreds of yards to reach new lakes and streams. Feral populations started turning up in the Czech Republic, Hungary, Croatia and Ukraine in Europe, and later in Japan and Madagascar.

Cloning works in the short term, but not for very long. Sex is useful in fighting disease:

If a pathogen evolves a way to attack one clone, its strategy will succeed on every clone. Sexually reproducing species mix their genes together into new combinations, increasing their odds of developing a defense.

The marbled crayfish offers scientists a chance to watch this drama play out practically from the beginning. In its first couple decades, it’s doing extremely well. But sooner or later, the marbled crayfish’s fortunes may well turn.

“Maybe they just survive for 100,000 years,” Dr. Lyko speculated. “That would be a long time for me personally, but in evolution it would just be a blip on the radar.”

One question the Times did not answer: how do they taste?

Why do we need to sleep?

The Atlantic reports on some new research in why animals all do this thing that could get them eaten:

There are a handful of substances clearly demonstrated to cause sleep—including a molecule called adenosine, which appears to build up in certain parts of the brains of waking rats, then drain away during slumber. Adenosine is particularly interesting because it is adenosine receptors that caffeine seems to work on. When caffeine binds to them, adenosine can’t, which contributes to coffee’s anti-drowsiness powers. But work on hypnotoxins has not fully explained how the body keeps track of sleep pressure.

For instance, if adenosine puts us under at the moment of transition from wakefulness to sleep, where does it come from? “Nobody knows,” remarks Michael Lazarus, a researcher at the institute who studies adenosine. Some people say it’s coming from neurons, some say it’s another class of brain cells. But there isn’t a consensus. At any rate, “this isn’t about storage,” says [Japanese researcher Masashi] Yanagisawa. In other words, these substances themselves don’t seem to store information about sleep pressure. They are just a response to it.

Unfortunately...they still haven't figured it out. But there is a cute video at the bottom of the article.

Happy 2018, UTC!

It's now just past what computer people call "2018-01-01T00:00:00" (or, in more human-readable form, "2018-01-01 00:00:00 +00:00").

Some of you will remember that 2017 was exactly 1 day and 1 second shorter than 2016, owing to the leap second added a year ago at 2017-12-31T23:59:60.

Even thought 2017 was that much shorter than 2016, it seemed so much worse. But that's literally behind us now (or at least in the 13/24ths of the world on GMT or ahead of it). Here's looking to 2018 to be just a tiny bit better.

Happy new year!

Link round-up

Today is the last work day of 2017, and also the last day of my team's current sprint. So I'm trying to chase down requirements and draft stories before I lose everyone for the weekend. These articles will just have to wait:

We now return to "working through lunch," starring The Daily Parker...

 

How will we react to aliens?

According to a new study, it seems to depend on how big they are:

Michael Varnum, a psychologist at Arizona State University and a member of its new Interplanetary Initiative, is trying to anticipate this response.

The scientists asked 500 people to describe their reactions to a hypothetical discovery of alien microorganisms. Respondents also had to predict how humanity at large would react. Like the journalists, people in the study used positive words. There were no characteristics that set responses apart, not a person's income, ethnicity, political orientation or traits such as neuroticism or agreeableness. But people felt that the rest of the country would be generally less agreeable.

That may be because “most Americans tend to think, on any desirable trait or ability, that they're better than the average person,” Varnum said.

So tiny aliens are OK, but larger ones are scary? Has no one read The Andromeda Strain?