diagonal function
The diagonal of a matrix, as a list.
How to write it
diagonal(matrix)
- matrix
- A matrix, written as a list of rows. Takes a matrix, written as a list of rows.
Examples
diagonal([[1, 2], [3, 4]])In the solver,
Open in the solverdiagonal([[1, 2], [3, 4]])gives[1, 4].
Related functions
- diagonal_matrix
A matrix with the given list on its diagonal and zeros elsewhere.
- det
Determinant of a square matrix.
- dot
Dot product of two vectors, or product of two matrices.
- cross
Cross product of two vectors in three dimensions.
- eigensystem
Eigenvalues and eigenvectors of a square matrix together: the values, then the vectors.
- cholesky_decomposition
Cholesky decomposition of a symmetric positive definite matrix.