my_size <- 3 M_identity <- matrix(0, nrow = my_size, ncol = my_size) # solution diag(M_identity) <- 1 print(M_identity)
Utilizando o R, crie uma matrix identidade (valor 1 na diagonal, zero em qualquer outro) de tamanho 3X3. Dica: use função diag
para definir a diagonal da matrix.
extype: string
exsolution: r mchoice2string(c(TRUE, FALSE, FALSE, FALSE, FALSE), single = TRUE)
exname: "matrix"
exshuffle: TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.