Scalars, vectors, matrices and tensors
Linear algebra works with four kinds of object, told apart by how many indices it takes to pick out one number:
- Scalar: a single number, such as s ∈ ℝ.
- Vector: an ordered array of numbers, x ∈ ℝⁿ, with elements x₁, …, xₙ. Think of it as a point in space, one coordinate per axis.
- Matrix: a 2-D array, A ∈ ℝᵐˣⁿ, with m rows and n columns. Aᵢ,ⱼ is the entry in row i, column j.
- Tensor: an array with more than two axes, whose entries need three or more indices, such as Aᵢ,ⱼ,ₖ.
In code these are arrays with 0, 1, 2 and 3 or more dimensions: the ndim you will meet all through the workshop.