Sunday, July 26, 2009

Cartograms


You must have seen some of these before, especially in connection with recent US presidential elections. I picked the image above which depicts the 2008 election (Obama v/s McCain) from this University of Michigan website. Their meaning is obvious: they rescale geography, unlike normal maps, to some metric other than geographic size. In effect, one gets a better appreciation of the particular metric.

Parenthetical remark: Go Blue! I spent 7 amazing years in Ann Arbor. The guy whose website I quote above (Mark Newman of Physics) has done some work with Bob Ziff from chemical engineering on percolation theory. Bob is one of the smartest+nicest professors I have ever met. I took statistical mechanics with him, and it was one of the two career-defining classes I took at UM (the other was my advisor Ron Larson's class, Complex Fluids). End of parenthetical remark.

Another wonderful resource for cartograms which is less US-centric and more global in scope is this site. If you look at the population of the world from year 0001 through now, you realize why the Indian sub-continent and China have the largest populations.

This is interesting to me, because about 6 months ago over a cup of coffee, my colleague Milen Kostov and I were trying to figure out why India and China have large populations, and not, say Egypt or Mesopotamia (modern day Iraq) which were also cradles of ancient civilizations. Looks like something happened between 0001 and 1500 AD, where you can see that their sizes sort of diminished or remained same relative to India-China. Perhaps being in a desert limited how much food could be grown to support a population.

Thursday, July 23, 2009

Amateur Science

On my way to work today, I heard a story on NPR about an amateur Australian astronomer Anthony Wesley, who discovered a big crater (the size of earth) near Jupiter's south pole. As soon as I sat in front of my computer, I googled and found almost 600 news articles, and here is a link to one of those stories.

Post World War II, science has gotten bigger, and more expensive. To merely keep up with literature, "to stand on the shoulders of giants", requires exorbitant journal subscriptions, which are beyond the reach of individuals. Some of those things are changing, there is arxiv, and of course, the web is an amazing democratizing force.

To see someone with passion and a telescope discovering something that the biggies missed is real chicken-soup for the soul.

It reminded me of the afternoons as a kid, when my cousins and I tried to mix random stuff in water (soil, talcum powder, herbs etc.) to try and create an invisibility potion. The approach was what modern science would call "Edisonian", which meant "keep trying".

Thank god, we never tried to drink that crap, otherwise we would be invisible for good!

But yeah, the astronomer story moved something in me that hadn't moved in some time. It reminded me why I write grants, papers, and put up with pointless meetings.

Its because the joy of discovery, however small, is still so thrilling. You spend the vast majority of your time connecting dots, and most of the time that produces nothing. Occasionally, you get lucky and something starts emerging. The time interval, between that realization that something is emerging, to the instant when the last dot is connected makes one sing: "I am dancing at the feet of God, all is bliss, all is bliss!"

Tuesday, July 21, 2009

Children and Languages

Okay, I have a kid, and I grew up in a *really* multilingual environment, which makes this AP story interesting. As a kid myself, I grew up in a language soup of Marathi, Hindi, English, Konkani, and Kannada, and as an adult in Fortran, Octave, and C++.

For those, who hate to read here are some interesting tidbits:

Kuhl offers an example: Japanese doesn't distinguish between the "L" and "R" sounds of English — "rake" and "lake" would sound the same. Her team proved that a 7-month-old in Tokyo and a 7-month-old in Seattle respond equally well to those different sounds. But by 11 months, the Japanese infant had lost a lot of that ability.


and

It's remarkable that babies being raised bilingual — by simply speaking to them in two languages — can learn both in the time it takes most babies to learn one. On average, monolingual and bilingual babies start talking around age 1 and can say about 50 words by 18 months.


I haven't looked at the original research yet, and know the perils of ordinary journalists reporting on science stories, largely because the article (unlike well-written technical documents) does not properly link the sources.

Thursday, July 16, 2009

Few Roads = Faster Traffic?

Counter-intuitive, huh? Reduce choice, improve efficiency?

Apparently, traffic jams can be eased by closing roads, or making them one-way etc.

Check out this blog. It refers to a study, in which:
The authors give a simple example of how this could play out: Imagine two routes to a destination, a short but narrow bridge and a longer but wider highway. Let’s also imagine that the combined travel times of all the drivers is shortest if half take the bridge and half take the highway. But because each driver is selfishly trying to seek the shortest route for himself, this doesn’t happen. At first, everyone will go for the bridge because it’s shorter. But then, as the bridge becomes backed up, more drivers start taking the highway, until the congestion on the bridge starts to clear up. At that point more drivers go back to the bridge, which then becomes backed up again. Eventually, the traffic flow settles into what’s called the Nash equilibrium (named for the beautifully minded mathematician), in which each route takes the same amount of time. But in this equilibrium the travel time is actually longer than the average time it would take if half of the drivers took each route.

A related topic can be found here. Quoting from the article:
Tom Vanderbilt, in his authoritative book Traffic, describes a simple experiment performed by the Washington Department of Transportation that involved a liter of rice, a plastic funnel, and a glass beaker. When the rice was poured into the beaker all at once, it took 40 seconds for the funnel to empty; the density of jostling grains impeded the flow. However, when the grains were poured in a gradual stream, it took only 27 seconds for the rice to pass through. What seemed slower actually turned out to be 30 percent faster. This helps explain why traffic engineers are so eager to install red lights on highway onramps: By slowing traffic before it enters the concrete funnel, they hope to prevent the road from exceeding its critical density.

Tuesday, July 14, 2009

Does cooking in a microwave oven destroy nutrients in food?

Microwaves are electromagnetic waves with a wavelength of around 12.24 cm, which puts them between radio and infra-red waves. You are constantly immersed in radio waves, and infra-red is less energetic than the sunlight that you bathe in everyday. So don't let the word radiation scare you. Not all of it is bad, and a lot of it is natural.

So, a microwave doesn't blast your food, trying to ionize it. It does something smarter. It excites polar bonds like those present in water, and selectively feeds them energy. This energy is released as heat, which is then spread around.

Okay. Okay. Tell me if it is good or bad.

I am so glad you asked.

The quick answer is "it is not bad".

You have to realize that cooking per se robs food of its nutrients. So whether you boil, steam, grill or microwave food, its never going to be as good as it is when it is raw. Once you've decided, you want to cook, the answer sort of depends on what you are cooking.

A 2003 study on broccoli in the Journal of the Science of Food and Agriculture by Garcia-Viguera et al. concluded that microwave cooking lost the highest percentage of flavonoid antioxidants, about 97%. Pressure cooked and boiled broccoli lost 47% and 66%, respectively. With potatoes and tomatoes, the story turned upside down. Microwaving lost 45-65% of the nurtients, while boiling on a stove lost 60-80% of the flavonoids.

As a website with a harvard.edu suffix says:

So, as a general proposition, cooking with a microwave probably does a better job of preserving the nutrient content of foods because the cooking times are shorter.

As far as vegetables go, it’s cooking them in water that robs them of some of their nutritional value because the nutrients leach out into the cooking water. For example, boiled broccoli loses glucosinolate, the sulfur-containing compound that may give the vegetable its cancer-fighting properties as well as the taste that many find distinctive and some, disgusting.

Here, I have only touched upon the loss of nutrition. Some of the fears may be justified, since some of the first microwavable food leaked carcinogens like benzene, and I have heard of diacetyl leaching out of microwave popcorn. I'll probably look at that separately.

So what is the moral of the story:
  1. Raw is best!
  2. If that is not possible, minimize cooking time.
  3. Use as little water as possible in a microwave-safe container.
  4. Use the nutrient-rich water from boiled or microwaves vegetables

Saturday, July 11, 2009

Polyethylene demands some respect!


I recently found a link to this blog on why it is so hard to model even simple-looking polymers by Eric Drexler through Guru.

Having spent about a third of my life trying to figure out the rheology of polyolefins (like polyethylene and polypropylene), it feels nice that someone normally associated with a red hot topic of nanotechnology, acknowledges how hard it is to model these systems. He says:

At room temperature, polyethylene forms a disordered structure consisting of of small crystallites threaded by multiple, partly-folded chains. Under increasing tension, chains unfold and slide, distributing tension unevenly and breaking in more-or-less random patterns. The mechanical properties of the material (for example, stress-strain curves and maximum elongation to failure) depend on polymer chain lengths and processing history: both milk jugs and plastic bags are commonly made of polyethylene, but so is Dyneema, a polyethylene material in which the same repeating units — but in longer, highly oriented chains — form fibers that rival high-strength steel.

None of this is really news. Fresh students of polymer physics learn this pretty quickly. Disorder and multibody effects can make seemingly trivial systems become extremely complex and hence interesting.

Nanotechnology, really does have the potential to revolutionize the way we live, and as a scientific calling, there are few things more important than that.

However, like many trendy things, the hype is much bigger than the substance. I know, because I worked in the field for two years, and even now, dabble occasionally. If you look at scientific literature, about 80% of it should be recycled as toilet-paper (including perhaps some of my own work). Even prestigious journals like Science and Nature are constantly beguiled by SEM and AFM images, which reveal nothing important. I'll stop my rant right here, because I think it is a separate post in itself.

Thursday, July 9, 2009

The paradox of choice

Recently saw a Barry Schwartz video promoting his book on this website called TED. I really like the website, although the video streams are choppy at times.

I couldn't help thinking about my first Starbucks experience. All I wanted was a good cup of coffee, and the number of choices I had to make to lay my hands on a "tall" (read small) cup of coffee made GRE feel like a joke.

But seriously, I liked one point he makes. To paraphrase: if there is only type of shoe that you can buy, and you don't like the shoe, you can always place blame "out there". But when you go to a restaurant with 100 choices, and hate what you ordered, you have to deal with "guilt", because you could probably have ordered something better. The worst part is, even if you like what you ordered, you sometimes wonder if there was something better on the menu.

Although I am normally content with what is meted out to me, one arena where I have a similar experience is channel surfing. Unless I am watching a Michigan football game, or a new Law and Order episode, I compulsively flip channels, hoping not to miss out on something exciting that I may be missing.

Combining data from independent simulation runs using a bash script

Today I came across a problem that I have solved several times before. From my simulations, I generate a bunch of files called stat1, stat2, ... statN, which contain the following data:

$cat stat1
567.20 0.88
45.29 3.08
296.58 21.50
0.33 0.14

The first column are some properties in a particular simulation run, and second column is the standard error. The "N" different "stat" files are N independent simulation runs. When I finally report, I like to report the average properties and associated standard errors. The following shell script DataAgg.sh creates a new file TotalProp which contains exactly that.

$cat TotalProp
567.49 0.24
43.57 0.45

289.91 1.61
0.67 0.10

The shell script is here:

$cat DataAgg.sh

i=0
for s in stat*
do

let i
=i+1

if [ $i == 1 ]; then
awk '{
print $1}' $s > TmpProp
awk '{
print $2*$2}' $s > TmpErr2Prop
else
awk '{
print $1}' $s > tmp
paste tmp TmpProp
> more
awk '{
print $1+$2}' more > TmpProp

