load("diag.mc")$ a:matrix([2,0,0,0,0,0,0,0], [1,2,0,0,0,0,0,0], [-4,1,2,0,0,0,0,0], [2,0,0,2,0,0,0,0], [-7,2,0,0,2,0,0,0], [9,0,-2,0,1,2,0,0], [-34,7,1,-2,-1,1,2,0], [145,-17,-16,3,9,-2,0,3])$ a1:matrix([2,1,0,0,0,0], [-1,4,0,0,0,0], [-1,1,2,1,0,0], [-1,1,-1,4,0,0], [-1,1,-1,1,3,0], [-1,1,-1,1,1,2])$ a2:matrix([0,1,0], [0,0,1], [1,-3,3])$ a3:matrix([0,1,2], [0,0,0], [0,0,0])$ a4:matrix([3,1,0,0], [-4,-1,0,0], [7,1,2,1], [-17,-6,-1,0])$ a5:matrix([2,1,2,0], [-2,2,1,2], [-2,-1,-1,1], [3,1,2,-1])$ b1:matrix([0,0,1,1,1], [0,0,0,1,1], [0,0,0,0,1], [0,0,0,0,0], [0,0,0,0,0])$ b2:matrix([0,1,0], [0,0,1], [-1,-3,-3])$ /* jordan form */ a; jordan(a); dispJordan(%); mm:ModeMatrix(a,jordan(a)); (mm^^-1).a.mm; a1; jordan(a1); dispJordan(%); mm:ModeMatrix(a1,jordan(a1)); (mm^^-1).a1.mm; a2; jordan(a2); dispJordan(%); mm:ModeMatrix(a2,jordan(a2)); (mm^^-1).a2.mm; a3; jordan(a3); dispJordan(%); mm:ModeMatrix(a3,jordan(a3)); (mm^^-1).a3.mm; a4; jordan(a4); dispJordan(%); mm:ModeMatrix(a4,jordan(a4)); (mm^^-1).a4.mm; a5; jordan(a5); dispJordan(%); mm:ModeMatrix(a5,jordan(a5)); (mm^^-1).a5.mm; /*diag ,JF example */ minimalPoly(jordan(a)); JF(3,5); diag([JF(1,5),2*t,JF(3,2)]); /*matrix function*/ mat_function(exp,t*b2); ratsimp(%); mat_function(exp,t*b1); minimalPoly(jordan(b1)); ident(5)+t*b1+1/2*(t^2)*b1^^2; mat_function(exp,%i*t*b1); mat_function(cos,t*b1)+%i*mat_function(sin,t*b1); fpow(x):=block([k],declare(k,integer),x^k); mat_function(fpow,a1); /* please try mat_function(fpow,a)and ratsimp */