Friday, June 29, 2012

Some Language Links of Interest

1. How language affects math:
In English, we say fourteen, sixteen, seventeen, eighteen, and nineteen, so one might expect that we would also say oneteen, twoteen, threeteen, and fiveteen. But we don’t. We use a different form: eleven, twelve, thirteen and fifteen. Similarly, we have forty and sixty, which sound like the words they are related to (four and six). But we also say twenty, thirty and fifty, which only sort of sound like two and three and five. And for that matter, for numbers above twenty, we put the ‘decade’ first and the unit number second (twenty-one, twenty-two) whereas for the teens, we do it the other way around (fourteen, seventeen, and eighteen). The number system in English is clearly highly irregular.
2. Acronyms and Initialisms: I whiled away a good hour on the wikipedia pageAIDS and SONAR are acronyms (pronounced as one word), while FBI and USA (pronounced as individual letters) are initialisms. Things are sometimes not as clearcut. What about MS-DOS and MPEG? And what about things like FAQ, SAT, and GRE, which are can be used either way.

3. Some tips on good grammar.

Saturday, June 23, 2012

Hussman on Eurobonds

With respect to Eurobonds, investors should understand that what is really being proposed is a system where all European countries share the collective credit risk of European member countries, allowing each country to issue debt on that collective credit standing, but leaving the more fiscally responsible ones - Germany and a handful of other European states - actually obligated to make good on the debt. 
This is like 9 broke guys walking up to Warren Buffett and proposing that they all get together so each of them can issue "Warrenbonds." About 90% of the group would agree on the wisdom of that idea, and Warren would be criticized as a "holdout" to the success of the plan. You'd have 9 guys issuing press releases on their "general agreement" about the concept, and in his weaker moments, Buffett might even offer to "study" the proposal. But Buffett would never agree unless he could impose spending austerity and nearly complete authority over the budgets of those 9 guys. None of them would be willing to give up that much sovereignty, so the idea would never get off the ground. Without major steps toward fiscal union involving a substantial loss of national sovereignty, the same is true for Eurobonds.

Thursday, June 21, 2012

Linear regression and logarithms don't mix?

You have a power-law model \(y=a_0 x^{a_1}\), and a bunch of experimental data points \[\begin{bmatrix}x_1 & y_1 \\ x_2 & y_2 \\ \vdots & \vdots \\ x_n & y_n\end{bmatrix}.\]
You want to estimate \(a_0\) and \(a_1\), it is tempting to take the logarithm of both sides \(\log y = \log a_0 + a_1 \log x\), and perform linear regression on suitably transformed experimental data \[\begin{bmatrix}\log x_1 & \log y_1 \\ \log x_2 & \log y_2 \\ \vdots & \vdots \\ \log x_n & \log y_n\end{bmatrix}.\]
Beware! You may get something different from what you expect! And your answers might not mean much.

Perhaps, you should be doing maximum likelihood instead. Here is a nice tutorial (pdf) on it.

PS: Part of the motivation for this post was this.

Monday, June 18, 2012

Paper or Plastic?

I have often seriously thought of looking for the "correct" answer to the ubiquitous "paper or plastic?" question that greets so many of us at the end of each grocery trip.

As I've always suspected, it is a trick question: the correct answer is this:
for sale at
A little bit of surfing brought up these two links and some startling facts therein. MSNBC also has a decent interactive presentation.

If you have to choose however, my take is that - other than biodegradability - plastic trumps paper.  Biodegradability is certainly important, but perhaps there is some hope.

To make those innocuous paper bags it takes:
  • 4x more energy
  • 20x more fresh water
  • far more toxic chemicals that cause greater air and water pollution
In addition, they aren't recycled significantly more.

Tuesday, June 12, 2012

Why "x" became the unknown?

A really short (4 minute) video on TEDx (H/T Ramanan Iyer).

Answer: Translation from Arabic to Spanish.

Sunday, June 10, 2012

Interesting things I learnt recently

1. PLU Codes: I never knew those "Price LookUp" (PLU) codes on fruits and vegetables meant anything:
PLU codes: gardenpartynyc
According to the wikipedia entry:
The code is usually a four-digit number, currently in the 3000–4999 range, identifying the type of bulk produce, including the variety. The Produce Marketing Association suggests an optional convention whereby a fifth digit may be prefixed to the number to indicate if the produce is organic (prefixed by a '9') or genetically modified (prefixed by an '8').
However, adherence to PLU standards is voluntary, and you cannot use it to reliably tell whether something is organic.

