If you are doing linear algebra, I agree. Yet linear algebra is not the only thing I want to do with numbers. I think most of the time I do use the elementwise operation, such as:
x = linspace(0,10, 1000)
y = (x<5)*4.0
z = x**2 + y
Of course I can just use matrices and then I have the information at hand that I am doing linear algebra right now: x = matrix([[3, 0],
[9, 5]])
Out[28]:
matrix([[ 9, 0],
[72, 25]])
x**2 + x
I think this is not too much boilerplate and gives nice semantic information within the sourcecode. However, if you want to perform this with a 2d array object, you can also use its dot method: In [ 1]: a
Out[ 1]:
array([[ 9, 0],
[72, 25]])
In [ 2]: a.dot(a)
Out[ 2]:
array([[ 81, 0],
[2448, 625]])
In [ 3]: a * a
Out[ 3]:
array([[ 81, 0],
[5184, 625]])
The approach of the matrix object nicely takes into account that operands of a "normal" multiplication `*` commute, so the elementwise multiplication fits the picture here. Wheres matrix multiplication - which is non-associative for most matrices - is performed by a different method.