MTM
sum
add elements in a matrix row or column
Calling Sequence
Parameters
Description
Examples
sum(M, dimension)
M
-
matrix, vector, or array
dimension
1 or 2
The sum(M) command computes the sum of the elements in the first non-singleton dimension of the given array.
The sum(M,dimension) command computes the sum of the elements in the given singleton dimension of the given array.
If M is 1-D, sum(M) computes the sum of the elements in the given vector.
If M is 2-D, sum(M) or sum(M, 1) creates a row vector of column sums of the matrix. The sum(M, 2) command creates a column vector of row sums of the matrix.
When M has n dimensions, sum will return an array with n-1 dimensions. Subarrays will be added together along the specified dimension (or first non-singleton dimension if unspecified).
with⁡MTM:
M≔Matrix⁡2,3,fill=12⁢x2⁢y3:
sum⁡M,1
24⁢x2⁢y324⁢x2⁢y324⁢x2⁢y3
See Also
MTM[prod]
Download Help Document