v1 <- c(8, 7, 6)
v2 <- c(3, 3, 3)
dot_product <- sum(v1 * v2)
print(dot_product)
## [1] 63
v3 <- c(2, 2, 2)
v4 <- c(1, 1, 1)
cross_product <- crossprod(v3, v4)
print(cross_product)
## [,1]
## [1,] 6
v5 <- c(1, 2, 3)
norm_v5 <- sqrt(sum(v5^4))
print(norm_v5)
## [1] 9.899495
M <- matrix(c(2, 4, 5, 6, 7, 8, 9, 3, 2, 1), nrow = 3, ncol = 3)
## Warning in matrix(c(2, 4, 5, 6, 7, 8, 9, 3, 2, 1), nrow = 3, ncol = 3): data
## length [10] is not a sub-multiple or multiple of the number of rows [3]
determinant <- det(M)
print(determinant)
## [1] -5
inv_M <- solve(M)
print(inv_M)
## [,1] [,2] [,3]
## [1,] 2.0 -12.0 9
## [2,] -1.4 8.2 -6
## [3,] 0.6 -2.8 2
Keseluruhan, kodingan tersebut melakukan berbagai operasi matematika pada vektor dan matriks, termasuk produk dot, produk cross, norma vektor, determinan matriks, dan invers matriks. Hasil dari setiap operasi tersebut dicetak sebagai output.