v1 <- c(1, 2, 3)
v2 <- c(4, 5, 6)
dot_product <- sum(v1 * v2)
print(dot_product)
## [1] 32
v3 <- c(1, 2, 3)
v4 <- c(4, 5, 6)
cross_product <- crossprod(v3, v4)
print(cross_product)
## [,1]
## [1,] 32
v5 <- c(1, 2, 3)
norm_v5 <- sqrt(sum(v5^2))
print(norm_v5)
## [1] 3.741657
M <- matrix(c(1, 2, 3, 4), nrow = 2, ncol = 2)
determinant <- det(M)
print(determinant)
## [1] -2
inv_M <- solve(M)
print(inv_M)
## [,1] [,2]
## [1,] -2 1.5
## [2,] 1 -0.5