## Tuesday, December 15, 2015

### Military Food

After listening to a recent 99% invisible podcast, I was astonished to find the amount of "regular" food that was "invented by the military" for soldiers on long tours of duty.

As de Salcedo puts it,
although most people don’t realize it, the U.S. military spearheaded the invention of energy bars, restructured meat, extended-life bread, instant coffee, and much more. But there’s been an insidious mission creep: because the military enlisted industry—huge corporations such as ADM, ConAgra, General Mills, Hershey, Hormel, Mars, Nabisco, Reynolds, Smithfield, Swift, Tyson, and Unilever—to help develop and manufacture food for soldiers on the front line, over the years combat rations, or the key technologies used in engineering them, have ended up dominating grocery store shelves and refrigerator cases. TV dinners, the cheese powder in snack foods, cling wrap . . . The list is almost endless
Apparently, 70% of US diet is now composed of processed food.

The potential list of military inventions in food include salted meat, canning, Goldfish, granola bars, juice pouches, MacNCheese, Cheetos, McRibs, microwave oven, etc.

## Wednesday, December 9, 2015

### Universities, Safe-Spaces and Free-Speech

1. Nicholas Kristof's excellent piece in the NYT
This is sensitivity but also intolerance, and it is disproportionately an instinct on the left.
2. The reception of Maryam Namazie (also contains video)

The bullying of Namazie by members of ISOC was disgraceful. I saw the whole video, with the hope of actually finding something she said that truly qualified as Islamophobic - I was disappointed.

If somebody in a party, points out that there is food on your chin (or that your zipper is open), you can (i)  cry that somebody hurt your feelings in public, (ii) deny the uncomfortable fact with arguments (that's really a green mole), or (iii) acknowledge the merit of the claim, and take corrective action as appropriate.

The actual story has an interesting twist.

3. On the need to listen to facts and arguments that make us uncomfortable (NYT).
Consider, for example, the infamous case of Laura Kipnis, a professor of film at Northwestern University. In February, she published an essay in The Chronicle of Higher Education lamenting a supposed culture of sexual panic on campus. Writing in response to a student-requested administrative ban on student-faculty relationships, Kipnis argued that such relationships were not inherently destructive or exploitative. She further argued that the common contemporary perception that colleges are sites of mass sexual exploitation is indicative of a new Victorian take on the sexual lives of young adults. While making her case, Kipnis presented a not entirely sympathetic summary of a complaint of unwanted sexual interest that had been made by a Northwestern undergraduate against a philosophy professor. In response, students held a protest, some of them carrying mattresses, calling for formal censure of Kipnis. Worse, multiple Title IX complaints were filed against Kipnis, claiming that her essay had created a ‘‘chilling effect’’ that prevented students from feeling safe to pursue claims of sexual harassment or abuse. Incredibly, another university employee who attended Kipnis’s Title IX hearings in her support also had Title IX charges filed against him. Kipnis was initially unable to even know the names of her accusers.
4. Steve Handel on how not to grow as a person
We’ve reached a point where “safe spaces” aren’t just protecting weak and vulnerable people, but creating them and perpetuating them.

When you think about it, “safe space” is just another word for “comfort zone.”
If you’ve ever read anything about self improvement, you’ve probably seen advice about getting out of your “comfort zone,” trying new things, taking risks, and putting yourself out there.
To grow as a person is often the result of going outside of your “comfort zone.” When we push our boundaries, and not cling to them, is when we truly find opportunities to learn and improve ourselves.
5. Jonathan Haidt "The Yale problem begins in High-School"
Me: What kind of intellectual climate do you want here at Centerville? Would you rather have option A: a school where people with views you find offensive keep their mouths shut, or B: a school where everyone feels that they can speak up in class discussions?
Audience: All hands go up for B.
Me: OK, let’s see if you have that. When there is a class discussion about gender issues, do you feel free to speak up and say what you are thinking? Or do you feel that you are walking on eggshells and you must heavily censor yourself? Just the girls in the class, raise your hand if you feel you can speak up? [about 70% said they feel free, vs about 10% who said eggshells ]. Now just the boys? [about 80% said eggshells, nobody said they feel free].
Me: Now let’s try it for race. When a topic related to race comes up in class, do you feel free to speak up and say what you are thinking, or do you feel that you are walking on eggshells and you must heavily censor yourself? Just the non-white students? [the group was around 30% non-white, mostly South and East Asians, and some African Americans. A majority said they felt free to speak, although a large minority said eggshells] Now just the white students? [A large majority said eggshells]

Raul Pacheco-Vega writes a thoughtful essay on what it means to be successful in an academic career:
Let’s redefine success in academia not only based on books, book articles, chapters, but on what is really relevant to us. [...] I’m doing what I love and getting paid for it. And I am spending time with my parents, my friends and my loved ones.
To me, that’s success.

## Friday, November 27, 2015

1. Properties of the function $x^x$ (Post-Doc Ergo Propter Hoc H/T Dave Richeson). Can you prove:
$\int_{0}^{1} x^{x} = -\sum_{n=1}^{\infty} (-n)^{-n}$
2. Steve Strogatz on Einstein's boyhood proofs (newyorker).
The style of his Pythagorean proof, elegant and seemingly effortless, also portends something of the later scientist. Einstein draws a single line in Step 1, after which the Pythagorean theorem falls out like a ripe avocado. The same spirit of minimalism characterizes all of Einstein’s adult work. Incredibly, in the part of his special-relativity paper where he revolutionized our notions of space and time, he used no math beyond high-school algebra and geometry.
A strange derivative: let $f(x)=x^2 \sin(1/x^2)$ for $x \ne 0$, and $f(0)=0$. This function has $f'(0)=0$ even though $\lim_{x \rightarrow 0} f'(x),$ does not exist.

## Wednesday, November 25, 2015

### Logical Indexing in Octave/Matlab and Python/Numpy

Octave/Matlab

Consider the following set of operations in Octave or Matlab.

Make an array.

octave:1> x=1:10
x =
1    2    3    4    5    6    7    8    9   10

Which elements of "x" are greater than 5? The result is a logical array.

octave:2> c1 = x > 5
c1 =
0   0   0   0   0   1   1   1   1   1

Which elements are less than 8?

octave:3> c2 = x < 8
c2 =
1   1   1   1   1   1   1   0   0   0

The logical combination of two logical arrays is interpreted pair-wise.

octave:4> c = c1 & c2
c =
0   0   0   0   0   1   1   0   0   0

octave:5> x(c)
ans =
6   7

Python/Numpy

Now consider doing something similar in numpy.

>>> import numpy as np
>>> x=np.arange(1,11)
>>> x
array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])
>>> c1 = x > 5
>>> c1
array([False, False, False, False, False,  True,  True,  True,  True,  True], dtype=bool)
>>> c2 = x < 8

