summaryrefslogtreecommitdiff
path: root/Linear_Algebra_by_Jim_Hefferon/CH2
diff options
context:
space:
mode:
authorprashantsinalkar2019-10-04 12:24:07 +0530
committerprashantsinalkar2019-10-04 12:24:07 +0530
commitb3f3a8ecd454359a2e992161844f2fb599f8238a (patch)
tree7bb3f64824627ef179d5f341266a664fd0b69011 /Linear_Algebra_by_Jim_Hefferon/CH2
parent80492d3788738910b80dc16f918511057b7321d6 (diff)
downloadR_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.tar.gz
R_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.tar.bz2
R_TBC_Uploads-b3f3a8ecd454359a2e992161844f2fb599f8238a.zip
Initial commit/added all books
Diffstat (limited to 'Linear_Algebra_by_Jim_Hefferon/CH2')
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX1.16/Ex2_1_16.R16
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX1.6/Ex2_1_6.R19
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX1.9/Ex2_1_9.R8
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX3.10/Ex2_3_10.R13
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX3.2/Ex2_3_2.R18
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX3.5/Ex2_3_5.R20
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX3.7/Ex2_3_7.R20
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH2/EX3.9/Ex2_3_9.R18
8 files changed, 132 insertions, 0 deletions
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.16/Ex2_1_16.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.16/Ex2_1_16.R
new file mode 100644
index 00000000..87990e40
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.16/Ex2_1_16.R
@@ -0,0 +1,16 @@
+#Example 1.16,Section III. Basis and Dimension,page 118
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+v <- c(3,2)
+A <- matrix(c(1,1,0,2),ncol = 2)
+Av <- cbind(A,v)
+Av <- echelon(A,v,reduced = TRUE)
+Av
+#from Av,c1 = 3 and c2 = -1=2.
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.6/Ex2_1_6.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.6/Ex2_1_6.R
new file mode 100644
index 00000000..938d80aa
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.6/Ex2_1_6.R
@@ -0,0 +1,19 @@
+#Chapter 2.
+#Section II. Linear Independence
+#Example 1.6,page 103
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+#c1(40 15) + c2(-50 25) = (0 0),check if {(40 15),(-50 25)} is linearly independent
+A <- matrix(c(40,15,-50,25),ncol = 2)
+b <- c(0,0)
+Ab <- cbind(A,b)
+Ab <- rowadd(Ab,1,2,-15/40)
+Ab
+#from Ab,Both c1 and c2 are zero. So the only linear relationship between the two given row vectors is the trivial relationship. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.9/Ex2_1_9.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.9/Ex2_1_9.R
new file mode 100644
index 00000000..77f1a7b4
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX1.9/Ex2_1_9.R
@@ -0,0 +1,8 @@
+#Chapter 2.
+#Section II. Linear Independence
+#Example 1.9,page 104
+v1 <- c(3,4,5)
+v2 <- c(2,9,2)
+v3 <- c(4,18,4)
+(0*v1)+(2*v2)-1*v3
+#the set S = {v1,v2,v3} is linearly dependent because this is a relationship where not all of the scalars are zero \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.10/Ex2_3_10.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.10/Ex2_3_10.R
new file mode 100644
index 00000000..80b9f9b1
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.10/Ex2_3_10.R
@@ -0,0 +1,13 @@
+#Example 3.10,Section III. Basis and Dimension,page 131
+#package used pracma
+#install package using command: install.packages("pracma")
+
+#installation and loading library
+#install.packages("pracma")
+library("pracma")
+
+#program
+A <- matrix(c(1,2,1,3,6,3,1,3,1,6,16,6),ncol = 4,nrow = 3)
+#finding row reduced echelon form("using gauss-jordan reduction")
+rref(A)
+#Thus, for a reduced echelon form matrix we can find bases for the row and column spaces in essentially the same way, by taking the parts of the matrix, the rows or columns, containing the leading entries. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.2/Ex2_3_2.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.2/Ex2_3_2.R
new file mode 100644
index 00000000..be64a7ba
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.2/Ex2_3_2.R
@@ -0,0 +1,18 @@
+#Example 3.2,Section III. Basis and Dimension,page 127
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+A <- matrix(c(2,4,3,6),ncol = 2)
+#Rowspace(A) is this subspace of the space of two-component row vectors
+#{c1.(2 3) + c2.(4 6) | c1,c2 belongs to R}
+#simplifying A
+A <- rowadd(A,1,2,-2)
+A
+#From the simplified matrix,the second row vector is linearly dependent on the first and so we can simplify the above description to
+#{c.(2 3)|c belongs to R} \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.5/Ex2_3_5.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.5/Ex2_3_5.R
new file mode 100644
index 00000000..1344c076
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.5/Ex2_3_5.R
@@ -0,0 +1,20 @@
+#Example 3.5,Section III. Basis and Dimension,page 128
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+A <- matrix(c(1,1,2,3,4,0,1,1,5),ncol = 3)
+#From any matrix, we can produce a basis for the row space by
+#performing Gauss's Method and taking the nonzero rows of the resulting echelon form matrix
+#simplifying to echelon form
+A <- rowadd(A,1,2,-1)
+A <- rowadd(A,1,3,-2)
+A <- rowadd(A,2,3,6)
+A
+#on simplification:produces the basis h(1 3 1); (0 1 0); (0 0 3)i for the row space. This is a basis
+#for the row space of both the starting and ending matrices, since the two row spaces are equal. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.7/Ex2_3_7.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.7/Ex2_3_7.R
new file mode 100644
index 00000000..8044a89c
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.7/Ex2_3_7.R
@@ -0,0 +1,20 @@
+#Example 3.7,Section III. Basis and Dimension,page 129
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+A <- matrix(c(1,2,0,4,3,3,1,0,7,8,2,4),ncol = 3)
+#to get a basis for the column space, temporarily turn the columns into rows and reduce.
+A <- t(A)
+A <- rowadd(A,1,2,-3)
+A <- rowadd(A,1,3,-7)
+A <- rowadd(A,2,3,-2)
+#Now turn the rows back to columns
+A <- t(A)
+A
+#The result is a basis for the column space of the given matrix. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.9/Ex2_3_9.R b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.9/Ex2_3_9.R
new file mode 100644
index 00000000..5f009c37
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH2/EX3.9/Ex2_3_9.R
@@ -0,0 +1,18 @@
+#Example 3.5,Section III. Basis and Dimension,page 130
+#package used matlib v0.9.1
+#install package using command: install.packages("matlib")
+#Github reposiory of matlib :https://github.com/friendly/matlib
+
+#installation and loading library
+#install.packages("matlib")
+library("matlib")
+
+#program
+#To get a basis for the span of {x^2 + x^4,2x^2 + 3x^4,-x^2 - 3x^4 } in the space row4
+A <- matrix(c(0,0,0,0,0,0,1,2,-1,0,0,0,1,3,-3),ncol = 5,nrow = 3)
+#applying gauss method
+A <- rowadd(A,1,2,-2)
+A <- rowadd(A,1,3,1)
+A <- rowadd(A,2,3,2)
+A
+#we get the basis (x^2 + x^4,x^4) \ No newline at end of file