M <- matrix(c(2, 5, 6, 1, 8, 10, 9, 4, 7), nrow = 3, byrow = TRUE) M1 <- cbind(M, c(3, 4, 1)) M2 <- cbind(c(7, 4, 5), M) sum_matrix <- M1 + M2 prod_matrix <- M1 * M2 M M1 M2 sum_matrix prod_matrix
Standard input is empty
[,1] [,2] [,3] [1,] 2 5 6 [2,] 1 8 10 [3,] 9 4 7 [,1] [,2] [,3] [,4] [1,] 2 5 6 3 [2,] 1 8 10 4 [3,] 9 4 7 1 [,1] [,2] [,3] [,4] [1,] 7 2 5 6 [2,] 4 1 8 10 [3,] 5 9 4 7 [,1] [,2] [,3] [,4] [1,] 9 7 11 9 [2,] 5 9 18 14 [3,] 14 13 11 8 [,1] [,2] [,3] [,4] [1,] 14 10 30 18 [2,] 4 8 80 40 [3,] 45 36 28 7