Sunday, September 27, 2015

The Case for Restraint

Three viral stories this summer followed a vaguely similar narrative arc: Tim Hunt's crucifixion for his misogynist comments, the hunting of Cecil the Lion by Walter Palmer, and more recently, Ahmed Muhammad's arrest for bringing a homemade clock to school. The initial and visceral outrage, was gradually replaced by a more nuanced, if reluctant, understanding.

The original versions of the stories exemplified beliefs that are strongly held for good reason. I subscribe to these beliefs myself:

1. Women in science have a harder time than they should
2. Hunting animals for sport is inhumane
3. Muslims suffer discrimination; police brutality exists.

In Tim Hunt's witch hunt, the initial invective was amazing. Confirmation bias was in full deployment mode. This doddering old out-of-touch fool spewing his anti-women views at a women's forum.  A reputation built over a lifetime, was summarily shattered over a few short days.

Only weeks later, did a clearer picture emerge; one that paints Hunt in a completely benign light. The original story, and much of the surrounding commentary, misrepresented the context in which Hunt made his comments.

Then, we heard about how a rich American dentist paid a large sum of money to hunt a beloved African lion. It reinforced many stereotypes: the rich exploiting the poor, the American fetish for guns and violence, etc. The story made me sick.

Until I listened to Radiolab episode on The Rhino Hunter. If you have not, you should give it a listen. The relationship between hunting and conservation is more symbiotic than I had imagined - in many cases populations of endangered species have rebounded due to legal hunting. In the big "population-level" picture, perhaps, hunters and conservationists are on the same side, even though they are seen as natural adversaries.

Then finally, we heard about Ahmed, the 14-year old teen. What happened to him was wrong. Arresting and intimidating him in the absence of his parents was wrong! Was Islamophobia at play? Possibly!

So was the teacher who went to the principal wrong? I don't think so. If a teacher in my kids' class suspects a student has a gun or a bomb, I would like her to do something preemptively about it. Can't a science teacher tell the difference between a clock and a bomb? I am a chemical engineering and a scientist by training, I'd couldn't tell the two damn things apart. Most of us haven't seen a real bomb, and the ones in movies do look like clocks removed from their casing. Isn't the assumption that the teacher was anti-Muslim a little hasty?

Which adds another wrinkle to the story. We've learned that Ahmed did not really "build" the clock; he disassembled the casing from a fully-functional clock and stuck it in a box. So perhaps, the science teacher, who perhaps had a history with him, was right to be suspicious of his claim. (PS: I think disassembling and reassembling things is a great sign of curiosity)

Was the principal wrong? Again, I think a charitable interpretation suggests clearly not. She did the logically correct thing by getting the police involved. Now, did the police screw up? Right now, I think they botched it big-time. But who knows; perhaps more will be revealed to us.

The world is complicated. Most narratives don't confirm comfortably with our beliefs. We should just accept that.

Thursday, September 24, 2015


Recent profiles/biographical pieces:

