5.47.3 Trace of a matrix: trace
The trace of a square matrix is the sum of the diagonal
elements. The trace command finds the trace of a matrix.
-
trace takes one argument:
A, a matrix.
- trace(A) returns the trace of the matrix A.
Example
Input:
trace([[1,2],[3,4]])
Output: