(* Erfinden eines nilpotenten Beispiel fuer Jordan *)
EE := IdentityMatrix [8]

DD = {EE[[2]],EE[[3]], 0*EE[[1]],EE[[5]],0*EE[[1]],EE[[7]],0*EE[[5]],0 * EE[[8]]}

MatrixForm [DD]

B1 = {{1,2,3,-2,1,3,3,3},{0,1,2,-3,1,2,3,0},{0,0,1,2,3,0,0,0},{0,0,0,1,3,4,5,2},{0,0,0,0,-1,3,4,5},{0,0,0,0,0,1,-2,4},
{0,0,0,0,0,0,1,-8},{0,0,0,0,0,0,0,1}}

B2 = {EE[[8]], EE[[5]], EE[[3]], EE[[1]], EE[[2]], EE[[4]],
EE[[6]],EE[[7]]}

B3 = B2.B1.Inverse[B2]

(* Wir verwenden die Spalten von B3 als eine moegliche Basis *)

A = B3. DD .Inverse[B3]

(* Analysieren der Matrix A *)

MatrixForm [A]

A.A.A

(* Kern von A^2 *)
NA2 = NullSpace [A.A]

NA1 = NullSpace [A]

x31 = {0,0,0,0,0,0,0,1}

zuErweiterndeFolge = Join [NA1, {A.x31}]

FindBasisModulo [BU_,BV_] :=
Module[{coordBU,coordBUred,newBasis, i,j,missingCoordinates,BV1},
BV1 =Transpose [BV];
coordBU = Map[Function[x,LinearSolve[BV1, x]],BU];
coordBUred = RowReduce [coordBU];
missingCoordinates = Range [Length [BV]] ;
i = 1;
While[i ≤ MatrixRank [coordBUred],
j=1;
While [coordBUred[[i]][[j]] == 0,
j = j+1];
missingCoordinates = Complement[missingCoordinates, {j}];
i = i+1;
];
Map [Function[j,BV[[j]]],missingCoordinates]]

erweiterndeVektoren =FindBasisModulo [zuErweiterndeFolge, NA2]

x21 = erweiterndeVektoren [[1]]

x22 = erweiterndeVektoren [[2]]

NA1 =NullSpace [A]

BasisNA1 = {A.A.x31, A.x21,A.x22,NA1[[1]]}

MatrixRank [BasisNA1]

x11 = NA1 [[1]]

BB = {A.A.x31,A.x31,x31,A.x21,x21,A.x22,x22, x11}

Bwelle = Transpose [BB]

J = Inverse [Bwelle].A.Bwelle

MatrixForm [J]

TeXForm[MatrixForm[A]]