Thursday, March 26, 2015

On History Education

I am a big fan of Dan Carlin's "Hardcore History" podcast, which is (partially) available on iTunes. I recently re-listened to the "Wrath of the Khans", which provides an amazing overview of the rise and fall of the Mongol empire.

He wrote a short-piece for edutopia on how he would restructure history curriculum at the K-12 level. Here's is the key message:
Were I anointed History Czar, I would ditch the curricula entirely. These things are holdovers from another era of history instruction. My goal would be to get kids to love the study of the past by connecting to their affinities. Into music? It's got a history. Motorcycles? Fashion? Entertainment? Sports? Getting them to explore the history of a subject they already love is a great way to teach historical knowledge and how the current reality came to be. In the 21st century, this is the greatest practical value the study of the past provides.
As somebody whose interest in history increased rapidly, after I stopped learning it formally, I do see considerable value in this proposition.

Here is a reddit AMA that he participated in.

NB: It should be pointed out that Dan Carlin's standing among professional historians is mixed.


Tuesday, March 24, 2015

Randomized Control Trials

Nancy Cartwright, who is a philosopher of science, wrote this interesting article in the Lancet (open-access) called "A philosopher's view of the long road from RCTs to effectiveness".

In RCTs, eligible individuals are randomly assigned to a control group (which does not receive the intervention), and a treatment group (which does). The main advantage is that RCTs "control for unknown confounders", and any significant difference in outcome between the control and treatment groups, in an ideal RCT, may be causally ascribed to the intervention.

Some of the well-known advantages, successes, and disadvantages are listed in wikipedia's entry on the topic.

Dr. Cartwright describes the premises that need to be in place for an RCT to be "ideal", and then goes into some more philosophical limitations:
[RCTs] are ideal for ensuring “the treatment caused the outcome in some members of the study”—ie, they are ideal for supporting “it-works-somewhere” claims. [...] For policy and practice we do not need to know “it works somewhere”. We need evidence for “it-will-work-for-us” claims: the treatment will produce the desired outcome in our situation as implemented there.
She offers some suggestions. Definitely worth a look.

Friday, March 20, 2015

Customized 3D Visualizations

For sometime now, I've longed for a programmable, simple to use 3D visualization software, which has all the basic primitives (spheres, cylinders, etc.) predefined. Most of the time, I have to visualize molecular configurations.

Yes, there is a slew of very good ready-made programs that allows us to do this. Here is a list of molecular visualization software from Wikipedia. I have, and continue to use AtomEye and VMD. However, a lot of my simulations are very coarse grained - so that the "atoms" in my simulations are really "superatoms" into which many small atoms have been subsumed.

The "bonds" between atoms that these programs draw (or refuse to draw, in case of bead-spring polymers) is one among many minor annoyances that I had learned to live with.

Until I found Povray. Povray is great when you want to create beautiful renderings, has basic primitives, and a sophisticated set of options including lighting, camera, etc. I used it for a while.

But Povray always felt like a professional camera placed in the hands of a person who would rather use his iPhone to take point-and-shoot images.

Finally, late last year I discovered vPython. As its tagline suggests, it is "3D programming for ordinary mortals". Here is the wikipedia entry for additional context.

The learning curve is surprisingly gradual for someone already exposed to Python. The graphics window in which objects are rendered is interactive (one can zoom in and out, scale, rotate, and do all the usual fun stuff), and one can easily do basic animations.

Here are some basic tutorials to get started:

1. A bunch of YouTube videos
2. An official tutorial

Friday, March 13, 2015

Installing OctaveForge Packages

I recently had to install Octave's version of Matlab's Optimization Toolbox to perform a nonlinear least-squares curve fit. I thought I'd archive the process here, for future use.

I am doing this on a Ubuntu Desktop, but the process ought to be similar on other Linux machines.

Installing Packages

1. Install the package "liboctave-dev" using the GUI Software Center, Synaptic Package manager, or the command line as:
sudo apt-get install liboctave-dev
2. Go to Octave-Forge site to download the "tar-gz" file for the package you want to install. It tells you how up-to-date your Octave has to be, and what other packages you need.
Dependencies: Octave (>= 3.6.0) struct (>= 1.0.10)
I downloaded the struct-1.0.11.tar.gz and optim-1.4.1.tar.gz files.

