> with(linalg); Matrix Operations > A := matrix([[2, 7, 1], [4, -5, 8]]); > B := matrix([[3, 0, 4], [-2, 5, 1]]); > C := matrix([[6, 5], [-2, 1], [3, 4]]); > E := matrix(2, 2); > A+B; A + B > evalm(A+B); > B[1, 2]; 0 > evalm(A+C); Error, (in linalg:-matadd) matrix dimensions incompatible > evalm(`.`(A, C)); Matrix Multiplication > evalm(multiply(A, C)); > evalm(`.`(C, A)); > A1 := matrix([[1, 2], [2, 3], [0, 4], [-1, -2]]); > B1 := matrix([[1, 2, 3], [4, 5, 6]]); > evalm(`.`(A1, B1)); > multiply(A1, B1); > evalm(`.`(B1, A1)); Error, (in linalg:-multiply) non matching dimensions for vector/matrix product > A2 := matrix([[1, 2], [3, 4]]); > B2 := matrix([[5, -1], [3, -2]]); > evalm(`.`(A2, B2)); > evalm(`.`(B2, A2)); > evalm(2*B2); The Identity Matrix > array(1 .. 5, 1 .. 5, identity); > diag(1, 1, 1, 1, 1); > I2 := diag(1, 1); > evalm(`.`(I2, B2)); > evalm(B2); > evalm(`.`(B2, I2)); Transpose of a Matrix > A := matrix([[2, 0, 3], [1, 4, 5]]); > transpose(A); Row Reduction and Linear Systems One solution: > M1 := matrix([[2, 1, -3, 0], [6, 3, -8, 0], [2, -1, 5, -4]]); > rref(M1); > gaussjord(M1); > help("rref"); > M2 := matrix([[2, 6, -1, 8], [3, 9, 0, 15], [-2, -5, 6, 1]]); > rref(M2); No solutions (inconsistent): > M3 := matrix([[1, 1, 1, 1], [4, 3, 5, 7], [2, 1, 3, 6]]); > rref(M3); Infinitely many solutions: > M4 := matrix([[1, 2, -3, 1, 2], [3, 6, -8, -2, 1]]); > rref(M4); Elementary Matrices > E := matrix([[0, 0, 1], [0, 1, 0], [1, 0, 0]]); > A := matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); > evalm(`.`(E, A)); > B := matrix([[-7, 5], [4, 1], [0, 26]]); > evalm(`.`(E, B)); >