Skip to content

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

Léela en español

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

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

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])=(1002)\displaystyle \operatorname{diagonal\_matrix}(\left[ 1, 2 \right]) = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix}
    diagonal_matrix([1, 2])

    In the solver, diagonal_matrix([1, 2]) gives [[1, 0], [0, 2]].

    Open in the solver