So far so good. But when I say,

>>> c = c1 and c2
Traceback (most recent call last):
File "", line 1, in
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The "and" command is good only to compare two bools, not arrays of bools. Therefore numpy suggests using x.any() or x.all() to collapse the vector of logical arguments to a scalar. For example.

>>> c1.all() # are all elements of c1 True?
False
>>> c1.any() # are any elements of c1 True?
True

To do an element-by-element comparison simply use np.logical_and or np.logical_or.

>>> c = np.logical_and(c1, c2)
>>> c
array([False, False, False, False, False,  True,  True, False, False, False], dtype=bool)

>>> x[c]
array([6, 7])

## Thursday, November 12, 2015

### A Moral Argument for Eating Meat

I promised that I would stop eating meat, the year I turned 35.

I failed.

The main arguments for going vegetarian are convincing:
• the greenest thing that an average person could do; nothing else comes close
• the cruelty and inhumanity of factory farming
• something screwed up about raising sentient life for food
I've scoured for arguments that counter the last point. Even if there was a carbon-neutral, perfectly humane way to raise animals, and slaughter them painlessly, would we be justified in raising and killing animals?

So far, none of the arguments seem compelling. The only narrow exception is when the survival of the individual is at stake.

For now, the story I tell to rationalize my choices is that most of my meals are vegetarian. One can't let the perfect be the enemy of the good.

Abstinence is hard, so moderation will have to do.

In a hundred years, our great-great-grandkids might look at our food choices with disgust. They might view us with the same odd combination of outrage and pity that with which we view historical moral crimes (slavery?).

## Tuesday, November 10, 2015

1. Ramanujan and elliptic curves
A box of manuscripts and three notebooks. That's all that's left of the work of Srinivasa Ramanujan, an Indian mathematician who lived his remarkable but short life around the beginning of the twentieth century. Yet, that small stash of mathematical legacy still yields surprises. Two mathematicians of Emory University, Ken Ono and Sarah Trebat-Leder, have recently made a fascinating discovery within its yellowed pages. It shows that Ramanujan was further ahead of his time than anyone had expected, and provides a beautiful link between several milestones in the history of mathematics.

2. Ramanujan and the disappearing number
This is exactly the answer Ramanujan gave in his letter to Hardy. This surprising result showed Hardy that Ramanujan had managed to derive the Riemann zeta function and its functional equation correctly himself. In fact Ramanujan, almost entirely self-taught, had reinvented many other areas of Western mathematics, on his own. He was a mathematical genius with an intuitive connection to mathematics. And Hardy displayed his own mathematical genius by seeing through Ramanujan's idiosyncratic notations to uncover the genius beneath.

## Monday, October 26, 2015

1. A profile of the the prolific Lowell Wood (Bloomberg).

It chronicles the story of an F student, as he accumulated more inventions than Thomas Alva Edison.
This habit [of obsessive reading] goes back at least five decades. “I went to hear Linus Pauling lecture when I was a student,” Wood says. “Afterward I waited until everybody else went away, and then I asked him frankly, ‘How do you come up with these huge number of wonderful ideas?’ He said, ‘There’s really nothing to it all. You just read, and you remember what you read.’”
“It’s frankly illiterate to not be optimistic. We’re going to see a blossoming across essentially every front, unprecedented in human technological history. This is not something that’s hoped for. This is baked in the cake.”
2. On the folly of Big Science awards (NYT)
Dr. Allison’s work is surely impressive. But it occurred alongside and in dialogue with a number of related findings. Researchers analyzed the citations that led to Dr. Allison’s drug and concluded that it relied on work conducted by 7,000 scientists at 5,700 institutions over a hundred-year period. Yet only he was recognized.
And there’s yet another problem. By honoring breakthroughs, award committees reinforce the misconception that science is all about discoveries, when the cornerstone of science is replication and corroboration of results, which ensure that a finding is real and not a false lead.
3.  Shinichi Mochizuki and the Impenetrable Proof (Nature)
Three years on, Mochizuki's proof remains in mathematical limbo — neither debunked nor accepted by the wider community. Mochizuki has estimated that it would take a maths graduate student about 10 years to be able to understand his work, and Fesenko believes that it would take even an expert in arithmetic geometry some 500 hours. So far, only four mathematicians say that they have been able to read the entire proof.

## Wednesday, October 21, 2015

### Splitting Up: A Python Program

I've been discussing the common, but not quite trivial problem of settling bills among a bunch of friends, in a couple of posts.

Here is a rudimentary (but fully functional) Python program which implements the algorithms.

One needs to create a 2 or 3 column csv file (INPUTFILE), and send it to the program. Here is the header portion of the program, which describes how one interacts with the program, in more detail.

