Python "why" questions

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Aug 19 14:42:45 EDT 2010


On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote:

> For those who insist that zero-based indexing is a good idea, why you
> suppose mathematical vector/matrix notation has never used that
> convention? I have studied and used linear algebra extensively, and I
> have yet to see a single case of vector or matrix notation with zero-
> based indexing in a textbook or a technical paper. Also, mathematical
> summation is traditionally shown as "1 to N", not "0 to N-1". 

In my experience, it's more likely to be "0 to N" than either of the 
above, thus combining the worst of both notations.


> Are
> mathematicians just too simple-minded and unsophisticated to understand
> the value of zero-based indexing?

No, mathematicians are addicted to tradition.

Unlike computer scientists, who create new languages with radically 
different notation and syntax at the drop of a hat, mathematicians almost 
never change existing notation. Sometimes they *add* new notation, but 
more often they just re-use old notation in a new context. E.g. if you 
see (5, 8), does that mean a coordinate pair, a two-tuple, an open 
interval, or something else?

Additionally, mathematical notation isn't chosen for its ability to 
encourage or discourage errors. It seems often to be chosen arbitrarily, 
or for convenience, but mostly out of tradition and convention. Why do we 
use "x" for "unknown"? Why do we use i for an integer value, but not r 
for a real or c for a complex value?

Mathematicians are awfully lazy -- laziness is one of the cardinal 
virtues of the mathematician, as it is of programmers -- but they value 
brevity and conciseness over notation that improves readability and 
robustness. That's why they (e.g.) they use implicit multiplication, a 
plethora of "line noise" symbols that would boggle even Perl programmers, 
and two-dimensional syntax where the meaning of tokens depends on where 
they are written relative to some other token. (E.g. subscript, 
superscript, and related forms.)

There is one slightly mainstream language that uses mathematical 
notation: APL. The result isn't pretty. 



-- 
Steven 



More information about the Python-list mailing list