Hi,I have a doubt regarding true matrix multiplication.matrixA as per the video - 45,49,47,22,21,14,12,13,14 subdata <- captaincy[1:3,c("played","won","lost")] > matrixA <- as.matrix(subdata)> print(matrixA) played won lost [1] 45 22 12 [2] 49 21 13 [3] 47 14 14 matrixB - my own values <- c(1,0,1,1,0,1,0,1,0)> matrixB <- matrix(values,nrow=3,ncol=3,byrow=FALSE) print(matrixB) [,1] [,2] [,3] [1,] 1 1 0[2,] 0 0 1 [3,] 1 1 0 true matric multiplication - matrixA %*% matrixB - THE RESULTS I AM GETTING ARE - [,1] [,2] [,3] 1 57 57 22 2 62 62 21 3 61 61 14 THE RESULTS SHOWN IN THE VIDEO - (with matrixB values of his own <-c(1,0,0,0,1,0,0,0,1)) [,1] [,2] [,3] 1 45 22 12 2 49 21 13 3 47 14 14 Could you please explain where am I going wrong ? Thanks!
print(matrixB)Error in print(matrixB) : object 'matrixB' not foundTHE ABOVE LINE SHOWN BY R STUDIO WHILE MAKING MATRIX.
matrixB=matrix(nrow=4,ncol=2,data = c(9,10,11,12,13,14,15,16))print(matrixB) [,1] [,2][1,] 9 13[2,] 10 14[3,] 11 15[4,] 12 16Sir i have doubt if i type the above coding i am getting the above solution but the assignment was to create two vectors so i have the coding as x=c(9,10,11,12)y=c(13,14,15,16)matrixB=matrix(nrow=4,ncol=2,x,y) print(matrixB) [,1] [,2][1,] 9 10[2,] 11 12[3,] 9 10[4,] 11 12i am getting like above solution , pls correct me sir
Is an assignment, for submission or practice? if it is for submission so how to submit?
what is the difference between matrixA*matrixBmatrixA%*%matrixB
what operation exactly perform ?
Check for the assignment sirx=c(9,10,11,12) y=c(13,14,15,16) matrixA=matrix(x,y,nrow = 4,ncol = 2) print(matrixA) [,1] [,2] [1,] 9 10 [2,] 11 12 [3,] 9 10 [4,] 11 12
Sir in the current vidoe "subdata" you used small letter for data but in the previous lecture indexing and slicing for the subset you used " "subData". Is both correct sir
When should print command be used for displaying output and when is it not required? In this video, the author is using print(matrixB) command to obtain matrix output in Console window.However, in assignment solution, output is being obtained even without print command.How is it so?
I have encountered a problem in creating 3 x 3 identity matrix. #create a matrix of 3 rows and 3 columns using the following codevalues <- c(1,0,0,0,1,0,0,0,1)matrixB <- as.matrix(values, nrow = 3, ncol = 3, byrow = TRUE) print(matrixB)But output i am getting isprint(matrixB) [,1] [1,] 1 [2,] 0 [3,] 0 [4,] 0 [5,] 1 [6,] 0 [7,] 0 [8,] 0 [9,] 1Please tell me the solution..Thanks.
Is there an option to create matrix directly without creating a vector?
19175 visits
Outline:Data required in a matrix format Convert a data frame into a matrix Create a matrix with known data Add two matrices Subtract two matrices Multiply two matrices elementwise Perform true matrix multiplication Calculate the transpose of a matrix Calculate the determinant of a matrix
Data required in a matrix format Convert a data frame into a matrix Create a matrix with known data Add two matrices Subtract two matrices Multiply two matrices elementwise Perform true matrix multiplication Calculate the transpose of a matrix Calculate the determinant of a matrix
Show video info
Pre-requisite