# Given a set of contributions (and optionally expemptions) creates a list of pair-wise
# transactions which "settles" all accounts
#
# example : python splitup.py INPUTFILENAME
#
# : if INPUTFILENAME not provided then looks for csv file "input_table"
#
# : INPUTFILE = csv file containing 2 or three columns, for example
#
# Two column example: NAME, CONTRIBUTION
# Person1, 10
# Person2, 20
# Person3, 5
# Person4, 15
# Person5, 10
#
#
# Three column example: NAME, CONTRIBUTION, AND EXPEMPTION
# Person1, 10, 0
# Person2, 20, 5
# Person3, 5, 0
# Person4, 15, 5
# Person5, 10, 0

Try it out!

PS: I am still in the process of learning Python, and my coding style is admittedly funky.

## Sunday, October 18, 2015

1. Alexander Coward at Berkeley Math "blows the whistle":

This question is one that I asked, and in response it was made very clear to me what is meant by the norms of the department. It means teach from the textbook. It means stop emailing students with encouragement, handwritten notes and homework problems, and instead assign problems from the textbook at the start of the semester. It means stop using evidence-based practices like formative assessment. It means micro-manage the Graduate Student Instructors rather than allowing them to use their own, considerable, talent and creativity. And most of all it means this: Stop motivating students to work hard and attend class by being engaging, encouraging and inspiring, by sharing with them a passion for the beauty and wonder of mathematics, but instead by forcing them into obedience with endless busywork in the form of GPA-affecting homework and quizzes and assessments, day after day, semester after semester.
In a nutshell: Stop making us look bad. If you don't, we'll fire you.
2. Bruce Carlson of the "My history can beat up your politics" has a beautiful answer to the question, "Which is harder to amend: The US constitution or the Bible?"

3. Nature editorial on "science communication" (pdf), and the harassment of scientists who speak out on public forums. The particular case in question here concerns GM crops.
These headlines focused on Kevin Folta, a University of Florida researcher, because USRTK leaked his e-mails to three journalists. Two of them co-posted a PLOS blog (now removed), while the third wrote a front-page New York Times news story highlighting a $25,000 donation from Monsanto to Folta’s institution. In both cases, the reporters cherrypicked sentences from several thousand e-mails, highlighting Folta’s communications with Monsanto, often out of context, to insinuate that he is an industry shill—and thus presumably unfit to talk to the public. Folta broke no laws. The Monsanto funds were a donation to his university’s Foundation outreach program. They were tied neither to him directly nor to his research. His conflict of interest disclosures were wholly compliant with his university’s rules. He never used industry funds for personal gain. Yes, he did have interactions with companies, and he is involved in a communications program that receives funding from industry (as well as from numerous private individuals, foundations, farmer bureaus and the US Pork Board, etc). None of this is shocking or, indeed, unusual. ## Saturday, October 17, 2015 ### Splitting Up: An algorithm In a previous post, we considered an algorithm for settling accounts between friends who are splitting up a dinner bill. At the end of the "pre-processing" step, we have a list of names (say ['p1', 'p2', 'p4', 'p3'])and a list of corresponding net contributions (x = [2, 7, -4, -5]), which add to zero. We now consider the problem of generating the transaction list. The first thing to do is to sort contributions from highest to lowest. Here, we would have, [p2, 7], [p1, 2], [p4, -4], and [p3, -5]. We now consider a transaction between the first and last members of the list. Once consummated, one of the members will be "settled", and hence out of reckoning for the rest of the calculation. In this case, p3 pays p2$5, and is out! (Transaction 1)

We then re-sort the remaining members to get, [p2, 2], [p1, 2], and [p4, -4].

Again we consider a transaction between the first and last members of the list.

In this case, p4 pays p2 $2, and is p2 is done! (Transaction 2) We then re-sort the remaining members to get, [p1, 2], and [p4, -2], which can be settled by: In this case, p4 pays p1$2, and everyone is done.

It is easy to see that since at least one member drops out of contention during each transaction, we will need N-1 transactions at most.

We can write this up as an algorithm:

1. sort xi. set n = N.
2. consider transaction between x1 and xn.
3. if x1>abs(xn), transaction = pn pays $abs(xn) to p1, and is removed from the list. n = n - 1 4. elseif x1 5. elsife x1=abs(xn), transaction = pn pays x1 to p1, and both p1 and pn are removed from the list. n = n - 2 6. Sort remaining xi. 7. Repeat steps 3 through 6 until n = 0. ## Saturday, October 3, 2015 ### Introducing Unsolved Mathematical Mysteries in Grade School I came across this excellent (and provocatively titled) article, "Unsolved problems with Common-Core", which suggests interesting exercises to students all the way from kindergarten to high-school. These exercises then form a gateway to a big, usually unsolved, mathematical conjecture or hypothesis. Here is an example for kindergarten/1st grade: Can you color the map of Africa with four colors so that no two countries that touch are filled in with the same color? This is followed by: The unsolved problem: without trying all possibilities, can you tell when a map can be colored in with 3 colors so that no two countries that touch are filled in with the same color? Fascinating stuff! ## 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 ### Profiles Recent profiles/biographical pieces: 1. Elizabeth Holmes at Theranos (inc.com) 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}.

## Sunday, August 30, 2015

1. Aatish Bhatia and Robert Krulwich explore the relationship between heat conservation and animal size in their new blog.

2. Scott Adams on better writing. As an example, the essay begins with lines that draw you in:
I went from being a bad writer to a good writer after taking a one-day course in “business writing.” I couldn’t believe how simple it was.
3. Matt Might answers a question on getting tenure and raising a disabled child at the same time., with grace and optimism. Amazing perspective!

4. Who said doing science was easy? An interactive experience from 538. Science is strong because it is willing to make errors and fix them.

## Wednesday, August 19, 2015

### Analogy: Matrix As a Tree

When many of us first encounter matrices, we see them as a glorified table of numbers stuffed into special square brackets.

This is analogous to looking at a tree as a collection of biological cells.

It is not incorrect; but it is perhaps a tad too granular.

One can ask, "what is the function or application of a tree or a matrix?".

For a tree, the answer may be fruits, lumber, home for birds and animals etc.

