summaryrefslogtreecommitdiff
path: root/Linear_Algebra_by_Jim_Hefferon/CH1/EX1.12/Ex1_12.R
blob: e7c4bf79f87685759f5fdf62c32a8561c23281cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#Example 1.12 Section I. Solving Linear Systems page7
#package used matlib v0.9.1
#install package using command: install.packages("matlib")
#Github reposiory of matlib :https://github.com/friendly/matlib

#installing and loading library
#install.packages("matlib")
library("matlib")

#program 
A <- matrix(c(1,2,2,3,1,2),ncol = 2)
b <- c(1,-3,-2)
#for this problem we cannot use normal method because the number of equations is more than number of variables
#so we use gaussian elimination technique.
gaussianElimination(A, b, tol = sqrt(.Machine$double.eps), verbose = FALSE,
                    latex = FALSE, fractions = FALSE)
# result shows that one of the equations is redundant, here x=-2,y=1