summaryrefslogtreecommitdiff
path: root/Linear_Algebra_by_Jim_Hefferon/CH3
diff options
context:
space:
mode:
Diffstat (limited to 'Linear_Algebra_by_Jim_Hefferon/CH3')
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX1.1/Ex3_1_1.R13
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX1.11/Ex3_1_11.R7
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX1.9/Ex3_1_9.R8
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX2.10/Ex3_2_10.R13
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX2.11/Ex3_2_11.R4
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX2.5/Ex3_2_5.R14
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX3.1.11/Ex3_3_1_11.R11
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.1/Ex3_4_1_1.R7
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.2/Ex3_4_1_2.R7
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.4/Ex3_4_2_4.R4
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.5/Ex3_4_2_5.R4
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.6/Ex3_4_2_6.R4
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.3.15/Ex3_4_3_15.R8
-rw-r--r--Linear_Algebra_by_Jim_Hefferon/CH3/EX4.4.9/Ex3_4_4_9.R15
14 files changed, 119 insertions, 0 deletions
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.1/Ex3_1_1.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.1/Ex3_1_1.R
new file mode 100644
index 00000000..fc57c156
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.1/Ex3_1_1.R
@@ -0,0 +1,13 @@
+#Example 1.1,Section I. page 166
+a <- c(1,2)
+a <-t(a) #a becomes row vector
+b <-t(a) #b becomes column vector
+c <-c(3,4)
+c <-t(c)
+d <-t(c)
+a+c
+b+d
+#these corresponding vectors add to corresponding totals
+5*a
+5*b
+#correspondence respecting scalar multiplication
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.11/Ex3_1_11.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.11/Ex3_1_11.R
new file mode 100644
index 00000000..7293511e
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.11/Ex3_1_11.R
@@ -0,0 +1,7 @@
+#Example 1.11,Section II. page 186
+#given map: h(1,0)=(-1,1) and h(0,1)=(-4,4)
+#h(3,-2)=h(3*(1,0)-2*(0,1))=3*h(1,0)-2*h(0,1)
+a <- c(-1,1) # h(1,0)
+b <- c(-4,4) # h(0,1)
+3*a-2*b
+#the value of h on this argument is a direct consequence of the value of h on the basis vectors. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.9/Ex3_1_9.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.9/Ex3_1_9.R
new file mode 100644
index 00000000..85fb511c
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX1.9/Ex3_1_9.R
@@ -0,0 +1,8 @@
+#Example 1.9,Section I. page 170
+#space P5 of polynomials of degree 5 or less and the map f that sends a polynomial p(x) to p(x - 1).
+#under this map x^2 ->(x-1)^2 = x^2-2x+1 and x^3+2x -> (x-1)^3+2(x-1) = x^3-3x^2+5x-3.
+curve(x^2,from = -1000,to=1000)
+curve((x-1)^2,from = -1000,to=1000)
+curve(x^3,from = -1000,to=1000)
+curve((x-1)^3,from = -1000,to=1000)
+#from these plots we can say that this map is an automorphism of this space. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.10/Ex3_2_10.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.10/Ex3_2_10.R
new file mode 100644
index 00000000..7919e0e4
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.10/Ex3_2_10.R
@@ -0,0 +1,13 @@
+#Example2.10,section III:Computing linear maps,chapter3,page 219
+#package used pracma
+#install package using command: install.packages("pracma")
+
+#installation and loading library
+#install.packages("pracma")
+library("pracma")
+
+#program
+A <- matrix(c(1,0,2,3),ncol = 2)
+Rank(A)
+#Any map from R^2 to P1 represented with respect to any pair of bases by the above matrix;
+#is nonsingular because this matrix has rank two. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.11/Ex3_2_11.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.11/Ex3_2_11.R
new file mode 100644
index 00000000..513a692e
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.11/Ex3_2_11.R
@@ -0,0 +1,4 @@
+#Example2.11,section III:Computing linear maps,chapter3,page 220
+A <- matrix(c(1,3,2,6),ncol=2)
+det(A)
+#map g: V -> W represented by above matrix is singular because this matrix is singular. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.5/Ex3_2_5.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.5/Ex3_2_5.R
new file mode 100644
index 00000000..dd7fe300
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX2.5/Ex3_2_5.R
@@ -0,0 +1,14 @@
+#Example2.5,section III:Computing linear maps,chapter3,page 218
+#package used pracma
+#install package using command: install.packages("pracma")
+
+#installation and loading library
+#install.packages("pracma")
+library("pracma")
+
+#program
+A <- matrix(c(1,1,0,0,2,2,0,0,2,1,3,2),ncol = 3)
+Rank(A)
+#Any map represented by above matrix must have three-dimensional domain and a four-dimensional codomain.
+#Since the rank of this matrix is found to be 2 by above code;
+#Any map represented by this matrix has a two-dimensional range space.
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX3.1.11/Ex3_3_1_11.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX3.1.11/Ex3_3_1_11.R
new file mode 100644
index 00000000..2f98aaf6
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX3.1.11/Ex3_3_1_11.R
@@ -0,0 +1,11 @@
+#Example1.11,section III:Computing linear maps,chapter3,page 211
+a <- matrix(c(1,2,0,0,-1,3),ncol=3)
+b <- c(2,-1,1)
+a %*% b
+#the above result can also be obtained by the method
+x <- matrix(c(1,2),ncol = 1)
+y <- matrix(c(0,0),ncol = 1)
+z <- matrix(c(-1,3),ncol = 1)
+#splitting the matrix a into component columns and now multiplying
+2*x-1*y+1*z
+#we see that both methods are equal. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.1/Ex3_4_1_1.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.1/Ex3_4_1_1.R
new file mode 100644
index 00000000..c59f039a
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.1/Ex3_4_1_1.R
@@ -0,0 +1,7 @@
+#Example1.1,section IV:Matrix Operations,chapter3,page 224
+#Let f : V -> W be a linear function represented with respect to some bases by this matrix.
+f <- matrix(c(1,1,0,1),ncol = 2)
+#find the map that is the scalar multiple 5f: V -> W.
+5*f
+#Changing from the map f to the map 5f has the effect on the representation of the output vector of multiplying each entry by 5.
+#Therefore, going from the matrix representing f to the one representing 5f means multiplying all the matrix entries by 5. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.2/Ex3_4_1_2.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.2/Ex3_4_1_2.R
new file mode 100644
index 00000000..2d290db6
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.1.2/Ex3_4_1_2.R
@@ -0,0 +1,7 @@
+#Example1.2,section IV:Matrix Operations,chapter3,page 225
+f <- matrix(c(1,2,3,0),ncol = 2)
+g <- matrix(c(-2,2,-1,4),ncol = 2)
+#two linear maps with the same domain and codomain f; g: R^2 -> R^2 are represented with respect to bases B and D by these matrices.
+#find effect of f + g on the map
+f+g
+#if f does v -> u and g does v -> w then f + g is the function whose action is v -> u + w. \ No newline at end of file
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.4/Ex3_4_2_4.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.4/Ex3_4_2_4.R
new file mode 100644
index 00000000..f0ffa844
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.4/Ex3_4_2_4.R
@@ -0,0 +1,4 @@
+#Example2.4,section IV:Matrix Operations,chapter3,page 229
+A <- matrix(c(2,4,8,0,6,2),ncol = 2)
+B <- matrix(c(1,5,3,7),ncol = 2)
+A %*% B
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.5/Ex3_4_2_5.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.5/Ex3_4_2_5.R
new file mode 100644
index 00000000..50f9767e
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.5/Ex3_4_2_5.R
@@ -0,0 +1,4 @@
+#Example2.5,section IV:Matrix Operations,chapter3,page 229
+A <- matrix(c(1,3,2,4),ncol = 2)
+B <- matrix(c(-1,2,0,-2),ncol=2)
+A %*% B
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.6/Ex3_4_2_6.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.6/Ex3_4_2_6.R
new file mode 100644
index 00000000..643cb0f1
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.2.6/Ex3_4_2_6.R
@@ -0,0 +1,4 @@
+#Example2.6,section IV:Matrix Operations,chapter3,page 230
+A <- matrix(c(1,0,1,1,1,0),ncol=2)
+B <- matrix(c(4,5,6,7,8,9,2,3),ncol = 4)
+A %*% B
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.3.15/Ex3_4_3_15.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.3.15/Ex3_4_3_15.R
new file mode 100644
index 00000000..c615c719
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.3.15/Ex3_4_3_15.R
@@ -0,0 +1,8 @@
+#Example3.15,section IV.3:Mechanics of Matrix Multiplication,chapter3,page 241
+#A permutation matrix is square and is all 0's except for a single 1 in each row and column.
+A <- matrix(c(0,1,0,0,0,1,1,0,0),ncol = 3) #permutation matrix
+B <- matrix(c(1,4,7,2,5,8,3,6,9),ncol = 3)
+#From the left these matrices permute rows.
+A %*% B
+#From the right they permute columns.
+B %*% A
diff --git a/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.4.9/Ex3_4_4_9.R b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.4.9/Ex3_4_4_9.R
new file mode 100644
index 00000000..17781554
--- /dev/null
+++ b/Linear_Algebra_by_Jim_Hefferon/CH3/EX4.4.9/Ex3_4_4_9.R
@@ -0,0 +1,15 @@
+#Example4.9,section IV.4:Inverses,chapter3,page 251
+#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
+# Augmented matrix
+A <- matrix(c(0,1,1,3,0,-1,-1,1,0),ncol = 3)
+B <- matrix(c(1,0,0,0,1,0,0,0,1),ncol = 3)
+AB <- cbind(A,B)
+echelon(A,B)