For a matrix, it may be to flip a vector, stretch it, rotate it, or some combination thereof. Here we are thinking of the tree or the matrix in terms of its relationship with other things.

One could ask what the main structural parts are.

For a tree, it may be roots, trunk, branches, and leaves.

For a matrix, it may be useful to think of it in terms of a collection of column or row vectors, and the vector spaces that they define.

One could then ask a category question: "What kind of a tree is this?"

Is it an oak tree, a fruit tree, an evergreen, a gymnosperm, etc focusing on its distinguishing properties, and the categories that it belongs to.

Similarly, one can identify different types of matrices. Is a matrix symmetric? Invertible? Triangular? Sparse? What other trees and matrices are they related to.

## Monday, August 17, 2015

### Error Propagation in Python

The uncertainties package makes it extremely easy to perform numerical error propagation. If you have numbers with associated uncertainties like $x = 1 \pm 0.1$, and you want to find how the uncertainty propagates to functions of $x$.
Simple Example

from uncertainties import *

x = ufloat(1,0.1)  # x = 1 +/- 0.1

y = ufloat(2, 0.1)

print "x = ", x
print "x^2 = ", x**2
print "x/y =", x/y

Output:

x =  1.00+/-0.10
x^2 =  1.00+/-0.20
x/y = 0.50+/-0.06

Install

Installing the package is extremely easy with "pip".

Bigger Example

I had a datafile called "stiff.dat", which had data in columns. The first column was bp (base-pairs), the second and third columns were the contour length $L$ and the associated uncertainty $\Delta L$, and the last two columns were a quantity $D^2$ and $\Delta D^2$.

cat stiff.dat 25 5.31 0.18 42.25 4.36 50 15.07 0.84 108.46 23.03 75 24.99 2.26 129.92 29.36 100 36.05 3.85 169.35 20.40 125 49.91 4.91 263.68 88.00 150 58.04 5.82 354.27 66.53 175 80.64 6.89 508.11 132.49 200 85.61 7.73 651.71 234.54 250 129.23 10.16 1018.93 322.32 300 158.55 7.45 1240.22 474.75 425 267.88 13.32 7129.34 5050.29 What I wanted to compute was $s = L/\sqrt{D^2}.$ import numpy as np data = np.loadtxt('regular.dat') bp = data[:,0] N = len(bp) for i in range(N): L, dL = data[i,1:3] D2, dD2 = data[i,3:5] s = ufloat(L, dL)/(ufloat(D2, dD2)**0.5) print("{0:3d} {1:.4f} {2:0.4f}".format(int(bp[i]), s.n, s.s)) The ".n" and ".s" give access to the nominal value and the standard deviation. 25 0.7746 0.0603 50 1.4261 0.2046 75 2.2058 0.2223 100 2.4951 0.2947 125 2.7341 0.5820 150 3.3198 0.3114 175 3.6405 0.4322 200 4.1599 0.6252 250 4.7373 0.6742 300 5.1782 0.7471 425 5.4803 1.3160 Beyond The package has a lot of features. It has some native support for arrays types, correlation of variables, etc. Here are links to additional tutorial pages ## Friday, August 14, 2015 ### Links 1. Ten beautiful images from the winners of the 2015 National Geographic traveller photo contest (The Atlantic) 2. After Shashi Tharoor's viral video on whether Britain owes reparations to its former colonies, here is a brief history of the British East India Company (The Guardian) One of the very first Indian words to enter the English language was the Hindustani slang for plunder: “loot”. According to the Oxford English Dictionary, this word was rarely heard outside the plains of north India until the late 18th century, when it suddenly became a common term across Britain.[...] There are more Mughal artefacts stacked in this private house in the Welsh countryside than are on display at any one place in India – even the National Museum in Delhi. 3. John D. Cook has a list of life lessons from studying differential equations. They include gems like: • Some problems simply have no solution • Some problems have no simple solution. • Some problems have many solutions. 4. Google is in the news quite a bit this week; this article explores "why Google doesn’t care about hiring top college graduates?" Short answer: intellectual hubris, and a bad attitude towards failure. ## Monday, August 10, 2015 ### Links: 1. Does Facebook really for more video views than YouTube? (Hank Green doesn't think so) 2. A short portrait of Theodor Gisel or Dr. Seuss. 3. Romeo, Juliet and differential equations (a short suggestion, and an NYT blog) 4. Python is the new BASIC. When I say that Python is the new BASIC, I mean it as a compliment, to say that Python is in the best position to become a lingua franca for non-programmers to learn programming. I didn’t mean to imply that Python was an inelegant kludge. ### Multiple Secondary Axes in Veusz In this quick tutorial, I will revisit the topic of "how to plot a graph with two different y-axes" in Veusz. 1. Load in the datafile as usual. Click on images to see an enlarged version. 2. Add an axis. By default is called "axis1" and is oriented horizontally. Since we want a secondary "y-axis" we will align it "vertical"ly. 3. You can click on the secondary y-axis and move it to the desired location. For precision, you can choose the "axis position" link and numerically enter the desired position. 4. Add your charts. By default, both the charts use the primary y-axis (called "y"). The example below shows how we can change this for a particular "xy" chart. We'd have to choose "axis1" instead of the default "y". 5. If the labels on the secondary y-axis go off-page limits, you can resize your graph. 6. I like to color code the axis and the corresponding dataset, so that it is visually apparent. You could also use arrows, if you like. ## Monday, August 3, 2015 ### DeflateGate Links What have we learned from the Wells Report? One of the things we have learned is that measuring the pressure of a football is not as straightforward as one might think. The head referee for the game, Walt Anderson, was alerted before the game that there was a possibility that the Patriots might be under-inflating balls. Yet the gauge he brought to the game and that he remembers using, systematically overestimated the pressure in the ball by about .35 psi. This inaccuracy is roughly the amount of tampering the Patriots are accused of. We have learned that temperature and changes in temperature along with moisture have a huge effect on pressure, 2-3 times greater than the magnitude of deflation the Patriots are accused of. Brady can say, “I know I have legal risk but I am not settling because I didn’t do anything. Or I am settling for a fine to make this go away but no admission of guilt.” The NFL can say, “I know I have legal risk but I am not settling because of um I need to Make This Right™…um er integritude… the doctrine of cheater cheater pumpkin eater??!?” Disclaimer: I am a Patriots and Brady fan, so I probably suffer from confirmation bias. ## Wednesday, July 29, 2015 ### nohup and disown GNU Screen is good for "detaching" jobs associated with a particular terminal, so that the job carries on even when, for example, the terminal is killed, or you log out from a server. "nohup" and "disown" are other useful Linux commands with a far shallower learning curve. Case A: You know before-hand that you want to run a background job without interruption nohup foo& Case B: You submitted several background jobs, but now you want the jobs to persist even after you kill the terminal foo1& foo2& disown Or if you want to disown only a particular job, use the "jobs" command to find out job-ids and, disown %1 # disowns only foo1 Here is a nice thread on StackExchange on the difference between nohup and disown. ## Thursday, July 23, 2015 ### Computers, Algorithms, Insight Michael Nielsen has in interesting piece on "The Rise of Computer-Aided Explanation" in Quanta Magazine. Thus, we can view both statistical translation and computer-assisted proofs as instances of a much more general phenomenon: the rise of computer-assisted explanation. Such explanations are becoming increasingly important, not just in linguistics and mathematics, but in nearly all areas of human knowledge. But as smart skeptics like Chomsky and Deligne (and critics in other fields) have pointed out, these explanations can be unsatisfying. They argue that these computer techniques are not offering us the sort of insight provided by an orthodox approach. In short, they’re not real explanations. The ability to scavenge through "Big Data" and perform extraordinary brute force computations allow us to find "explanations". But is an explanation really an explanation, if a human cannot comprehend it? ## Friday, July 17, 2015 ### Python Links 1. Automate the Boring Stuff: Discusses topics like interfacing with Excel, Word, PDF docs, scheduling tasks and emails, manipulating images etc. The same author has two free online books on writing simple computer games with Python. 2. A deep dive into matplotlib (Jake Vanderplas) An obligatory link to handy libraries built on top of matplotlib mpltools and seaborn, which add functionality and let you customize the look and feel of matplotlib plots. 3. A keynote talk on the state of the python stack for scientific computing (HT John D Cook) ## Monday, July 13, 2015 ### Background and Foreground Jobs in Linux Linux/Unix lets you control how you interface with jobs quite conveniently. Here is a cheat-sheet I keep for my own use: Send Foreground to Background • Start foreground job in terminal • Press Ctrl+Z to suspend job • Type "bg" to send it to background • Check background jobs with jobs, top, or ps commands Example: sleep 1000    # job running in foreground
^Z
[1]+  Stopped                 sleep 1000

