Friday, January 30, 2015

Using Fortran90's intrinsic RANDOM_NUMBER subroutine

There are three steps involved:
  1. Allocating the seed
  2. Setting the seed using either (a) the system clock, or (b) a user-defined number
  3. Harvesting the random numbers
Here is a minimal program which demonstrates the use of Fortran's intrinsic random number generator

Wednesday, January 28, 2015

Measles and Disneyland

1. By now you've heard of the measles outbreak in California. The last I checked nearly 100 cases affecting multiple states had been reported. We are on our way to beat 2014 (~650 cases), which was itself a major record.

2. Wired and Steve Novella rightly point the finger at the burgeoning anti-vaxx movement, and rebut some of the nonsense floating around. Here's Dr. Novella:
One thing is absolutely certain from these numbers – this outbreak has largely been caused by those who are not vaccinated. As you can see, most of those affected are unvaccinated. The vaccination rate for MMR is about 90% in the US. This means those who are unvaccinated were about 67 times more likely to be infected with measles in this outbreak than those fully vaccinated. 
If vaccination rates were higher, then herd immunity could have stopped or severely limited the spread of the disease. That is the point of herd immunity – if enough people are protected then the virus is less likely to find a vulnerable host and continue the spread. The vaccine is about 97% effective in those fully vaccinated, which is why there were a few vaccinated people who contracted the disease. 
3. Orac at ScienceBlogs highlights that measles is not your garden-variety sickness. Nearly 25% of the initial patients had to be hospitalized. As he quotes, the symptoms and after-effects are not benign.
Measles is a dangerous disease-one of the most dangerous with which a child under five years of age can be attacked. It is especially apt to be fatal to teething children. It tends to kill by producing inflammation of the lungs.
4. So how do you educate (even Fox News is trying) - assuming at least a sub-population of the anti-vaxxers would listen. One method is to physically demonstrate it with a metaphor. Here is a YouTube video by Penn and Taylor which beautifully illustrates this strategy.

5. Or, if you are the Onion, you could try humor.
Say what you will about me, but I’ve read the information out there and weighed every option, so I am confident in my choice to revive a debilitating illness that was long ago declared dead and let it spread like wildfire from school to school, town to town, and state to state, until it reaches every corner of the country. Leaving such a momentous decision to someone you haven’t even met and who doesn’t care about your child personally—now that’s absurd! Maybe I choose to bring back the mumps. Or maybe it’s diphtheria. Or maybe it’s some other potentially fatal disease that can easily pass among those too young or too medically unfit to be vaccinated themselves. But whichever highly communicable and formerly wiped-out disease that I opt to resurrect with a vengeance, it is a highly personal decision that only I and my family have the liberty to make.

Tuesday, January 27, 2015

Thoughts on Modeling

The best material model of a cat is another, or preferably the same, cat.
Norbert Wiener
Generally speaking, accurate models are a good thing. Unless, they are useless! Allow me to explain.

Consider my fair state of Florida. As Wiener claims, the most accurate model of Florida is Florida itself. But is it the most useful?

If I am a tourist visiting the state, the best model may be a Rand McNally road map.

If I am a hydrologist, the best model may be a 3D map where the waterways, the aquifers, and sinkholes are accurately represented.

If I am a political strategist, the best model may be a county/congressional district map colored in red, blue and purple.

If I am a epidemiologist, the best model may be a population density map.

A useful model for something successfully captures the key elements of that something, and de-emphasizes the rest. Judgment of the quality of a model cannot be unhooked from its intended purpose. In other words, the pursuit of accuracy for accuracy's sake is a classic beginner's mistake.

Good models separate the essential from the nonessential. Approximating or neglecting the nonessential is a skill. Approximation is a fancy way of saying, I am trading accuracy for clarity, insight or tractability.

As an aside, good cartoonists do this routinely: they exaggerate one or two key features, and and push the rest into the background. 
Essentially, all models are wrong, but some are useful.
Box and Draper

Friday, January 23, 2015

Google Dictionary

I have been re-watching the new Cosmos series (with Neil deGrasse Tyson) on Netflix. There is something refreshing about being reminded of how big, mysterious and wonderful the universe is.

In one of the episodes, he talks about how comets were associated with natural calamities, and how this superstitious association is preserved in modern-day language through the word "disaster", meaning "bad star".

In any case, I found out that Google Dictionary (using "define: word" in the search bar) is so much better. It gives you not only the etymology, but also the historical evolution of the word.

Tuesday, January 20, 2015

Ango-Indian Words in English

1. Nancy Friedman, who blogs at Fritinancy,  linked to an "open-source" version of a nearly century-old tome called "Hobson-Jobson" at the open library. The book is "a glossary of colloquial Anglo-Indian words and phrases, and of kindred terms, etymological, historical, geographical and discursive."

2. This book is the backdrop for the article "Hobson-Jobson: The Words English owes to India" on BBC News. Here's an interesting excerpt from the article:
Take the entry for the Indian word dam. The dictionary defines it as: "Originally an actual copper coin. Damri is a common enough expression for the infinitesimal in coin, and one has often heard a Briton in India say: 'No, I won't give a dumree!' with but a vague notion what a damri meant." 
That is the etymology of dam. But Yule and Burnell have more to say. 
"And this leads to the suggestion that a like expression, often heard from coarse talkers in England as well as in India, originated in the latter country, and that whatever profanity there may be in the animus, there is none in the etymology, when such an one blurts out 'I don't care a dam!' in other words, 'I don't care a brass farthing!'"

3. If you are unwilling to spend hours reading a 1000+ page book, Wikipedia has a shorter entry of English words derived from Hindi and Urdu. 

Thursday, January 15, 2015

Freedom of Expression Debate