2. GPU Programming in Matlab: I knew it was possible, but I did not realize how simple it was, until I sat through a MathWorks seminar on campus. While it works only with newer NVIDIA cards (that can handle double precision naturally) and allows only certain kinds of parallelizations, I must admit (with glee) that they've made it much easier to tame problems by throwing additional hardware at it.

Thursday, June 7, 2012

Links: People Edition

1. Are Steve Job's shoes too big to fill? Perhaps not for Tim Cook, who is rebuilding Apple in his image.
What's clear is that Cook is behaving like his own man, putting his stamp on Apple -- including some moves that will court controversy with the Apple faithful, watchful as they are for the slightest deviation from their perception of the Steve Jobs playbook. Cook consistently pays homage to the legacy of Jobs, but he doesn't apologize for charting a new course. He seems, at the end of the day, to be honoring one of Jobs' dying requests: that Apple's management not ask "What would Steve do?" and instead do what's best for Apple.
2. Walter Issacson on Benjamin Franklin (video)

Tuesday, June 5, 2012

TeXmaker: Setting up user tags

Texmaker is a really nice LaTeX editor, and has become my default choice. It has many things to recommend itself, including the fact that it is platform independent, has auto-complete (commands, references, and citations), is easy to configure and use etc.

A particular feature that I have grown to depend on is command shortcuts. Texmaker allows the user to define keyboard shortcuts to commands and environments, by going to User > User Tags > Edit User Tags.

Simple commands are quite easy. For example, if you find yourself using the command "\pause" (in beamer presentations) very frequently, you can go to User > User Tags > Edit User Tags, pick a function key (1-10 - say "1"), enter "\pause" in the LaTeX content box. Pressing Shift+F1, automatically inserts \pause at the cursor.

Let us say you have a lot of vectors in your equations, and you like to bold-face your vectors with \mathbf{}. You can create a shortcut to this by saying "\mathbf{@}" in the LaTeX content box. When you press Shift+FX (X=1-10, as appropriate), you get the \mathbf{} tag, and your cursor lies between the curly braces. You can also select some text and press Shift+FX and the \mathbf{} tag does what you would like/expect it to to.

You can also define shortcuts to environments. Say you use the "\begin{frame} \end{frame}" environment a lot. All you do is say "%frame" in the LaTeX content box.

Friday, June 1, 2012

Grace Tutorial: How to plot a graph with two different y-axes?

Say you have a dataset that looks like

x1, y1, Y2
x2, y2, Y2
xn, yn, Yn

and you want to plot (x,y) and (x,Y) with the same x-axis but different y-axes. As an example, consider the following graph (bigger versions of graphs upon clicking) where (x,y) are on a linear scale, and (x,Y) are on a logarithmic scale.

How do you make such a picture in Grace?

The strategy is very similar to making inset plots, which I wrote about a while ago. In fact, we could use essentially the same method, where the "inset" is the size of the main graph.

But we can do slightly better (and not have to deal with manually cleaning up extra tics) by using the "overlay" feature.

1. Read in the (x,y) dataset into the default graph G0 using Data -> Import -> ASCII dialog box.
2. In the same dialog box (Grace:Read Sets), right click on the "G0" graph, and choose "Create new" and create a new graph "G1"

3. Read in the other dataset (x,Y) into this graph. At this point, the graph looks somewhat garbled as seen below.

4. Click the Edit -> Overlay graphs to open up the overlay dialog box which looks like the following picture. I chose to overlay G1 on G0, and use a common x-axis. You can make different choices.

5. Once you do that, you essentially get what you need. You can go ahead and edit the appearance of the axes and sets. Since the graphs are on top of each other, it is sometimes hard to figure out which graph you are changing. Remember that clicking on the screen lets you toggle through the graphs. If you have widely varying y-axis (as in this example) you can figure out which one is active by looking at the co-ordinate marker right below main menu on the top left side.

6. Alternatively, you can open the Plot -> Graph appearance dialog box and changes the co-ordinates of the viewport so that the two graphs are non-overlapping. It makes clicking easier. You will have to repeat step 4, and undo changes to the viewport, once you've modified the graphs to your satisfaction.