Using RStudio, Create an R-Script:
(1) You will generate a numeric matrix of size 21 by 21 and will name it tmp. To do so, draw 21×21 = 441 random observations from the standard normal distribution. Before doing so, set the seed for the random number generator to 37. See help for set.seed().
(2) Change the diagonal elements of tmp to 1s.
(3) Calculate condition number of tmp. See help for cond().
(4) Calculate the inverse of tmp. See help for solve().
(5) Calculate the trace of tmp.
(6) Sort tmp across rows.
(7) Delete the last row and last column from tmp and name the submatrix as tmp again.
(8) Reshape tmp as 40 by 10 matrix and name it as tmp1.
(9) Repeat tmp1 four times to generate 40 by 40 array, and name it as tmp2.
(10) Calculate condition number of tmp2.
(11) Calculate the inverse of tmp2.
(12) Change all nonpositive (<= 0) elements of tmp2 to 0.5.
(13) Set the first row and first column element of tmp2 to its negative value.
(14) Now take the natural log of tmp2 and name it as tmp3.
(15) Find the indices for NaN values in tmp3.
Attempting first 4 questions in the list
set.seed(37)
tmp = matrix( rnorm(21) , 21 , 21)
for ( i in 1:21) {
tmp[i,i] = 1
}
val = cond(tmp)
solve(tmp)
Using RStudio, Create an R-Script: (1) You will generate a numeric matrix of size 21 by...
Using RStudio, Create an R-Script: (1) You will generate a numeric matrix of size 21 by 21 and will name it tmp. To do so, draw 21×21 = 441 random observations from the standard normal distribution. Before doing so, set the seed for the random number generator to 37. See help for set.seed(). (2) Change the diagonal elements of tmp to 1s. (3) Calculate condition number of tmp. See help for cond(). (4) Calculate the inverse of tmp. See help...
C# 1. Given two lengths between 0 and 9, create an rowLength by colLength matrix with each element representing its column and row value, starting from 1. So the element at the first column and the first row will be 11. If either length is out of the range, simply return a null. For exmaple, if colLength = 5 and rowLength = 4, you will see: 11 12 13 14 15 21 22 23 24 25 31 32 33 34...