Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

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⁡((1234))=[1,4]\displaystyle \operatorname{diagonal}\left(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\right) = \left[ 1, 4 \right]
    diagonal([[1, 2], [3, 4]])

    In the solver, diagonal([[1, 2], [3, 4]]) gives [1, 4].

    Open in the solver
  • 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.