How to compute the change of basis matrix that conjugate a matrix to its rational canonical form Let $A=\begin{pmatrix} 2&-2&14\\0&3&-7\\0&0&2\end{pmatrix}$, then its rational canonical form is $R=\begin{pmatrix}2&0&0\\0&0&-6\\0&1&5\end{pmatrix}$. How can I compute a matrix $P$ such that $P^{-1}AP=R$? And in general what is the algorithm?
 A: As with the Jordan case, you need to find a Rational Canonical basis; your matrix $P$ will have the rational canonical basis as its columns.
Your computation is incorrect, though, at least under the definition I am familiar with. In the definition I am familiar with, each block in the Rational Canonical Form is the companion matrix of a polynomial of the form $\phi^k(t)$, where $\phi(t)$ is an irreducible factor of the characteristic polynomial. 
The characteristic polynomial is $(x-2)^2(x-3)$. The minimal polynomial is either $(x-2)(x-3)$ or $(x-2)^2(x-3)$. The Rational Canonical form deals with the irreducible factors separately, so you will have that the Rational Canonical form of $A$ is either
$$\begin{align*}
\left(\begin{array}{ccc}
2 & 0 & 0\\
0 & 2 & 0\\
0 & 0 & 3
\end{array}\right) &\text{if the minimal polynomial is }(x-2)(x-3);\\
\left(\begin{array}{ccc}
0 & -4 & 0\\
1 & 4 & 0\\
0 & 0 & 3
\end{array}\right) & \text{if the minimal polynomial is }(x-2)^2(x-3).
\end{align*}$$
It is not hard to check that $A-2I$ has rank $1$, so the nullspace is 2-dimensional; hence the eigenspace corresponding to $2$ is two dimensional, so the geometric multiplicity of $2$ equals the algebraic multiplicity. The matrix is diagonalizable, and the Rational Canonical form of $A$ is the diagonal matrix.
Find a basis of eigenvectors, that gives you the $P$.
In general, you need to find a Rational Canonical Basis, and a matrix whose columns are the elements of the Rational Canonical Basis will work as $P$.
To find them, you need to determine the size of the blocks associated to each irreducible factor of the characteristic polynomial. If you have a block of size $kd$, where $d$ Is the degree of the irreducible factor $\phi(t)$, then you need to find an element $\mathbf{v}$ of the nullspace of $\phi^k(A)$ that is not an element of the nullspace of $\phi^{k-1}(A)$. Then the basis vectors corresponding to that particular block are $\mathbf{v}$, $A\mathbf{v},A^2\mathbf{v},\ldots,A^{kd-1}\mathbf{v}$. 
