There is a clear distinction between a:
- Scalar:Â A function with no arguments
- Vector:Â A function with one argument
- Matrix:Â A function with two arguments
- Higher-order tensor: A function with more than two arguments
In what follows, the number of dimensions is the number of arguments of a function. The shape corresponds essentially to the domain of a function.
For instance, a vector of size n is a function from the set  to . As a result, its domain is . Its shape is defined as the singleton (n,). Similarly, a matrix of size  is a function defined on . The corresponding shape is simply the pair (m, n). The shape of an array is obtained by the function numpy.shape, and the number of dimensions by the function numpy.ndim; see also Section 4.6: Accessing and changing the shape.