Element-wise against matrix arithmetic, indexing, and the aggregates.
Between two vectors of equal length, * is element-wise: what a tabulated calculation wants, column against column.
An inner product is asked for by name, so it is never confused with the above.
Scalars broadcast.
Aggregates.
Indexing is one-based.
A vector is the column of n that rows and cols say it is, so it takes the column index as well: these are the same element. Any other column is out of bounds, which is what a column of one means.
Vectors carry units element by element, so a tabulated calculation keeps them.
A matrix is a vector of rows, and is indexed row first.
Between two matrices * is the matrix product, not element-wise. identity(n) writes the n×n one, which is dimensionless so that S - λ*identity(2) — the characteristic equation of a stress tensor — takes its dimension from λ.
diag writes a matrix with a vector down its diagonal — a mass matrix, here. The zeros carry the diagonal's dimension so the result is usable in arithmetic.
Linear algebra.
The check that inv is really an inverse.
The cross product is three-dimensional, and units come out of the products it is made of: metres crossed with newtons give newton-metres. -> N*m asks for the moment to be shown that way rather than in joules, which share the dimension but not the meaning.
Parallel vectors cross to zero, which is the check worth writing down.
Shape and slicing. A vector answers as the column it is.
Joining: side by side, and one above the other.