From b3f3a8ecd454359a2e992161844f2fb599f8238a Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Fri, 4 Oct 2019 12:24:07 +0530 Subject: Initial commit/added all books --- Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18/Ex5_2_18.R | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18/Ex5_2_18.R (limited to 'Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18') diff --git a/Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18/Ex5_2_18.R b/Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18/Ex5_2_18.R new file mode 100644 index 00000000..960e5899 --- /dev/null +++ b/Linear_Algebra_by_Jim_Hefferon/CH5/EX2.18/Ex5_2_18.R @@ -0,0 +1,20 @@ +#Example 2.18,chapter 5,scetion III.2,page 420 +#package used matlib v0.9.1 +#Github reposiory of matlib :https://github.com/friendly/matlib + +#installation and loading library +#install.packages("matlib") +library("matlib") +M <- matrix(c(0,1,-1,0,1,0,0,1,1,0,0,0,1,0,-1,0,0,-1,0,1,0,0,1,0,-1),ncol = 5) +#finding nilpotent index +A <- matrix(c(0),ncol = 5,nrow = 5) +count <- 1 +Y <- M +repeat{ + Y <- Y %*% M + if (all.equal(Y,A)== TRUE){ + print(count+1) + break() + } + count=count+1 +} -- cgit