วันพฤหัสบดีที่ 2 กุมภาพันธ์ พ.ศ. 2560

Week2 Matrix Notation

Matrix Notation Exercises

Matrix Notation Exercises #1

1/1 point (graded)
In R we have vectors and matrices. You can create your own vectors with the function c.
c(1,5,3,4)
They are also the output of many functions such as
rnorm(10)
You can turn vectors into matrices using functions such as rbindcbind or matrix.
Create the matrix from the vector 1:1000 like this:
X = matrix(1:1000,100,10)
  correct 
225
225 
Explanation
X[25,3]
 
You have used 1 of 5 attempts
Correct (1/1 point)

Matrix Notation Exercises #2

1/1 point (graded)
Using the function cbind, create a 10 x 5 matrix with first column x=1:10. Then columns 2*x, 3*x, 4*x and 5*x in columns 2 through 5.
  correct 
105
 
Explanation
x = 1:10
X=cbind(x, 2*x, 3*x, 4*x, 5*x)
sum(X[7,])
 
You have used 1 of 5 attempts
Correct (1/1 point)

Matrix Notation Exercises #3

1/1 point (graded)
Which of the following creates a matrix with multiples of 3 in the third column?
Explanation
You can make each of the matrices in R and examine them visually. Or you can check whether the third column has all multiples of 3 with all(X[,3]%%3==0). Note that the fourth choice does not even have a 3rd column.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น