$bg [1]+ sleep 1000 &$ jobs
[1]+  Running                 sleep 1000 &

Send Background to Foreground

• Suppose you have multiple background jobs running
• Use jobs command to list them
• "fg" brings last background job into foreground
• fg %1 brings job #1 listed in output of the jobs command

Example:

$sleep 200& # submit job#1 [1] 9074$ sleep 100&  # submit job #2
[2] 9075

$fg # bring job #2 to foreground sleep 100 ^Z # suspend it [2]+ Stopped sleep 100$ bg   # put it back into background
[2]+ sleep 100 &

$jobs # check if both jobs running [1]- Running sleep 200 & [2]+ Running sleep 100 &$ fg %1  # bring job #1 to foreground
sleep 200

^C  # kill it using Ctrl+C

\$ jobs  # check to see if job#2 is still running
[2]+  Running                 sleep 100 &

## Tuesday, July 7, 2015

### Uncloudy Computing

Cloud computing has been a buzzword in the software industry for quite a few years now. I've often asked my software engineering friends, "what is so special about cloud computing? Haven't we had the client-server model since close to the dawn of the modern computing era?"

Sure, I can now access my files on DropBox or GoogleDrive from anywhere, using any device, but I've been remotely connecting to servers, for nearly two decades now. It doesn't strike me as a radical idea.

This morning, I was listening to BackStory, when one of the hosts Brian Balogh provided a good analogy. He was discussing with historian Bernie Carlson how Nicola Tesla and Edward Dean Adams used alternating current to transmit power from Niagara Falls to Buffalo.

Here is the relevant portion of the conversation from the transcript (emphasis mine):
BERNIE CARLSON: First, all of a sudden, companies could save money, because they could hook up to the grid and buy their energy from the electric company, and they could get rid of having to have big piles of coal in the backyard, in the yard of the factory, and a steam engine that the coal would feed and provide that. So all of the sudden–
BRIAN: Bernie, was this analogous to the cloud in computing, where companies that really have very little to do with computing can now just rely on a source of memory? They don’t have to go invest in huge banks of computers in order to store their data?
BERNIE CARLSON: Absolutely. That’s a perfect analogy. Companies didn’t have to have their own steam engines. They didn’t have to have their own generators. They didn’t have to have all the people that were working around those.
So the key insight (for me) is that the hype around cloud computing is not really around how it affects an individual, whose computing infrastructure may include a laptop, a desktop, a tablet, and a phone. This "infrastructure" is relatively inexpensive to administer and maintain.

It is about how, in principle, businesses no longer have to maintain and operate their own IT departments. Like the transition from local generators to the grid, this form of centralization potentially saves headaches, real-estate, and costs (due to scale and expertise).

If every business operates their own generator or IT system, there is overcapacity, since each business sizes its infrastructure to meet its peak demand, which lies idle during off-peak hours. Centralization facilitates efficient resource allocation.

Of course, the analogy is not perfect; information is not a commodity like electricity. Issues of secrecy and security are unique to information. Software upgrades, unlike electric equipment upgrades at an utility, may cause uneven disruption etc.

In any case, I found the analogy useful.

