Previous Up Next

2.43.3  Trace of a matrix : trace

trace takes as argument a matrix A.
trace returns the trace of the matrix A, that is the sum of the diagonal elements.
Input :

trace([[1,2],[3,4]])

Output :

5

Previous Up Next