In this module, we did more math with matrices! We were asked to examine two matrices, add them, minus them, and then use the diag() function. We were also asked to replicate/recreate a matrix with certain criteria. #Start with two matrices A = matrix(c(2, 0, 1, 3), ncol = 2) B = matrix(c(5, 2,4, -1), ncol = 2) #Call/View matrices A [,1] [,2] [1,] 2 1 [2,] 0 3 B [,1] [,2] [1,] 5 4 [2,] 2 -1 #It appears that both matrices are the same size, therefore can be combined, added, subtracted.. etc.. # Find A + B C <- A + B #Call / View matrix C [,1] [,2] [1,] 7 5 [2,] 2 2 # Find A - B D <- A - B #Call / View matrix D [,1] [,2] [1,] -3 -3 [2,] -2 4 #Use the diag() function to build a mat...
Comments
Post a Comment