Page 233 - Data Science class 11
P. 233
When we execute the above code, it produces the following result:
b. Matrix Multiplication & Division
Example
Enter the following code snippet:
# Create two 2x3 matrices.
matrix1 <- matrix(c(2, 9, -1, 4, 2, 5), nrow = 2)
print(matrix1)
matrix2 <- matrix(c(4, 3, 0, 9, 3, 4), nrow = 2)
print(matrix2)
# Multiply the matrices.
result <- matrix1 * matrix2
cat("Result of multiplication","\n")
print(result)
# Divide the matrices
result <- matrix1 / matrix2
cat("Result of division","\n")
print(result)
When we execute the above code, it produces the following result:
Programming with R 231

