Branches of mechanical engineering: Matrix Vol. Ii Exercises + Solutions - R




[For this exercise, starting fourth dimension write downward your answer, without using R. Then, depository fiscal establishment jibe your reply using R.]
Answers to the exercises are available here.
Exercise 1
If
M=matrix(c(1:10),nrow=5,ncol=2,
dimnames=list(c('a','b','c','d','e'),c('A','B')))
What is the value of: M
Exercise 2
Consider the matrix M,
What is the value of:
M[1,]
M[,1]
M[3,2]
M['e','A']
Exercise 3
Consider the matrix N
N=matrix(c(1:9),nrow=3,ncol=3,
dimnames=list(c('a','b','c'),c('A','B','C')))

What is the value of: diag(N)
Exercise 4
What is the value of: diag(4,3,3)
Is matrix ?
Exercise 5
If M=matrix(c(1:9),3,3,byrow=T,
dimnames=list(c('a','b','c'),c('d','e','f')))

What is the value of:
rownames(M)
colnames(M)
Exercise 6
What is the value of:
upper.tri(M)
lower.tri(M)
lower.tri(M,diag=T)
Exercise 7
Consider 2 matrix,
M,N
M=matrix(c(1:9),3,3,byrow=T)
N=matrix(c(1:9),3,3)
What is the value of:
M*N
Exercise 8
Consider 2 matrix,
M,N
M=matrix(c(1:9),3,3,byrow=T)
N=matrix(c(1:9),3,3)
What is the value of:
M%*%N
Exercise 9
Consider 2 matrix,
M,N
M=matrix(c(1:9),3,3,byrow=T)
N=matrix(c(1:9),3,3)
What is the value of:
(M+N)^2
Exercise 10
Consider 2 matrix,
M,N
M=matrix(c(1:9),3,3,byrow=T)
N=matrix(c(1:9),3,3)
What is the value of:
M/N
Want to do matrices a chip more? We convey to a greater extent than usage sets on this topic here.
________________________________________________
Below are the solutions to these exercises on regular sequences.
#################### #                  # #    Exercise 1    # #                  # ####################  #If  M=matrix(c(1:10),nrow=5,ncol=2,dimnames=list(c('a','b','c','d','e'),c('A','B')))  #What is the value of:    M 
##   H5N1  B ## a 1  half-dozen ## b 2  seven ## c three  8 ## d four  nine ## e v 10 
#################### #                  # #    Exercise 2    # #                  # ####################  #Consider the matrix M,  #What is the value of:  M[1,] 
## H5N1 B  ## 1 half-dozen 
M[,1] 
## a b c d e  ## 1 2 three four v 
M[3,2] 
## [1] 8 
M['e','A'] 
## [1] v 
#################### #                  # #    Exercise three    # #                  # #################### #Consider the matrix N N=matrix(c(1:9),nrow=3,ncol=3,dimnames=list(c('a','b','c'),c('A','B','C')))  #What is the value of:  diag(N) 
## [1] 1 v nine 
#################### #                  # #    Exercise four    # #                  # #################### #What is the value of:   diag(4,3,3) 
##      [,1] [,2] [,3] ## [1,]    four    0    0 ## [2,]    0    four    0 ## [3,]    0    0    four 
#Is matrix ?   is.matrix(diag(4,3,3)) 
## [1] TRUE 
#################### #                  # #    Exercise v    # #                  # ####################  #If  M=matrix(c(1:9),3,3,byrow=T,dimnames=list(c('a','b','c'),c('d','e','f'))) #What is the value of: rownames(M) 
## [1] "a" "b" "c" 
colnames(M) 
## [1] "d" "e" "f" 
#################### #                  # #    Exercise half-dozen    # #                  # #################### #What is the value of: upper.tri(M) 
##       [,1]  [,2]  [,3] ## [1,] FALSE  TRUE  TRUE ## [2,] FALSE FALSE  TRUE ## [3,] FALSE FALSE FALSE 
lower.tri(M) 
##       [,1]  [,2]  [,3] ## [1,] FALSE FALSE FALSE ## [2,]  TRUE FALSE FALSE ## [3,]  TRUE  TRUE FALSE 
lower.tri(M,diag=T) 
##      [,1]  [,2]  [,3] ## [1,] TRUE FALSE FALSE ## [2,] TRUE  TRUE FALSE ## [3,] TRUE  TRUE  TRUE 
#################### #                  # #    Exercise seven    # #                  # #################### #Consider 2 matrix, M,N M=matrix(c(1:9),3,3,byrow=T) N=matrix(c(1:9),3,3) #What is the value of: M*N 
##      [,1] [,2] [,3] ## [1,]    1    8   21 ## [2,]    8   25   48 ## [3,]   21   48   81 
#################### #                  # #    Exercise 8    # #                  # #################### #Consider 2 matrix, M,N M=matrix(c(1:9),3,3,byrow=T) N=matrix(c(1:9),3,3) #What is the value of: M%*%N 
##      [,1] [,2] [,3] ## [1,]   xiv   32   l ## [2,]   32   77  122 ## [3,]   l  122  194 
#################### #                  # #    Exercise nine    # #                  # #################### #Consider 2 matrix,M,N  M=matrix(c(1:9),3,3,byrow=T) N=matrix(c(1:9),3,3)  #What is the value of: (M+N)^2 
##      [,1] [,2] [,3] ## [1,]    four   36  100 ## [2,]   36  100  196 ## [3,]  100  196  324 
#################### #                  # #    Exercise 10   # #                  # #################### #Consider 2 matrix,M,N  M=matrix(c(1:9),3,3,byrow=T) N=matrix(c(1:9),3,3)  #What is the value of: M/N 
##          [,1]     [,2]      [,3] ## [1,] 1.000000 0.500000 0.4285714 ## [2,] 2.000000 1.000000 0.7500000 ## [3,] 2.333333 1.333333 1.0000000

Source: 

http://www.r-exercises.com/2016/12/08/matrix-vol-2-exercises/
http://www.r-exercises.com/2016/12/08/matrix-vol-2-solutions/




Sumber http://engdashboard.blogspot.com/

Jangan sampai ketinggalan postingan-postingan terbaik dari Branches of mechanical engineering: Matrix Vol. Ii Exercises + Solutions - R. Berlangganan melalui email sekarang juga:

Bali Attractions

BACA JUGA LAINNYA:

Bali Attractions