## Sunday, July 5, 2015

1. Can Algorithms Hire Better? (nytimes)

The No Argument

“I look for passion and hustle, and there’s no data algorithm that could ever get to the bottom of that,” said Amish Shah, founder and chief executive of Millennium Search, an executive search firm for the tech industry. “It’s an intuition, gut feel, chemistry.” He compared it to first meeting his wife.
The Yes Argument
“Similarity between the interviewer and interviewee — they’re from the same region, went to the same school, wore the same shirt, ordered the same tea — is hugely influential, even though it’s not predictive of how they perform down the road,” said Cade Massey, who studies behavior and judgment at the Wharton School of the University of Pennsylvania.

2. Can Algorithms Provide Better Financial Advice? (The Economist)
The platforms work by asking customers a few questions about who they are and what they are saving for. Applying textbook techniques for building up a balanced portfolio—more stable bonds for someone about to retire, more volatile equities for a younger investor, and so on—the algorithm suggests a mix of assets to invest in. Nearly all plump for around a dozen index funds which cheaply track major bond or stock indices such as the S&P500. They keep clear of mutual funds, let alone individual company shares.
3. Can Algorithms be Great Investors?

If you've heard of Jim Simons or Ray Dalio, you already know that rule-based investing can produce out-performance over prolonged periods of time.

4. Can Algorithms Replace (Some) Doctors? (techcrunch, EconTalk)
Let’s start with healthcare (or sickcare, as many knowledgeable people call it). Think about what happens when you visit a doctor. You have to physically go to the hospital or some office, where you wait (with no real predictability for how long), and then the nurse probably takes you in and checks your vitals. Only after all this does the doctor show up and, after some friendly banter, asks you to describe your own symptoms. The doctor assesses them and hunts around (probably in your throat or lungs) for clues as to their source, provides the diagnosis, writes a prescription, and sends you off.
The entire encounter should take no more than 15 minutes and usually takes probably less than that. Sometimes a test or two may be ordered, if you can afford it. And, as we all know, most of the time, it turns out to be some routine diagnosis with a standard treatment . . . something a computer algorithm could do if the treatment involved no harm, or at least do as well as the median doctor.

## Wednesday, July 1, 2015

### Random Number Generators

In preparation for a language and platform agnostic course on Markov Chain Monte Carlo, I compiled links to random number generators (in addition to uniform) for a bunch of different platforms.
• Python: Numpy by itself has a formidable list of distributions it can sample from. The scipy.stats module add even more firepower by increasing not only the number of standard distributions you can sample from, but also being able to do neat things like plotting the PDF, CDF, etc.
• GNU Octave: A fairly extensive list that contains most of the usual suspects comes standard. The "Statistics" package at OctaveForge adds to this set, and like the scipy.stats module lets you do more with standard distributions.
• Matlab: Core Matlab has only the barebones RNG capability - essentially uniform and normal distributions. You can enhance it by purchasing the Statistics and Machine Learning Toolbox. Also see John's implementation of RANLIB for Matlab below.
For compiled languages, my colleague John Burkardt has a implementations of RANLIB/RNGLIB which allow you to sample from "Beta, Chi-square Exponential, F, Gamma, Multivariate normal, Noncentral chi-square, Noncentral F, Univariate normal, random permutations, Real uniform, Binomial, Negative Binomial, Multinomial, Poisson and Integer uniform"

## Saturday, June 27, 2015

1. Color Illusions: Yet another example of the "fallibility" of sense perception

2.  A quantitative take on coffee (WaPo)

3. The inscrutable problem of grouping people (quanta)

5. Amazing collection of interesting maps (davidrumsey.com)

## Wednesday, June 24, 2015

Paradoxes involving summations of divergent series have invaded my Facebook stream.These include, for example claims like, $1 + 2 + 3 + ... = -1/12,$ $1 -1/2 + 1/3 -1/4 + ... = 0,$ which involve reasoning that jumps from "infinity = infinity + something" - which is fine, to conclude that therefore, "something = 0" - which is faulty.

Such problems are great at teaching subtleties that can usually be shoved under the rug.

Here is yet another example that a student (Nathan C.) recently brought up. We know that $i^2 = -1$. Consider the following steps and identify the misstep. $i^2 = \sqrt{-1} \sqrt{-1} = \sqrt{(-1)(-1)} = \sqrt{1} = 1 \neq -1$

## Monday, June 22, 2015

### More Thoughts on Modeling

Let me relate a story to set up my thinking for this post:

During my PhD at Michigan, I worked on some approximate models for polymer dynamics called slip-link (SL) models. This (SL) model was more accurate than the standard theoretical model. As expected, it took greater computational resources to numerically simulate my model (a few hours) than the standard theory (a few seconds).

There are some applications where this trade-off between accuracy and speed is desirable.

Of course, there are other richer models, which are more accurate and even more computationally expensive than mine.

One of the people on my committee asked me: "If computational speed were infinite, would anyone care about your model?" I don't remember exactly how I responded; my guess: some mumbled gibberish.

But this is indeed a profound question that touches upon what I said recently about seeking too much accuracy in models. If I can numerically compute the most accurate model available for something, should I waste my time with alternatives?

Let's set aside the hypothetical "if computer speed were infinite" part of the question, and work under the premise that such computers were indeed available.

Should we then simply use ab initio quantum mechanics, or perhaps, the standard model of physics (whatever that is!) to study everything?

But seriously, if you want to study migration of birds, or mechanical properties of a spaceship, or the ups and downs of a business cycle, would you really want to study it in terms of quarks?

As Douglas Adams pointed out in the Hitchhikers Guide, our computer model may give us the "Answer to the Ultimate Question of Life, the Universe, and Everything", and yet we may be unable to comprehend it.

Misquoting Richard Hamming, "the purpose of modeling is usually insight, not numbers."

## Thursday, June 18, 2015