The recent Charlie Hebdo killings have brought the issue of balancing free speech and cultural sensitivities into sharp focus.

This somewhat long debate (about an hour and a half) at Intelligence Squared US from almost a decade ago touches upon a number of pertinent issues including comics and Islam. In many ways, it is directly related to the tragedy of common sense morality that was the subject of the last blog post.

Clearly freedom of speech is not unbounded; we don't tolerate some yelling fire in a cinema theater, hate speech,  and verbal sexual harassment in the workplace.

But we ought to be able to discuss and make fun of a lot of things, some of which may be offensive to segments of the population.

I would hate to live in a politically over-correct society, in which people suppressed speech for fear of offending others. Building bridges between different tribes or cultures requires more dialogue; limiting free speech runs in the opposite direction.

Tuesday, January 13, 2015

Tragedy of the Commons and Common-sense Morality

I just listened to Joshua Greene talk about on Moral Tribes on EconTalk.

He starts off by describing the tragedy of the commons, discussed by Hardin in this very readable article. Wikipdia describes it as:
The Tragedy of the commons is an economic theory by Garrett Hardin, which states that individuals acting independently and rationally according to each's self-interest, behave contrary to the best interests of the whole group, by depleting some common resource.
In Hardin's parable, a bunch of herdsmen graze their cattle on a commonly owned meadow. Each herder has a "selfish" incentive to increase the size of his herd, and thereby increase his output. However, if they all simultaneously increase their herds, then the meadow gets over-grazed, and they will all be worse off in the long run.

Greene tacks on an interesting sequel to Hardin's parable.
So, imagine that there's this large forest. And all around this large forest are many different tribes. And these different tribes are all cooperative, but they are cooperative on different terms. 
So, on the one side you might have your communist herders who say, Not only are we going to have a common pasture; we're just going to have a common herd, and that's how everything gets aligned. Everything is about us. 
And on the other side of the forest you might have the individualist herders who say, Not only are we not going to have common herds; we are not going to have a common pasture. We are going to privatize the pasture, divide it up; and everybody's responsible for their own piece of land. And our cooperation will consist in everybody's respecting each other's property rights. As opposed to sharing a common pasture. And you can imagine any number of arrangements in between. 
He continues,
One hot, dry summer, lightning strikes and there's a forest fire and the forest burns to the ground. And then the rains come and suddenly there is this lovely green pasture in the middle. And all the tribes look at that pasture and say, 'Hmmm, nice pasture.' And they all move in. So now we have in this common space all of these different tribes that are cooperative in different ways, cooperative on different terms, with different leaders, with different ideals, with different histories, all trying to exist in the same space. And this is the modern tragedy. This is the modern moral problem.

Friday, January 9, 2015

Cartograms in Chemistry

Cartograms are fun and insightful to look at. Geography based cartograms have been around for a while, and you've probably seen some of these.

Here are some interesting cartograms of the periodic table based on different attributes of the elements.

You can also make your own cartograms by modifying a spreadsheet on that site.

Google Research also has a similar themed page:

Thanks to FlowingData for the links.

Tuesday, January 6, 2015

Santa's Lesson

I watched with amusement as my 6-year old rushed from her bed to the Christmas tree, and simply stood still; her hands folded, and her eye-brows intensely furrowed.

When asked why she wasn't opening her gift, she seemed upset, and barked, "Hmmpf. That's our wrapping paper. I saw it in the closet!"

Moments later, her 7-year old cousin rushed downstairs, picked up her gift, and began reading the accompanying letter that Santa had left her. "Hmm," she murmured, "this looks like my mom's handwriting!"

When her mom swung by shortly thereafter, she remarked, "Santa's handwriting is a lot like yours." That was the only possible explanation consistent with her beliefs, and empirical data.

I couldn't help but notice the striking parallels between the evolution of my daughter's belief in Santa, and my belief in God.

Mandatory disclaimer: My religious beliefs are hard to explain; especially, to myself. On Mondays, I am an atheist; on Tuesdays, I am Buddhist; on Wednesdays, I am agnostic; on Thursdays, I am born-again, etc.

When you are young, belief in Santa or God is imposed by authority, usually parents. The wider community perpetuates the myth by suppressing contradictory evidence. It is further encouraged by fun rituals and traditions (gifts, festivals, family and food), which plaster on a positive atmosphere around the whole shebang. Both involve prolonged singing and chanting.

Like God, Santa is opportunistically leveraged by those in power to regulate behavior. "Do you want to be on the good-list this year?" is but an age-appropriate translation of "Do you want to go to hell, mister?"

God and  Santa don't communicate directly, and even when they supposedly do, they are not particularly articulate ("Ho, ho, ho" anyone?).

Once you are old or wise enough, you begin noticing discrepancies in the narrative. "How does Santa fit inside our tiny chimney?", or perhaps "why does Santa's handwriting match my mom's?", or perhaps, as my sister's daughter once asked about a Hindu God, "do the four heads of Brahma talk to each other?"

As always, "that's funny!" is the prelude to "Eureka!"

When explanations to reconcile new data with existing beliefs start sounding too contrived, progress can be made by abandoning or revising beliefs to allow for simpler explanations.

If I were a betting man, I'd wager that the illusion of Santa would disappear before next Christmas, for both, my daughter, and my niece.

One part of me feels sad about Santa's impending transition from the real to the imaginary axis. The other part is thrilled in anticipation of this moment of metamorphosis.

The moment when they realize that they can throw away the crutch, and yet retain the spirit of Santa or God, to be merry, and do good.

Thursday, January 1, 2015

Puzzler: Odd man out

From Michael Lugo @ God plays dice
Which of the following does not belong? 
Large green square
Large red circle
Large green circle
Small green circle 
Take your time. The answer requires exercising your brainpower in an uncommon way.
The answer is on the site linked.