library(matlib)
x <- matrix(c(5,-4,-1,1),2,2,TRUE)
y <- c(-10,2)
showEqn(x,y)
## 5*x1 - 4*x2 = -10
## -1*x1 + 1*x2 = 2
#MENEMUKAN NILAI X
Solve(x,y)
## x1 = -2
## x2 = 0
plotEqn(x,y) #untuk SPL dengan 2 variabel
## 5*x[1] - 4*x[2] = -10
## -x[1] + x[2] = 2
echelon(x,y)
## [,1] [,2] [,3]
## [1,] 1 0 -2
## [2,] 0 1 0
echelon(x,y, verbose=TRUE)
##
## Initial matrix:
## [,1] [,2] [,3]
## [1,] 5 -4 -10
## [2,] -1 1 2
##
## row: 1
##
## multiply row 1 by 0.2
## [,1] [,2] [,3]
## [1,] 1 -0.8 -2
## [2,] -1 1.0 2
##
## multiply row 1 by 1 and add to row 2
## [,1] [,2] [,3]
## [1,] 1 -0.8 -2
## [2,] 0 0.2 0
##
## row: 2
##
## multiply row 2 by 5
## [,1] [,2] [,3]
## [1,] 1 -0.8 -2
## [2,] 0 1.0 0
##
## multiply row 2 by 0.8 and add to row 1
## [,1] [,2] [,3]
## [1,] 1 0 -2
## [2,] 0 1 0
```