About a month ago Massimo Pigliucci announced his "resignation" from the skeptic and atheist movement (SAM). His parting remarks were cutting and brutally honest.
[SAM is ] a community who worships celebrities who are often intellectual dilettantes, or at the very least have a tendency to talk about things of which they manifestly know very little; an ugly undertone of in-your-face confrontation and I’m-smarter-than-you-because-I-agree-with [insert your favorite New Atheist or equivalent]; loud proclamations about following reason and evidence wherever they may lead, accompanied by a degree of groupthink and unwillingness to change one’s mind that is trumped only by religious fundamentalists; and, lately, a willingness to engage in public shaming and other vicious social networking practices any time someone says something that doesn’t fit our own opinions, all the while of course claiming to protect “free speech” at all costs.
I will certainly miss both his insights, his ability to take other skeptics to task, and his deep understanding of the power and limitations of science.

Listen to this debate with Michael Shermer, for instance. He skillfully tears down the his opponents' arguments.

## Tuesday, June 16, 2015

### Cloudy Puzzle: Solution

We want to establish a mathematical relationship between the key variables of the problem: $h, R, \theta$ and $\phi$.

Consider the triangle PRQ; we can write, $\tan\left(\frac{\pi}{2} - \theta \right) = \frac{QP}{RQ} = \frac{QP}{OQ - OR}.$
Recognizing that the length of the segment OP is $R+ h$, we can further write:
$\tan\left(\frac{\pi}{2} - \theta \right) = \frac{(R+h) \cos \phi}{(R+h) \sin \phi - R}.$
Using the variable $a = h/R$, we can try to solve for $\phi$, which in this case leads to a quadratic equation. Let us limit $\theta < \pi/2$, since all other cases are trivial extensions.

If we let,  $A = a^{2} \tan^{2} \theta + a^{2} + 2 a \tan^{2}\theta + 2 a + \tan^{2} \theta,$ and $B = a \tan \theta + \tan \theta - 1,$ then the two solutions are: $\phi = -2 \tan^{-1} \left( \frac{a + 1 \pm \sqrt{A}}{B} \right).$
Due to the geometry, acceptable values of $\theta$ and $\phi$ lie in the region $[0, \pi/2]$. This constraint may be used to cull out the extraneous root.

It is useful to consider the limit of $a = h/R \ll 1.$ If we take the limit as it goes to zero, then  $\phi = -2 \tan^{-1} \left( \frac{ \pm|\tan \theta| + 1}{\tan \theta - 1} \right).$

## Monday, June 8, 2015

### Cloudy Puzzle

When I was walking to my office today, I was struck with this potentially interesting applied math problem.

I was looking at the sky, due east, I saw a fat and juicy rain cloud hanging at an angle of about 60 degrees to the horizon. The question that came to my mind was:

"How far away is the place where this particular rain cloud is directly over-head?"

Formulation

To make the problem tractable, let us assume (i) wind effects are negligible, (ii) the earth is a perfect sphere, (iii) the local topography is perfectly flat (no mountains or valleys).

These simplifications allow me to draw a conceptual picture like:

The inner circle represents the earth with radius $R$. You are at the point R in the picture. You observe the cloud at position P, which makes an angle of $\theta$ with the horizon denoted by the line H1-H2.

Let us assume that this rain cloud is at a height $h$ from the surface of the earth, so that the length of the line segment OP is $R+h$.

Clearly, the picture is not to scale!

S is the location where the cloud is directly overhead. We want to find the length of the arc RS.

To summarize, we know $R, h,$ and $\theta$. If we can somehow find the angle $\phi$ then we can infer the length of the chord RS, which would be the distance we seek.

## Tuesday, June 2, 2015

### Pinker and Taleb

Interesting back and forth between two heavy-weights: Steve Pinker and Nassim Taleb. If you ignore the drama (or perhaps get interested because of it), the debate has spurred a fair amount of interesting commentary, which makes for fascinating reading.

1. David Roodman offers some insights in two blog posts. Here is how he sets up the debate:
Two intellectual titans are arguing over whether humanity has become less violent. In his 2011 book, Steven Pinker contends that violence is way down since the stone age, or even since the Middle Ages. He looks at murder, war, capital punishment, even violence against animals.
But in a working paper released yesterday, Pasquale Cirillo and Nassim Taleb, the latter the author of The Black Swan: The Impact of the Highly Improbable, contend that Pinker has it wrong. Well, more precisely (lest I incite a riot with demagoguery) they challenge the notion that the great powers have enjoyed a distinctly long peace since World War II.
He sums up the state of the attack on Pinker's argument as being pretty flimsy.
I think if you are going use statistics to show that someone else is wrong, you should 1) state precisely what view you question, 2) provide examples of your opponent espousing this view, and 3) run statistical tests specified to test this view. Cirillo and Taleb skip the first two and hardly do the third. The “long peace” hypothesis is never precisely defined; Pinker’s work appears only in some orphan footnotes; the clear meaning of the “long peace”—a break with the past in 1945—is never directly tested for.
2. Dart-Throwing-Chimp breaks the gist of the debate using a more common metaphor. His position expresses skepticism to the question "can we use data to answer a question like that?"
Of course, the fact that a decades-long decline in violent conflict like the one we’ve seen since World War II could happen by chance doesn’t necessarily mean that it is happening by chance. The situation is not dissimilar to one we see in sports when a batter or shooter seems to go cold for a while. Oftentimes that cold streak will turn out to be part of the normal variation in performance, and the athlete will eventually regress to the mean—but not every time. Sometimes, athletes really do get and stay worse, maybe because of aging or an injury or some other life change, and the cold streak we see is the leading edge of that sustained decline. The hard part is telling in real time which process is happening. To try to do that, we might look for evidence of those plausible causes, but humans are notoriously good at spotting patterns where there are none, and at telling ourselves stories about why those patterns are occurring that turn out to be bunk.
The same logic applies to thinking about trends in violent conflict. Maybe the downward trend in observed death rates is just a chance occurrence in an unchanged system, but maybe it isn’t. [...] Just as rare events sometimes happen, so do systemic changes.
3. Michael Spagat puts in his two cents
[...] the only channel that Cirillo and Taleb implicitly empower to potentially knock their war-generating mechanism off its pedestal is the accumulation of historical data on war sizes and timings. Since they focus on extreme wars, however, it will take a very long time before it is even possible for enough evidence to accumulate to seriously challenge their assumption of an unchanging war-generating mechanism.

