233
$\begingroup$

I have much more experience programming than I do with advanced mathematics, so perhaps this is just a comfort thing with me, but I often get frustrated trying to follow mathematical notation. Specifically, I get frustrated trying to keep track of what each variable signifies.

As a programmer, this would be completely unacceptable no matter how many comments you added explaining it:

float A(float P, float r, float n, float t) {   return P * pow(1 + r / n, n * t); } 

Yet a mathematician would have no problem with this:

$A = P\ \left(1+\dfrac{r}{n}\right)^{nt}$

where
$A$ = final amount
$P$ = principal amount (initial investment)
$r$ = annual nominal interest rate (as a decimal)
$n$ = number of times the interest is compounded per year
$t$ = number of years

So why don't I ever see the following?

$\text{final_amount} = \text{principal}\; \left(1+\dfrac{\text{interest_rate}}{\text{periods_per_yr}}\right)^{\text{periods_per_yr}\cdot\text{years}}$

  • 45
    Would you imagine writing, say, a long exact cohomology sequence not using a super-concise notation?!2011-02-28
  • 169
    Because it's long, it makes it hard to see patterns, and it makes you think about interpretation when you should be thinking about form.2011-02-28
  • 51
    When I first took economics, it took me a bit of time to _psychologically_ get over the fact that GDP, for example, stood for one quantity, not a product a three quantities.2011-02-28
  • 4
    Also, it also depends on what kind of programmer you are. APL programmers would beg to differ. (I personally think APL code is grotesque and unreadable, but for some reason, APL is still very popular among some financial types).2011-02-28
  • 7
    Multi-char vars can be very useful in some situations: e.g. in physical/chemical process modeling, the number of distinct variables can run into the hundreds/thousands easily. Single char variables just don't cut it in such situations -- people just end up using all kinds of multi-char subscripts/superscripts on single-char variables for disambiguation, and it ends up being messier than if they had just used multi-char variables to begin with. When the function of variable names is purely descriptive (rather than for revealing patterns), I believe a case can be made for multi-char vars).2011-02-28
  • 2
    +1 for a very interesting question, since I'm sure there's lot of people (like 'myself') that strongly reject the awful habbit of using the full text of Hamlet, or something of that magnitude, as a variable name, something which is all too common in chemistry or economics.2011-02-28
  • 3
    'Cause mathematicians love to keep this shadow of mystery around them. Whenever Grade 3 kids see letters in math problems, they start getting worried.2011-03-01
  • 4
    Even in programming, though, you don't want to spell *everything* out. Remember COBOL? (http://en.wikipedia.org/wiki/COBOL) :)2011-03-02

26 Answers 26