`> `
**with(linalg):**

Warning, the protected names norm and trace have been redefined and unprotected

`> `
**A:=matrix([[0, 0, 0, -1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 2, 0, 0, 0, 0], [1, 0, 0, 2, 0, 0, 0], [0, 0, -1, 0, 2, 0, 0], [-3, 2, 0, -1, 1, 2, 1], [0, -1, 0, 0, 0, 0, 1]]);**

`> `
**#The Jordan form of this matrix can be found using#**

`> `
**jordan(A);**

`> `
**#Note that Maple is always irritating. The blocks are not in the natural order.... We will now explain how to find the Jordan form. **

`> `
**#We start by calculating the minimal polynomial. There are several methods we discussed that give that but here we will just use**

`> `
**factor(charpoly(A,t));factor(minpoly(A,t));**

`> `
**#Note that this alone doesn't determine the Jordan form. There could be either a 2,2 or a 2,1,1 configuration of Jordan blocks for the eigenvalue 1. We know that R^7 = W1 directsum W2 where W1 is the kernel of (A-1)^2 and W2 is the kernel of (A-2)^3. Note that to calculate the kernels of U1:=A-1 and its powers on W1 is like calculating the same thing on the total space and that's what we do first: **

`> `
**B:=kernel(A-1);**

`> `
**Ba:=kernel((A-1)^2);**

`> `
**#This is already W1 and we need not go further. Note that we now know that the configuration of the Jordan blocks is 2,2. Now for W2:**

`> `
**kernel(A-2);**

`> `
**kernel((A-2)^2);**

`> `
**kernel((A-2)^3);**

`> `
**#This is already W2 and we need not go further.**

`> `
**#We want to find a good basis for the nilpotent operator U1 defined as A-1 restricted to W1. The first step is to find a complement to kernel(A-1) inside kernel((A-1)^2). We called that complement C2. Note that Steinitz substitution lemma guarantees that if we take the basis B to kernel(A-1) given above then there are two vectors among the basis of kernel((A-1)^2) given above that will complete B to a basis of kernel((A-1)^2). We guess that these could be Ba[1] and Ba[2]. We check the rank of**

`> `
**M:=matrix([B[1], B[2], Ba[1], Ba[2]]);rank(M);**

`> `
**#So our guess is true. Now forget about B and just remember the vectors Ba[1], Ba[2]**

`> `
**v1 := vector([0, 1, 0, 0, 0, -1, 0]); v2 := vector([0, 0, 0, 1, 0, -1, 0]);**

`> `
**#The next step is to apply (A-1) to these vectors**

`> `
**v3:=multiply(A-1,v1); v4:=multiply(A-1, v2);**

`> `
**#Note that v3 and v4 are a basis to kernel of A-1 and we are done with W1. Now for W2:**

`> `
**Bb:=kernel(A-2);**

`> `
**Bc:=kernel((A-2)^2);**

`> `
**Bd:=kernel((A-2)^3);**

`> `
**#We need to decompose kernel(A-2)^3 as kernel((A-2)^2) directsum C3. Clearly we can let C3 be the span of Bd[2]. So let**

`> `
**v5:=Bd[2];**

`> `
**#We calculate now**

`> `
**v6:=multiply(A-2, v5);**

`> `
**#In principle we are looking for a decomposition kernel(A-2)^2 = kernel(A-2) directsum C2 where C2 contains v6. Dimension considerations show that C2 is just the span of v6. Let **

`> `
**v7:=multiply(A-2, v6);**

`> `
**#I claim that in the basis v3, v1, v4, v2, v7, v6, v5 the matrix has the form**

`> `
**matrix([[1, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 2, 1, 0], [0, 0, 0, 0, 0, 2, 1], [0, 0, 0, 0, 0, 0, 2]]);**

`> `
**#Let us check that. Let **

`> `
**M:=transpose(matrix([v3, v1, v4, v2, v7, v6, v5]));**

`> `
**multiply(inverse(M), A, M);**

`> `