diff options
Diffstat (limited to 'Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9')
3 files changed, 38 insertions, 0 deletions
diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.2/Ex9.2_2.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.2/Ex9.2_2.r new file mode 100644 index 00000000..df06d5b6 --- /dev/null +++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.2/Ex9.2_2.r @@ -0,0 +1,11 @@ +# Example : 2 Chapter : 9.2 Page No: 475 +# Norm of diagonal matrix +A<-matrix(c(2,0,0,3),ncol=2) +print("The norm of the diagonal matrix is its largest entry") +print(A[2,2]) +print("Largest eigen value and norm are equal for this matrix") +lambdamax<-eigen(A)$values[1] +print(lambdamax) +print("Eigen vectors of this matrix are") +ev<-round(eigen(A)$vectors) +print(ev) diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.3/Ex9.2_3.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.3/Ex9.2_3.r new file mode 100644 index 00000000..ef6c255b --- /dev/null +++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.2.3/Ex9.2_3.r @@ -0,0 +1,7 @@ +# Example : 3 Chapter : 9.2 Page No: 478 +# Condition number for positive definite matrix +A<-matrix(c(6,0,0,2),ncol=2) +print("Condition number for positive definite matrix is max.eigen value/min.eign value") +condition_number=eigen(A)$values[1]/eigen(A)$values[2] +print("Condition number for A") +print(condition_number)
\ No newline at end of file diff --git a/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.3.1/Ex9.3_1.r b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.3.1/Ex9.3_1.r new file mode 100644 index 00000000..f7c2cae7 --- /dev/null +++ b/Introduction_To_Linear_Algebra_by_Gilbert_Strang/CH9/EX9.3.1/Ex9.3_1.r @@ -0,0 +1,20 @@ +# Example : 1 Chapter : 9.3 Page No: 482
+# Powers of some matrices can be calculated easily with max eigen value
+B<-matrix(c(0.6,0.6,0.5,0.5),ncol=2)
+B1<-matrix(c(0.6,0,1.1,0.5),ncol=2)
+lambda<-eigen(B)$values
+lambda1<-eigen(B1)$values
+lmax<-lambda[1]
+l1max<-lambda1[1]
+print("Lambda max of B is")
+print(lmax)
+print("Lambda max of B1 is ")
+print(l1max)
+B2<-B%*%B
+print("B square is")
+print(B2)
+B2<-lmax*B
+print(B2)
+print("B1 square has 0.6*0.6 and 0.5*0.5 on its diagonal")
+B12<-B1%*%B1
+print(B12)
|