Module # 5 Doing Math [R Programming]
# Creating matrices A and B
A <- matrix(1:100, nrow = 10)
B <- matrix(1:1000, nrow = 10)
# Calculating the inverse of matrix A
A_inverse <- solve(A)
# Calculating the determinant of matrix B
B_det <- det(B)
# Printing the results
print("Inverse of Matrix A:")
print(A_inverse)
print("Determinant of Matrix B:")
print(B_det)
1. A_inverse <- solve(A): This line calculates the inverse of matrix A using the solve() function.
2. B_det <- det(B): This line calculates the determinant of matrix B using the det() function.
3. print("Inverse of Matrix A:") and print(A_inverse): These lines print the header and the result of the inverse of Matrix A.
4. print("Determinant of Matrix B:") and print(B_det): These lines print the header and the result of the determinant of Matrix B.
Comments
Post a Comment