3. Open an Octave session in the location where you saved the zipped files. At the prompt type:

> pkg install struct-1.0.11.tar.gz
> pkg install optim-1.4.1.tar.gz

If there are no errors, then the package is successfully installed.

UPDATE October 2018: With a newer Octave installation [ > 3.4.0], you can merge the download and install steps by a command like:

> pkg install -forge struct

It does the downloading, installing, and cleaning up for you.

Loading Packages

When you want to use a function from a package in an Octave program, you first have to load the package name (not the filename) into the session.

> pkg load optim # (note optim, not optim-1.4.1.tar.gz)

To unload a package

> pkg unload optim

Miscellaneous

Q: How do I find out what packages I have?
A: > pkg list

Package Name  | Version | Installation directory
--------------+---------+-----------------------
       optim  |   1.4.1 | /home/sachins/octave/optim-1.4.1
      struct  |  1.0.11 | /home/sachins/octave/struct-1.0.11


Q: How do I update installed packages?
A: If you have an internet connection, you can update packages from an Octave prompt by:
> pkg update

Q: Where are the installed packages?
A: By default they are stored in the ~/octave/ directory. If not present, it is created the first time you install an Octave package.

Wednesday, March 11, 2015

Mathy Links

1. Why do we pay pure math people? (mathwithbaddrawings)

2. GIFs that explain math concepts (IFLScience)

3. Why isn't everything normally distributed? (John D. Cook)

4. "Relative age effect" in Math learning? (The Secret Garden of Maths)

Saturday, March 7, 2015

Puzzle Solution: Kant and his Clock

Here is a potential solution to this problem.

Let "t" represent the difference between Kant's clock and the Schmidt's clock (the correct time) in minutes. Let "x" represent the amount of time it takes for Kant to walk from his house to Schmidt's.

For illustration, let us assume a concrete case: t = 60 mins, and x = 30 mins. Suppose Kant leaves his house at 1pm according to his clock, and stays at Schmidt's place for 2 hours.

Event Kant's ClockSchmidt's Clock
Leaves Home 1:00 2:00
Arrives at Schmidt's1:30 2:30
Leaves Schmidt's3:30 4:30
Arrives Home4:00 5:00


He can't be at two places at the same time (the problem would be trivially solved if he could). The bold red times in the table above indicate the clocks that Kant has access to at any particular point.

Since Kant knows his algebra he sets up a simple system of equations. The first equation can be set by observing in sloppy notation that 1:00 + t + x = 2:30. Since "t" and "x" are measured in minutes this is better represented as t + x = 90.

Similarly, 4:30 - t + x = 4:00, can be recast as x-t = -30.

Adding the two equations gives t = 60 and x = 30.

This can be easily generalized.

Monday, March 2, 2015

Puzzle: Kant and his Clock

Puzzle number 51 from Martin Gardner's "My Best Mathematical and Logic Puzzles":
It is said that Immanuel Kant was a bachelor of such regular habits that the good people of Königsberg would adjust their clocks when they saw him stroll past certain landmarks. 
One evening, Kant was dismayed to discover that his clock had run down. Evidently his manservant, who had taken the day off, had forgotten to wind it. The great philosopher did not reset the hands because his watch was being repaired and he had no way of knowing the correct time. He walked to the home of his friend Schmidt, a merchant who lived a mile or so away, glancing at the clock in Schmidt’s hallway as he entered the house. 
After visiting Schmidt for several hours Kant left and walked home along the route by which he came. As always, he walked with a slow steady gait that had not varied in 20 years. He had no notion of how long his return trip took. (Schmidt had recently moved into the area and Kant had not yet timed himself on this walk.) Nevertheless, when Kant entered his house, he immediately set his clock correctly. 
How did Kant know the correct time?
There is one point on which the puzzle could use additional clarification. Assume that the path from Kant's house to Schmidt's house was "flat", so that it took Kant exactly the same amount of time to make the onward and return journeys.