> with(linalg): #Finding the Jordan Form#
> A:=matrix([[12, 12, 0], [-3, 3, 9], [1, 1, 3]]);
> factor(minpoly(A,t));#This tells us that there is one Jordan block and its of size 3#
> kernel(A-6);
> kernel((A-6)^2);
> #We see that e.g. [0,1,0] is killed by (A-6)^3 but not (A-6)^2, so is suitable for generating a basis#
> evalm(multiply(A-6,[0,1,0]));
> evalm(multiply(A-6,[12,-3,1]));
> #The basis is [36,-18,6],[12, -3, 1],[0,1,0]#
> M:=transpose(matrix([[36,-18,6],[12, -3, 1],[0,1,0]]));
> multiply(inverse(M), A, M);
>