Previous Up Next

5.47.1  Identity matrix: idn identity

idn takes as argument an integer n or a square matrix.
idn returns the identity matrix of size n or of the same size as the matrix argument.
Input:

idn(2)

Output:

[[1,0],[0,1]]

Input:

idn(3)

Output:

[[1,0,0],[0,1,0],[0,0,1]]

Previous Up Next