Jordan Canonical Form; an algorithmic approach

2276 days ago by bigdata2016

A=matrix(QQ,[[1,0,0,0,0],[1,-1,0,0,-1],[1,-1,1,0,-1],[0,0,0,0,-1],[-1,1,0,0,1]]) p=A.characteristic_polynomial() show(A) html('<br>Characteristic Polynomial is $%s=%s$'%(latex(p),latex(p.factor())))
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrr} 1 & 0 & 0 & 0 & 0 \\ 1 & -1 & 0 & 0 & -1 \\ 1 & -1 & 1 & 0 & -1 \\ 0 & 0 & 0 & 0 & -1 \\ -1 & 1 & 0 & 0 & 1 \end{array}\right) Characteristic Polynomial is $x^{5} - 2 x^{4} + x^{3}=(x - 1)^{2} \cdot x^{3}$ Characteristic Polynomial is
ev=A.eigenvectors_right() X1=ev[0][1][0] Y1=ev[1][1][0] html('Eigenvector of matrix A corresponding to the eigenvalue $%s$ is $x_1=%s$' %(ev[0][0][0], latex(X1)) ) print html('Eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_1=%s$' %(ev[1][0][0], latex(Y1)) )
 Eigenvector of matrix A corresponding to the eigenvalue $1$ is $x_1=\left(0,\,0,\,1,\,0,\,0\right)$ Eigenvector of matrix A corresponding to the eigenvalue $0$ is $y_1=\left(0,\,0,\,0,\,1,\,0\right)$ Eigenvector of matrix A corresponding to the eigenvalue is Eigenvector of matrix A corresponding to the eigenvalue is 
EYE=identity_matrix(A.nrows()) X2=(A-ev[0][0][0]*EYE).solve_right(X1) Y2=(A-ev[1][0][0]*EYE).solve_right(Y1) html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $x_2=%s$' %(ev[0][0][0], latex(X2)) ) print html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_2=%s$' %(ev[1][0][0], latex(Y2)) )
 Generalized eigenvector of matrix A corresponding to the eigenvalue $1$ is $x_2=\left(1,\,1,\,0,\,1,\,-1\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue $0$ is $y_2=\left(0,\,1,\,0,\,0,\,-1\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue is Generalized eigenvector of matrix A corresponding to the eigenvalue is 
Y3=(A-ev[1][0][0]*EYE).solve_right(Y2) html('Generalized eigenvector of matrix A corresponding to the eigenvalue $%s$ is $y_3=%s$' %(ev[1][0][0], latex(Y3)) )
 Generalized eigenvector of matrix A corresponding to the eigenvalue $0$ is $y_3=\left(0,\,-1,\,-1,\,0,\,0\right)$ Generalized eigenvector of matrix A corresponding to the eigenvalue is
P=[X1,X2,Y1,Y2,Y3] P=matrix(P) P=P.transpose() html('$P=%s$' %latex(P) )
 $P=\left(\begin{array}{rrrrr} 0 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & -1 \\ 1 & 0 & 0 & 0 & -1 \\ 0 & 1 & 1 & 0 & 0 \\ 0 & -1 & 0 & -1 & 0 \end{array}\right)$
html('Jordan Canonical Form of matrix $A$ is $J_A=%s$' %latex(P^(-1)*A*P))
 Jordan Canonical Form of matrix $A$ is $J_A=\left(\begin{array}{rrrrr} 1 & 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 \end{array}\right)$ Jordan Canonical Form of matrix is