## Thursday, May 28, 2015

### Big History Project

This is truly awesome!
Big History examines our past, explains our present, and imagines our future. It's a story about us. An idea that arose from a desire to go beyond specialized and self-contained fields of study to grasp history as a whole. This growing, multi-disciplinary approach is focused on high school students, yet designed for anyone seeking answers to the big questions about the history of our Universe.
The Big History Project is a joint effort between teachers, scholars, scientists, and their supporters to bring a multi-disciplinary approach to knowledge to lifelong learners around the world.
I love this approach of learning history in terms of big sweeping trends. For a quick background on the project, and the role of Bill Gates, look up this wikipedia entry:
Bill Gates became interested in big history when he heard a series of 48 lectures by Christian published by The Teaching Company under the name "Big History: The Big Bang, Life on Earth, and the Rise of Humanity". For Gates, “he really blew me away. Here’s a guy who’s read across the sciences, humanities, and social sciences and brought it together in a single framework. It made me wish that I could have taken big history when I was young, because it would have given me a way to think about all of the school work and reading that followed. In particular, it really put the sciences in an interesting historical context and explained how they apply to a lot of contemporary concerns”.

## Tuesday, May 26, 2015

### "Consistency" Bug in NumPy?

I am sorry for doing some of these in succession, but a colleague of mine (Gordon Erlebacher) alerted me to this frustrating bug/feature in numpy.

>>> import numpy as np

>>> a = np.array([1,2,3])
>>> a = a * 0.3
>>> print a    # integers are converted to float
[ 0.3  0.6  0.9]

>>> a = np.array([1,2,3])
>>> a *= 0.3  # integers are not converted to float
>>> print a
[0 0 0]

I tested these on numpy 1.8.2, Python 2.7.6.

## Thursday, May 21, 2015

### SymPy Cheat Sheet

Finally, I decided to compile a set of commonly used (by me) SymPy commands.

Since Blogger's platform is somewhat unfriendly, I'm sharing it via:

(i) an iPython notebook @ nbviewer
(ii) a PDF document

Hopefully they work. Enjoy.

## Monday, May 18, 2015

### LongForm Articles

1. Wired has the gripping true cybercrime story of Silk Road in two parts. It has enough drugs, sex, computers, murder, and sabotage to make for an entertaining half hour.

2. Meet Rhino, the Survivor.

3. Patriots, DeflateGate, and the Wells Report. Russ Roberts looks at the evidence with a skeptic's eye.

## Monday, May 11, 2015

### Bug in SymPy Taylor Series?

Consider the series expansion of the function $f(x) = \exp(x)$, around $x = x_0 = 0$, up to, say, the the 4th order term.

>>> from sympy import *
>>> x = symbols('x')
>>> series(exp(x), x, 0, 4)
1 + x + x**2/2 + x**3/6 + O(x**4)

You get what you expect.

Now consider a similar expansion centered around  $x = x_0 = 1$.

>>> series(exp(x),x, 1, 4)
E + E*x + E*x**2/2 + E*x**3/6 + O(x**4)

Clearly, this is off.

The correct expansion may be obtained by substituting $x$ with $x-x_0$,

>>> (series(exp(x),x, 1, 4).removeO()).subs(x,x-1)
E*(x - 1)**3/6 + E*(x - 1)**2/2 + E*(x - 1) + E

## Friday, May 8, 2015

### Portrait of An American Terrorist

PBS Frontline and ProPublica present a chilling account of Daood Gilani's (a.k.a David Coleman Headley) rise and key role he playing in the 2008 Mumbai attacks in this hour-long documentary called the "The Perfect Terrorist".

I had never seen his picture before, and immediately learnt about Heterochromia iridum.

## Thursday, May 7, 2015

### Statistics and Wrongness

1. Statistics Done Wrong is a very readable excursion through common statistical mistakes, with an intuition  and reasoning substituting for equations, whenever possible. It is now also available in a book format.
Statistics Done Wrong is a guide to the most popular statistical errors and slip-ups committed by scientists every day, in the lab and in peer-reviewed journals. Many of the errors are prevalent in vast swaths of the published literature, casting doubt on the findings of thousands of papers. Statistics Done Wrong assumes no prior knowledge of statistics, so you can read it before your first statistics course or after thirty years of scientific practice.
As an example of the tone of the book consider the exposition on "little extremes":
Suppose you’re in charge of public school reform. As part of your research into the best teaching methods, you look at the effect of school size on standardized test scores. Do smaller schools perform better than larger schools? Should you try to build many small schools or a few large schools?
To answer this question, you compile a list of the highest-performing schools you have. The average school has about 1,000 students, but the top-scoring five or ten schools are almost all smaller than that. It seems that small schools do the best, perhaps because of their personal atmosphere where teachers can get to know students and help them individually.
Then you take a look at the worst-performing schools, expecting them to be large urban schools with thousands of students and overworked teachers. Surprise! They’re all small schools too.
Smaller schools have more widely varying average test scores, entirely because they have fewer students. With fewer students, there are fewer data points to establish the “true” performance of the teachers, and so the average scores vary widely. As schools get larger, test scores vary less, and in fact increase on average.
2. This second article I find fascinating, because it debunks a persuasive claim from Kahneman's "Thinking Fast, Thinking Slow" that I held to be true.

The original idea was that performance on a cognitively demanding task improved if the task was presented in a poor font, because it mobilized System 2.

Turns out that the original dataset with N=40 was an outlier.