A <- latexMatrix(symbol="a", nrow=2, ncol=2)
B <- latexMatrix(symbol="b", nrow=2, ncol=2)
A
B
A + B
A - B
"a" * A
C <- latexMatrix(symbol="c", nrow=2, ncol=3)
A %*% C
t(C)
determinant(A)
cat(solve(A, simplify=TRUE))
D <- latexMatrix(matrix(letters[1:4], 2, 2))
D
as.numeric(D, locals=list(a=1, b=2, c=3, d=4))
X <- latexMatrix(matrix(c(3, 2, 0, 1, 1, 1, 2,-2, 1), 3, 3))
X
as.numeric(X)
MASS::fractions(as.numeric(inverse(X)))
(d <- determinant(X))
eval(parse(text=(gsub("\\\\cdot", "*", d))))
X <- latexMatrix(matrix(1:6, 2, 3), matrix="bmatrix")
I3 <- latexMatrix(diag(3))
I3 %X% X
kronecker(I3, X, sparse=TRUE)
(E <- latexMatrix(diag(1:3)))
# equivalent:
X %*% E
matmult(X, E)
matmult(X, E, simplify=FALSE, as.numeric=FALSE)
# equivalent:
X %*% E %*% E
matmult(X, E, E)
# equivalent:
E^-1
inverse(E)
solve(E)
solve(E, as.numeric=FALSE) # details
# equivalent
E^3
matpower(E, 3)
matpower(E, 3, as.numeric=FALSE)
Run the code above in your browser using DataLab