identity#
Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.
Available in: math cells, REPL.
Syntax#
identity(n)
identity(m, n)
identity([m, n])
Arguments and behavior#
For matrices, dimensions must match the operation. Singular matrices or incompatible shapes can fail. Cell indexing starts at 1. The example returns matrix.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
identity(3)Interactive examples could not load. You can still copy the expressions.
Expected result: matrix.
See also#
concat · det · diag · inv · ones · range · size · squeeze · subset · trace · transpose · zeros