CoCalc Public FilesMat541 / Smith.sagewsOpen with one click!
Author: Juan Carlos Bustamante
Views : 56
Compute Environment: Ubuntu 18.04 (Deprecated)
typeset_mode(True)
A = matrix(ZZ, [[1,0,12,16], [0,1,0,8], [1, 2, 6, 14]]) A.smith_form()
((100001000060)\displaystyle \left(\begin{array}{rrrr} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 6 & 0 \end{array}\right), (001010141)\displaystyle \left(\begin{array}{rrr} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & -4 & -1 \end{array}\right), (18620010801130001)\displaystyle \left(\begin{array}{rrrr} 1 & -8 & -6 & 20 \\ 0 & 1 & 0 & -8 \\ 0 & 1 & 1 & -3 \\ 0 & 0 & 0 & 1 \end{array}\right))

Exemple n.1, p 513

M= matrix(ZZ,[[6,8],[9,15]]) # ZZ pour dire que l'anneau des coefficients est celui des entiers. M.smith_form()
((10018)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 18 \end{array}\right), (1134)\displaystyle \left(\begin{array}{rr} 1 & -1 \\ 3 & -4 \end{array}\right), (2713)\displaystyle \left(\begin{array}{rr} 2 & -7 \\ -1 & 3 \end{array}\right))

Le résultat est une liste de trois matrices.. Pour savoir ce qu'elles représentent, on peut faire M.smith_form?

Exemple 2.

Cette fois l'anneau des coefficients est Q[x]\mathbb{Q}[x], il faut le dire.

A = QQ['x'] M=matrix(A,[[x-1,0,1],[0,x-2,2],[0,0,x-3]]) M
(x1010x2200x3)\displaystyle \left(\begin{array}{rrr} x - 1 & 0 & 1 \\ 0 & x - 2 & 2 \\ 0 & 0 & x - 3 \end{array}\right)
S = M.smith_form()[0] S
(10001000x36x2+11x6)\displaystyle \left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & x^{3} - 6 x^{2} + 11 x - 6 \end{array}\right)
S[2,2].factor()
(x3)(x2)(x1)\displaystyle (x - 3) \cdot (x - 2) \cdot (x - 1)

Exemple 3.

Cette fois avec les coefficients dans Z[i]\mathbb{Z}[i].

R = ZZ[I] R # Pour afficher quelle est la définition de R. I = R.basis()[1]
Order in Number Field in I with defining polynomial x^2 + 1
M = matrix([[1+8*I,-5+I],[-23+2*I,13*I]]) M.parent() # Pour afficher le type d'objet que M est : l'anneau des coefficients. M
Full MatrixSpace of 2 by 2 dense matrices over Order in Number Field in I with defining polynomial x^2 + 1
(8I+1I52I2313I)\displaystyle \left(\begin{array}{rr} 8 I + 1 & I - 5 \\ 2 I - 23 & 13 I \end{array}\right)
M.smith_form()
((1002I+200)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 2 I + 2 \\ 0 & 0 \end{array}\right), (100I144I+12I4I+32I5)\displaystyle \left(\begin{array}{rrr} 1 & 0 & 0 \\ I - 1 & -4 & 4 I + 1 \\ -2 I & -4 I + 3 & -2 I - 5 \end{array}\right), (16I801)\displaystyle \left(\begin{array}{rr} 1 & -6 I - 8 \\ 0 & 1 \end{array}\right))

Un autre exemple

Où en plus on fait les manipulations des matrices "pour vrai", c'est à dire avec les opérations élémentaires.

M=matrix([[1,8+6*I],[1+I,-4],[1-I,0]]) M M.smith_form()
(16I+8I+14I+10)\displaystyle \left(\begin{array}{rr} 1 & 6 I + 8 \\ I + 1 & -4 \\ -I + 1 & 0 \end{array}\right)
((1002I+200)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 2 I + 2 \\ 0 & 0 \end{array}\right), (100I144I+12I4I+32I5)\displaystyle \left(\begin{array}{rrr} 1 & 0 & 0 \\ I - 1 & -4 & 4 I + 1 \\ -2 I & -4 I + 3 & -2 I - 5 \end{array}\right), (16I801)\displaystyle \left(\begin{array}{rr} 1 & -6 I - 8 \\ 0 & 1 \end{array}\right))
M= M.with_added_multiple_of_row(1,0,-(1+I)) M = M.with_added_multiple_of_row(2,0,-(1-I)) M
(16I+8014I602I14)\displaystyle \left(\begin{array}{rr} 1 & 6 I + 8 \\ 0 & -14 I - 6 \\ 0 & 2 I - 14 \end{array}\right)
M=M.with_added_multiple_of_column(1,0,-(8+6*I)) M
(10014I602I14)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & -14 I - 6 \\ 0 & 2 I - 14 \end{array}\right)
M=M.with_rescaled_row(2,I) M
(10014I6014I2)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & -14 I - 6 \\ 0 & -14 I - 2 \end{array}\right)
M=M.with_added_multiple_of_row(2,1,-1) M
(10014I604)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & -14 I - 6 \\ 0 & 4 \end{array}\right)
M.with_added_multiple_of_row(1,2,-1-3*I)
(10026I1004)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & -26 I - 10 \\ 0 & 4 \end{array}\right)
M=M.with_added_multiple_of_row(1,2,1+I) M
(1002I204)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 2 I - 2 \\ 0 & 4 \end{array}\right)
M.with_added_multiple_of_row(2,1,(1+I))
(1002I200)\displaystyle \left(\begin{array}{rr} 1 & 0 \\ 0 & 2 I - 2 \\ 0 & 0 \end{array}\right)