Sunday, September 20, 2009

Physicists do it with Symbols

One of the first rules we were always taught when I studied physics, in regards to equations, was to do all the math to the final form with the relevant symbolic representation, and only at the last step to actually use numbers to obtain the final result.

The reason for this is twofold -- first, you end up with a form of the equations you're dealing with you can use for various values, and second, you skip rounding errors.

Case in point: My Macroeconomics homework with three values for consumer price index baskets: $124 (baseline), $153 and $161.

First problem: calculate the CPIs, no decimals. The results are 100, 123 and 130. Clear as mud.

Second problem: calculate inflation between the last two. (130-123)/123 = 5.7%. Except I was doing the math in Excel, and had set it to only display the number of digits required in the answer. It displayed (130-123)/123 = 5.2%. Huh?

Well, Excel isn't a physicist, but it is a computer program so it carries a fair bit of precision. Though it displayed the rounded values, it actually did all the calculations with full precision, which turns out to be more like (1.298387097...-1.233870968...)/1.233870968... = 5.2288... %

I'm not convinced this homework really taught me what the professor thought it would.