1. Elizabeth Holmes at Theranos (
Of course, one obvious difference between them is that Holmes is a young woman in an environment that has long favored young men. But there are few entrepreneurs--of either gender--with Holmes's record of accomplishment and even fewer willing to talk about it publicly. Holmes didn't set out to become a role model; she set out to save lives. But now, as the world's youngest female self-made billionaire, she's stumbled into this rarefied position and is beginning to own it. "I really believe it's like the four-minute mile," says Holmes, whose estimated net worth is $4.5 billion. "When one person does it, more and more people do it."
2. Energy Secretary Arne Duncan (politico)
“Here’s what people don’t get about Arne: I’ve never met anyone as physically and mentally tough,” Rogers told me. “I’ve seen him play with a broken hand. I’ve seen him play with blood pouring down his face. People get the wrong impression of him, because he’s so patient and calm and civil.”
3. Chief Justice John Roberts: (BloombergView)
It would be nice to think that history will vindicate Roberts. But it hasn’t vindicated Frankfurter -- at least not yet. Constitutional law should be more than pure politics. Roberts deserves admiration, not contempt. Maybe someday he’ll get it.

Monday, September 14, 2015

Interesting Quotes

Here are some interesting quotes that passed by me over the past few days:

Choose a discipline you love and you'll never work a day in your life likely because that field isn't hiring. (ShitAcademicsSay)

Asymptotics is the art of knowing where to be sloppy and where to be precise. - Concrete Mathematics (via John D Cook)

You should call it entropy, for two reasons. In the first place your uncertainty function has been used in statistical mechanics under that name, so it already has a name. In the second place, and more important, no one really knows what entropy really is, so in a debate you will always have the advantage. (von Neumann to Claude Shannon)

FORTRAN is not a flower but a weed — it is hardy, occasionally blooms, and grows in every computer. (Alan J. Perlis)

For some people, "substitute X for Y" means replace X with Y. For others, replace Y with X. (Grant Barrett)

I think that it is a relatively good approximation to truth — which is much too complicated to allow anything but approximations — that mathematical ideas originate in empirics. von Neumann

A programming language is low level when its programs require attention to the irrelevant. (Alan J. Perlis)

Tuesday, September 8, 2015

Splitting Up: The Problem

Suppose you go out to share a meal with a bunch of friends. When the bill arrives, everybody puts different amounts of cash into a central pot, depending on what they have on them.

Assume there are N people, and the total bill is $B. Suppose the amounts pitched in are \(y_1, y_2, ... y_N\), so that \[y_1 + y_2 + ... + y_N = B.\] For concreteness assume that there are 4 friends, who contribute $15, $20, $1, and $4 to pay off a total bill of B = $40. Note 15 + 20 + 1 + 4 = $40.

We can create a list of net credit/debit by subtracting $B/N from each of the contributions. Thus, we set, \(x_i = y_i - B/N\). Note that \[x_1 + x_2 + ... + x_N = 0.\] In the case of our concrete example, we get a list $5, $10, -$9, -$6, which adds to zero.

The problem is to take such a list of numbers, and come up with a list of "binary" transactions transactions, so that the accounts are settled.

We want to try to do this while minimizing the total number of transactions.

In our concrete example, we could settle accounts with the following three transactions:

Person 4 -> Person 1: $5
Person 4 -> Person 2: $1
Person 3 -> Person 2: $9.

The solution is clearly not unique. For example, another possible solution with 3 transactions is:

Person 3 -> Person 1: $5
Person 3 -> Person 2: $4
Person 4 -> Person 2: $6.

Exemptions: Let me throw in an additional wrinkle, which is a common occurrence.

Suppose some of people "exempted" from certain costs. This could happen for all sorts of reasons. For example:

  • You have one or two birthday boys/girls, who you don't want to take contributions from
  • Some of you may order drinks. You may want to separate the "drinks" portion from the rest of the meal
  • Same thing with vegetarian/non-vegetarian
  • Etc.
So in addition to the contributions \(y_i\), suppose each person is exempt from a portion \(e_i\) of the total bill.

In our particular example, suppose Person 3 was exempt from $16 of the total bill (perhaps because he was a teetotaler and vegetarian), and Person 4 was exempt from $10 of the total bill (only vegetarian). Thus, a list of names, contributions (y), and exemptions (e), may look like:

Person1, $15, $0
Person2, $20, $0
Person3, $1, $16
Person4, $4, $10

Generating the set of \(\mathbf{x} = x_i\) from \(\mathbf{y} = y_i\) and \(\mathbf{e} = e_i\) is somewhat nontrivial. It can be obtained using the following algorithm:

  1. initialize xi = 0, and n = N.
  2. set the cost basis, fi = B - ei, for i = 1, 2, ..., n
  3. sort fi from largest (f1) to smallest (fn)
  4. let xi = xi + fn/n, for i = 1, 2, ..., n
  5. let fi = fi - fn, for i = 1, 2, ..., n
  6. reset n = number of nonzero fi
  7. repeat steps 4 through 6, until n = 0.
  8. set xi = yi - xi
For this problem,

Iteration 1:
1. n = 4
2 and 3. fi = {40, 40, 30, 24}, [note: names = {Person1, Person2, Person4, Person3}]
4. xi = {6, 6, 6, 6}
5. fi = {16, 16, 6, 0}
6. n = 3

Iteration 2:
4. xi = {8, 8, 8, 6}
5. fi = {10, 10, 0, 0}
6. n = 2

Iteration 3:
4. xi = {13, 13, 8, 6}
5. fi = {0, 0, 0, 0}
6. n = 0

Outside the loop, the net contributions are:
8. xi = {2, 7, -4, -5}

Note that the list of persons associated with the amounts has changed to {Person1, Person2, Person4, Person3}.