summaryrefslogtreecommitdiff
path: root/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2
diff options
context:
space:
mode:
authorPrashant S2019-10-04 12:27:32 +0530
committerGitHub2019-10-04 12:27:32 +0530
commitac2986488a9731cff5cbb517d8f0ef98e2561d64 (patch)
tree7bb3f64824627ef179d5f341266a664fd0b69011 /Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2
parentcbb2770fb2f88246175add29623103a56ba338b8 (diff)
parentb3f3a8ecd454359a2e992161844f2fb599f8238a (diff)
downloadR_TBC_Uploads-master.tar.gz
R_TBC_Uploads-master.tar.bz2
R_TBC_Uploads-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Added R TBC
Diffstat (limited to 'Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2')
-rw-r--r--Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r16
1 files changed, 16 insertions, 0 deletions
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r
new file mode 100644
index 00000000..09d7f4c4
--- /dev/null
+++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH6/EX6.2.2/Ex6.2_2.r
@@ -0,0 +1,16 @@
+# Example : 2 Chapter : 6.2 Page No: 300
+# The diagonal matrix of any matrix contains the eigen values in its main diagonal
+A<-matrix(c(0.8,0.2,0.3,0.7),ncol=2)
+lambda<-eigen(A)$values
+print(lambda)
+S<-eigen(A)$vectors #Normlised eigen vectors, Answer can also be validated with normalised eigen vectors
+#to get eigen vector matrix in text book
+S[,1]<-S[,1]*(0.6/S[1,1])
+S[,2]<-S[,2]*(1/S[1,2])
+S1<-solve(S)
+Diag_matrix<-diag(2)*lambda
+print("S*diag_matrix(A)*S-1 is A")
+print(S%*%Diag_matrix%*%S1)
+#The answer may slightly vary due to rounding off values
+#The answers provided in the text book may vary because of the computation process
+#Both answers are correct , here it is taken -Ax+b=0 , In the text book it is considered as Ax-b=0 \ No newline at end of file