awk '{
print $2}' $s > tmp
paste tmp TmpErr2Prop
> more
awk '{
print $1+$2}' more > TmpErr2Prop
fi
done

awk '{
print $1/n}' n=$i TmpProp > more; mv more TmpProp
awk '{
print sqrt($1)/n}' n=$i TmpErr2Prop > more; mv more TmpErr2Prop
paste TmpProp TmpErr2Prop
> more
awk '{printf
("%6.2f\t%6.2f\n",$1, $2)}' more > TotalProp

rm -f TmpProp
rm -f TmpErr2Prop
rm -f more
rm -f tmp

Note I don't need to know how many "stat"s there are, and how many rows each of the "stat"s has. The only precondition is that I know what the common prefix ("stat") of my datafiles is, and that those files contain only the two numerical columns mentioned above.

Tuesday, July 7, 2009

Regular Expressions: Example based cheatsheet

I need regular expressions all the time because of the programs I use regularly (sed, awk, OpenOffice, etc.). Here's a cheatsheet that my life depends on.

(regular stuff)
/poke/
matches poke, spoke, pokemon.
/or not/ matches or not, poor nothing.

(. matches any character)
/.and./ matches randy, dandy, sandy

(square brackets define character class)
/[aA]rticle/ matches article, Article
/b[aou].k/ matches balk, bonk, bulk
/T[6-9]/ matches T6, T7, T8, T9

