=====================================================
Nama Mahasiswa : Syafri Maulana Alfatih
NIM : 220605110139
Kelas : B
Mata Kuliah : Linear Algebra
Dosen Pengampu : Prof.Dr.Suhartono,M.Kom
Prodi : Teknik Informatika
Universitas : UIN Maulana Malik Ibrahim Malang
=====================================================
matrix(c(5, 6, 4, 1, 8, 4), nrow = 2,
ncol = 3, byrow = TRUE)
## [,1] [,2] [,3]
## [1,] 5 6 4
## [2,] 1 8 4
matrix
## function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)
## {
## if (is.object(data) || !is.atomic(data))
## data <- as.vector(data)
## .Internal(matrix(data, nrow, ncol, byrow, dimnames, missing(nrow),
## missing(ncol)))
## }
## <bytecode: 0x0000022266f88ce8>
## <environment: namespace:base>
matrix(4,2,2)
## [,1] [,2]
## [1,] 4 4
## [2,] 4 4
matrix
## function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)
## {
## if (is.object(data) || !is.atomic(data))
## data <- as.vector(data)
## .Internal(matrix(data, nrow, ncol, byrow, dimnames, missing(nrow),
## missing(ncol)))
## }
## <bytecode: 0x0000022266f88ce8>
## <environment: namespace:base>
R1 = matrix(c(4,-2,3,5), nrow=2,ncol=2)
R1
## [,1] [,2]
## [1,] 4 3
## [2,] -2 5
R2 = matrix(c(0,6,3,1), nrow=2,ncol=2)
R2
## [,1] [,2]
## [1,] 0 3
## [2,] 6 1
sum = R1 + R2
sum
## [,1] [,2]
## [1,] 4 6
## [2,] 4 6
difference = R1 - R2
difference
## [,1] [,2]
## [1,] 4 0
## [2,] -8 4
product = R1*R2
product
## [,1] [,2]
## [1,] 0 9
## [2,] -12 5
result = R1/R2
result
## [,1] [,2]
## [1,] Inf 1
## [2,] -0.3333333 5
R1 <- matrix(c(10,20,20,40),
ncol = 2,
byrow = TRUE)
library(Matrix)
rankMatrix(R1)[1]
## [1] 1
diag(c(22,-14,56))
## [,1] [,2] [,3]
## [1,] 22 0 0
## [2,] 0 -14 0
## [3,] 0 0 56
R1 <- matrix(c(3,9,7,2),
ncol = 2,
byrow = TRUE)
det(R1)
## [1] -57
R1 <- matrix(c(19,11,2,33),
ncol = 2,
byrow = TRUE)
solve(R1)
## [,1] [,2]
## [1,] 0.054545455 -0.01818182
## [2,] -0.003305785 0.03140496
R1 <- matrix(c(19,11,2,33),
ncol = 2,
byrow = TRUE)
t(R1)
## [,1] [,2]
## [1,] 19 2
## [2,] 11 33
R1 <- matrix(c(19,11,2,33),
ncol = 2,
byrow = TRUE)
eigen(R1)$values
## [1] 34.42615 17.57385
eigen(R1)$vectors
## [,1] [,2]
## [1,] -0.5805852 -0.9916999
## [2,] -0.8141995 0.1285739
R1 <- matrix(c(19,11,2,33),
ncol = 2,
byrow = TRUE)
R1^2
## [,1] [,2]
## [1,] 361 121
## [2,] 4 1089
R1 <- matrix(c(2,7,1,5), ncol = 2, byrow = TRUE)
R2 <- matrix(c(3,8,4,0),ncol = 2,byrow = TRUE)
R1 %o% R2
## , , 1, 1
##
## [,1] [,2]
## [1,] 6 21
## [2,] 3 15
##
## , , 2, 1
##
## [,1] [,2]
## [1,] 8 28
## [2,] 4 20
##
## , , 1, 2
##
## [,1] [,2]
## [1,] 16 56
## [2,] 8 40
##
## , , 2, 2
##
## [,1] [,2]
## [1,] 0 0
## [2,] 0 0
outer(R1, R2, FUN = "*")
## , , 1, 1
##
## [,1] [,2]
## [1,] 6 21
## [2,] 3 15
##
## , , 2, 1
##
## [,1] [,2]
## [1,] 8 28
## [2,] 4 20
##
## , , 1, 2
##
## [,1] [,2]
## [1,] 16 56
## [2,] 8 40
##
## , , 2, 2
##
## [,1] [,2]
## [1,] 0 0
## [2,] 0 0
R1 = matrix(c(0,3,5,1),nrow=2)
R2 = matrix(c(2,4,1,6),nrow=2)
crossprod(R1, R2)
## [,1] [,2]
## [1,] 12 18
## [2,] 14 11
tcrossprod(R1,R2)
## [,1] [,2]
## [1,] 5 30
## [2,] 7 18
R1 = matrix(c(0,3,5,1),nrow=2)
4*R1
## [,1] [,2]
## [1,] 0 20
## [2,] 12 4
R1 = matrix(c(0,3,5,1),nrow=2)
R2 = matrix(c(1,-2,4,6),nrow=2)
R1%*%R2
## [,1] [,2]
## [1,] -10 30
## [2,] 1 18
R1 = matrix(c(0,3,5,1),nrow=2)
R2 = matrix(c(1,-2,4,6),nrow=2)
R1%x%R2
## [,1] [,2] [,3] [,4]
## [1,] 0 0 5 20
## [2,] 0 0 -10 30
## [3,] 3 12 1 4
## [4,] -6 18 -2 6
s<-c(1:3)
t<-c(12:15)
sum<-s+t
## Warning in s + t: longer object length is not a multiple of shorter object
## length
sum
## [1] 13 15 17 16
s<-c(1:3)
t<-c(12:14)
product<-s*t
product
## [1] 12 26 42