# Example 1 with(linalg): A:=matrix([[1,2,3],[2,-1,1],[3,0,-1]]); b:=vector([9,8,3]); print("(1)"); inverse(A); print("(2)"); C:=augment(A,b); print("(3)"); R:=rref(C); print("(4)"); X:=col(R,4); print("(5)"); evalm(A^3); print("(6)"); transpose(A); print("(7)"); evalm(A-3*(A^2)); print("(8)"); X:=linsolve(A,b); X:=evalm(inverse(A) &* b); # Example 2 with(linalg): A:=matrix([[ 1, 1, 1, 2, 6], [ 2, 3,-2, 1,-3], [ 3, 5,-5, 1,-8], [ 4, 3, 8, 2, 3]]); print("(1)"); C:=rref(A); # leading ones in columns 1,2,4 BASIScolumnspace=col(A,1),col(A,2),col(A,4); print("(2)"); F:=rref(transpose(A)); # leading ones in columns 1,2,3 BASISrowspace=row(A,1),row(A,2),row(A,3); print("(3)"); nullspace(A); linsolve(A,vector([0,0,0,0])); print("(4)"); RANK=rank(A); NULLITY=coldim(A)-rank(A); print("(5)"); DIMnullspace=coldim(A)-rank(A); DIMrowspace=rank(A); DIMcolumnspace=rank(A); # Example 3 with(linalg): A:=matrix([[ 1, 1, 1, 2, 6], [ 2, 3,-2, 1,-3], [ 3, 5,-5, 1,-8], [ 4, 3, 8, 2, 3]]); v1:=col(A,1); v2:=col(A,2); v3:=col(A,4); w1:=vector([1, 0, 0, -3]); w2:=vector([0, 1, 0, 17]); w3:=vector([0, 0, 1, -9]); F:=augment(v1,v2,v3); G:=augment(w1,w2,w3); H:=augment(F,G); rank(F); rank(G); rank(H); B:=rref(transpose(A)); # pivot cols 1,2,3 w1:=row(B,1); w2:=row(B,2); w3:=row(B,3); # Example 4 with(linalg): A:=matrix([[1,2,3],[2,-1,1],[3,0,0]]); linsolve(evalm(A-(-3)*diag(1,1,1)),vector([0,0,0])); # ans: t_1*vector([-2,1,2]) # Basis == partial on t_1 == vector([-2,1,2])