diagonal_matrix function
A matrix with the given list on its diagonal and zeros elsewhere.
How to write it
diagonal_matrix(list)
- list
- The diagonal. Takes a list.
Examples
diagonal_matrix([1, 2])In the solver,
Open in the solverdiagonal_matrix([1, 2])gives[[1, 0], [0, 2]].
Related functions
- diagonal
The diagonal of a matrix, as a list.
- hilbert_matrix
Hilbert matrix of a given size: the entry in row i and column j is 1/(i + j - 1).
- identity_matrix
Identity matrix of a given size.
- matrix_exp
Exponential of a square matrix.
- matrix_function
A function of a square matrix.
- matrix_log
Logarithm of a square matrix.