Archive for February, 2009

Automated notifications in C++ loops

Posted February 26th, 2009 in Software. Tags: , .

As a computational physicist, I’m often running programs that consist of many nested for-loops. At the moment, my outermost loop cycles through millions of data points and various inner loops explore tens of thousands of parameters. I’m always fiddling with the settings on the inner loops in ways that cause the run time to vary between 10 seconds and 10 weeks.

Annoyingly, it’s not always easy to predict how long the program will run after each set of modifications. Also, my code occasionally has bugs which make it hang indefinitely. When a program’s expected run time is measured in weeks, it’s reassuring to see regular progress reports. Otherwise I worry that the program has silently crashed.

At first I just slapped a print statement into the outermost for-loop, encased in an if-then statement which only activated once every 1000 loops. The print statement used the time elapsed since the start of the loop and the progress made to estimate the time remaining. It looked a little like this (plus some type casting): (more…)

What causes motion sickness?

Posted February 19th, 2009 in Biology. Tags: , , .

I used to go scuba diving, but I routinely got seasick on the boat. Since I had nothing better to do while leaning over the water, I wondered why I had to go through this wretched experience. I understood the origins of physical pain– an animal that didn’t realize it had sprained an ankle would likely hurt itself even more rather than waiting for it to heal. But why should I feel nauseous when on a boat? I wasn’t being hurt by the waves, so this incapacitating condition wouldn’t have provided any advantage to my ancestors and therefore shouldn’t have been favored by natural selection. (more…)


Switch to our mobile site