(a ^ after [ is a "not" operation)
/T[^6-9] matches T5, T4, Ta, Tt
/[^a-zA-Z] matches 1, #, @

(* matches zero or more occurences of)
/ab*c/ matches ac, abc, abbbbbbc
/s.*tion/ matches station, subtraction, sedition

(longest string between "(" and ")" )
/(.*)/ matches (here) and (there), (()))))))

(shortest string between "(" and ")" )
/([^)]*)/ matches (here) and (there)

(note caret inside [^] means something else)
/^T/ matches T at beginning of line
/T$/ matches T at end of line

(+ = one or more matches of "b")
/ab+c/ matches abbc, abc, but not ac

(? = zero or one match of "b")
/ab?c/ matches abc, ac, but not abbc

(can use parenthesis to group)
/(ab)+c/ matches abc, ababc, but not ac, or abac

(pipe is an or operation)
/(ab)|(ac)/ matches ab or ac.
/(S|A)\. Shanbhag/ matches S. Shanbhag, A. Shanbhag

Monday, July 6, 2009

Copying entire directory

In Unix/Linux, it is easy to copy an entire directory with the standard program "cp"

cp -r dir1 dir2

creates a copy of directory with all it directories.

Thursday, July 2, 2009

Fareed Zakaria's "The Capitalist Manifesto"

I just finished reading Fareed Zakaria's article in Newsweek entitled "The Capitalist Manifesto". As I was trying to ask myself, "So what do you think?", I started googling to see what the critics had to say. While I don't agree with all the criticism, some of it is really spot on.

As Derek Thompson writes in the Atlantic:

"In the pantheon of political and economic commentators, there is perhaps no one who writes so lucidly with such utter calm and reasonableness as Fareed Zakaria. His columns aren't Cracker Jack boxes bursting with goshwow revelations. They're mugs of warm milk that go down nice and smooth, filling you with a kind of zen peace and a dozy satisfaction that everything is going to be alright. He can be Obama with a pen and history PhD."
Really, since I read "The future of freedom", I strongly admire Zakaria as a writer and a commentator. In large part, I share his politics, and agree with him more often then not. For example, the manner in which he "contextualizes" hyperbolic utterances by important people makes sense.

During extraordinary times, people will sometimes take the ridiculous seriously.

While I agree with his diagnosis, I am not quite convinced of his medicine. Unfortunately, I don't have a silver bullet myself, but to expect self-regulation to be the most important pillar seems like asking for too much. To expect the backbone of the current compensation structure to be broken by people who derive the most benefit from it, is like expecting an emperor to abdicate the throne in favor of democracy.

Possible, sure. Probable, naah!