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.







Monday, May 4, 2015

Subplots in Veusz

Continuing from the previous post, let us look at how to do subplots in Veusz. It's elementary, really!

In this tutorial, I imported the dataset near the end. You could, of course, load it in anytime.

1. By default, there is a single graph "graph1" under "page1". Let us first get rid of it.


2. Insert a grid in its place. Specify the number of rows and columns. By default it is 2 by 2. Here I want one graph stacked on top of another, so I choose two rows and one column.


3. Under "grid1", insert two graphs, by clicking on the graph icon twice. The graphs go into their corresponding places.


4. Choosing one graph at a time, insert the type of plot (here "xy"), and decorate it, as you will.