Rational Jordan matrix

### 15.2.4 Rational Jordan matrix

The rat_jordan command finds the rational Jordan form of a matrix.

- rat_jordan takes one mandatory and one optional argument:
  - A, a square matrix (preferably with exact coefficients).
  - Optionally, var, a variable name.
- rat_jordan(A) (in all modes but Maple) returns a sequence [P,J] of two matrices, where J is the rational Jordan matrix of A (the most reduced matrix in the field of the coefficients of A or the complexified field in complex mode) and

  J=P−1AP

  The coefficients of P and J belongs to the same field as the coefficients of A. If A is diagonalizable in the field of its coefficients, then the columns of P are the eigenvectors of A.

  rat_jordan(A) (in Maple mode) only returns the matrix J.

- rat_jordan(A ⟨,var ⟩) returns the matrix J, as above, and assigns the matrix P to the variable var.

#### Examples

Input not in Maple mode:

rat_jordan([[1,0,0],[1,2,-1],[0,0,1]])

⎡ ⎢ ⎢ ⎣ |
0 | 1 | 0
1 | 0 | 1
0 | 1 | 1
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
2 | 0 | 0
0 | 1 | 0
0 | 0 | 1
| ⎤ ⎥ ⎥ ⎦

rat_jordan([[1,0,0],[1,2,-1],[0,0,1]],P)

⎡ ⎢ ⎢ ⎣ |
2 | 0 | 0
0 | 1 | 0
0 | 0 | 1
| ⎤ ⎥ ⎥ ⎦

P

⎡ ⎢ ⎢ ⎣ |
0 | 1 | 0
1 | 0 | 1
0 | 1 | 1
| ⎤ ⎥ ⎥ ⎦

rat_jordan([[1,0,1],[0,2,-1],[1,-1,1]])

⎡ ⎢ ⎢ ⎣ |
1 | 1 | 2
0 | 0 | −1
0 | 1 | 2
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
0 | 0 | −1
1 | 0 | −3
0 | 1 | 4
| ⎤ ⎥ ⎥ ⎦

rat_jordan([[1,0,0],[0,1,1],[1,1,-1]])

⎡ ⎢ ⎢ ⎣ |
−1 | 0 | 0
1 | 1 | 1
0 | 0 | 1
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
1 | 0 | 0
0 | 0 | 2
0 | 1 | 0
| ⎤ ⎥ ⎥ ⎦

If A is symmetric and has eigenvalues with multiple orders, the matrix P returned by rat_jordan(A) will contain orthogonal eigenvectors (not always of norm equal to 1); that is, PTP will be a diagonal matrix where the diagonal is the square norm of the eigenvectors.

rat_jordan([[4,1,1],[1,4,1],[1,1,4]])

⎡ ⎢ ⎢ ⎣ |
1 | 2 | −1
1 | 0 | 2
1 | −2 | −1
| ⎤ ⎥ ⎥ ⎦
| , |
⎡ ⎢ ⎢ ⎣ |
6 | 0 | 0
0 | 3 | 0
0 | 0 | 3
| ⎤ ⎥ ⎥ ⎦