Trace of a matrix (trace)
Trace of a square matrix: the sum of its diagonal.
How to write it
trace(matrix)
- matrix
- A square matrix. Takes a matrix, written as a list of rows.
Examples
trace([[1, 2], [3, 4]])In the solver,
Open in the solvertrace([[1, 2], [3, 4]])gives5.
Related functions
- transpose
Transpose of a matrix: its rows become its columns.
- tensor_product
Tensor product of two lists or matrices.
- upper_triangularize
A matrix with the entries below the diagonal set to zero.
- smith_decomposition
Smith normal form of an integer matrix, with the two matrices that reach it.
- adjugate
Adjugate of a square matrix: the transpose of its cofactors.
- singular_value_list
The singular values of a matrix.