normform.tex 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. \section{Matrix Normal Forms}
  2. \begin{Operator}{Smithex}
  3. The operator \name{smithex} computes the Smith normal form S of a
  4. \nameref{matrix} A (say). It returns \{S,P,$P^-1$\} where $P*S*P^-1 = A$.
  5. \begin{Syntax}
  6. \name{smithex}\(\meta{matrix},\meta{variable}\)
  7. \meta{matrix} :- a rectangular \nameref{matrix} of univariate polynomials in
  8. \meta{variable}.
  9. \meta{variable} :- the variable.
  10. \end{Syntax}
  11. \begin{Examples}
  12. a := mat((x,x+1),(0,3*x^2)); &
  13. \begin{multilineoutput}{6cm}
  14. [x x + 1]
  15. [ ]
  16. a := [ 2 ]
  17. [0 3*x ]
  18. \end{multilineoutput}\\
  19. smithex(a,x); &
  20. \begin{multilineoutput}{6cm}
  21. [1 0 ] [1 0] [x x + 1]
  22. \{ [ ], [ ], [ ] \}
  23. [ 3] [ 2 ] [ ]
  24. [0 x ] [3*x 1] [-3 -3 ]
  25. \end{multilineoutput}\\
  26. \end{Examples}
  27. \end{Operator}
  28. \begin{Operator}{Smithex\_int}
  29. The operator \name{smithex\_int} performs the same task as \name{smithex}
  30. but on matrices containing only integer entries. Namely,
  31. \name{smithex\_int} returns \{S,P,$P^-1$\} where S is the smith normal
  32. form of the input \nameref{matrix} (A say), and $P*S*P^-1 = A$.
  33. \begin{Syntax}
  34. \name{smithex\_int}\(\meta{matrix}\)
  35. \meta{matrix} :- a rectangular \nameref{matrix} of integer entries.
  36. \end{Syntax}
  37. \begin{Examples}
  38. a := mat((9,-36,30),(-36,192,-180),(30,-180,180)); &
  39. \begin{multilineoutput}{6cm}
  40. [ 9 -36 30 ]
  41. [ ]
  42. a := [-36 192 -180]
  43. [ ]
  44. [30 -180 180 ]
  45. \end{multilineoutput}\\
  46. smithex_int(a); &
  47. \begin{multilineoutput}{6cm}
  48. [3 0 0 ] [-17 -5 -4 ] [1 -24 30 ]
  49. [ ] [ ] [ ]
  50. \{ [0 12 0 ], [64 19 15 ], [-1 25 -30] \}
  51. [ ] [ ] [ ]
  52. [0 0 60] [-50 -15 -12] [0 -1 1 ]
  53. \end{multilineoutput}\\
  54. \end{Examples}
  55. \end{Operator}
  56. \begin{Operator}{Frobenius}
  57. The operator \name{frobenius} computes the \name{frobenius} normal form F of a
  58. \nameref{matrix} (A say). It returns \{F,P,$P^-1$\} where $P*F*P^-1 = A$.
  59. \begin{Syntax}
  60. \name{frobenius}\(\meta{matrix}\)
  61. \meta{matrix} :- a square \nameref{matrix}.
  62. \end{Syntax}
  63. Field Extensions:
  64. By default, calculations are performed in the rational numbers. To
  65. extend this field the \nameref{arnum} package can be used. The package must
  66. first be loaded by load\_package arnum;. The field can now be extended
  67. by using the defpoly command. For example, defpoly sqrt2**2-2; will
  68. extend the field to include the square root of 2 (now defined by sqrt2).
  69. Modular Arithmetic:
  70. \name{Frobenius} can also be calculated in a modular base. To do this
  71. first type on modular;. Then setmod p; (where p is a prime) will set
  72. the modular base of calculation to p. By further typing on balanced\_mod
  73. the answer will appear using a symmetric modular representation. See
  74. \nameref{ratjordan} for an example.
  75. \begin{Examples}
  76. a := mat((x,x^2),(3,5*x)); &
  77. \begin{multilineoutput}{6cm}
  78. [ 2 ]
  79. [x x ]
  80. a := [ ]
  81. [3 5*x]
  82. \end{multilineoutput}\\
  83. frobenius(a);&
  84. \begin{multilineoutput}{6cm}
  85. [ 2] [1 x] [ - x ]
  86. \{ [0 - 2*x ], [ ], [1 -----] \}
  87. [ ] [0 3] [ 3 ]
  88. [1 6*x ] [ ]
  89. [ 1 ]
  90. [0 --- ]
  91. [ 3 ]
  92. \end{multilineoutput}\\
  93. load\_package arnum;\\
  94. defpoly sqrt2**2-2;\\
  95. a := mat((sqrt2,5),(7*sqrt2,sqrt2));&
  96. \begin{multilineoutput}{6cm}
  97. [ sqrt2 5 ]
  98. a := [ ]
  99. [7*sqrt2 sqrt2]
  100. \end{multilineoutput}\\
  101. frobenius(a); &
  102. \begin{multilineoutput}{6cm}
  103. [0 35*sqrt2 - 2] [1 sqrt2 ] [ 1 ]
  104. \{ [ ], [ ], [1 - --- ] \}
  105. [1 2*sqrt2 ] [1 7*sqrt2] [ 7 ]
  106. [ ]
  107. [ 1 ]
  108. [0 ----*sqrt2]
  109. [ 14 ]
  110. \end{multilineoutput}\\
  111. \end{Examples}
  112. \end{Operator}
  113. \begin{Operator}{Ratjordan}
  114. The operator \name{ratjordan} computes the rational Jordan normal form R
  115. of a \nameref{matrix} (A say). It returns \{R,P,$P^-1$\} where $P*R*P^-1 = A$.
  116. \begin{Syntax}
  117. \name{ratjordan}\(\meta{matrix}\)
  118. \meta{matrix} :- a square \nameref{matrix}.
  119. \end{Syntax}
  120. Field Extensions:
  121. By default, calculations are performed in the rational numbers. To
  122. extend this field the \name{arnum} package can be used. The package must
  123. first be loaded by load\_package arnum;. The field can now be extended
  124. by using the defpoly command. For example, defpoly sqrt2**2-2; will
  125. extend the field to include the square root of 2 (now defined by sqrt2).
  126. See \nameref{frobenius} for an example.
  127. Modular Arithmetic:
  128. \name{ratjordan} can also be calculated in a modular base. To do this
  129. first type on modular;. Then setmod p; (where p is a prime) will set
  130. the modular base of calculation to p. By further typing on balanced\_mod
  131. the answer will appear using a symmetric modular representation.
  132. \begin{Examples}
  133. a := mat((5,4*x),(2,x^2));&
  134. \begin{multilineoutput}{6cm}
  135. [5 4*x]
  136. [ ]
  137. a := [ 2 ]
  138. [2 x ]
  139. \end{multilineoutput}\\
  140. ratjordan(a); &
  141. \begin{multilineoutput}{6cm}
  142. [0 x*( - 5*x + 8)] [1 5] [ -5 ]
  143. \{ [ ], [ ], [1 -----] \}
  144. [ 2 ] [0 2] [ 2 ]
  145. [1 x + 5 ] [ ]
  146. [ 1 ]
  147. [0 -----]
  148. [ 2 ]
  149. \end{multilineoutput}\\
  150. on modular; \\
  151. setmod 23; \\
  152. a := mat((12,34),(56,78)); &
  153. \begin{multilineoutput}{6cm}
  154. [12 11]
  155. a := [ ]
  156. [10 9 ]
  157. \end{multilineoutput}\\
  158. ratjordan(a); &
  159. \begin{multilineoutput}{6cm}
  160. [15 0] [16 8] [1 21]
  161. \{ [ ], [ ], [ ] \}
  162. [0 6] [19 4] [1 4 ]
  163. \end{multilineoutput}\\
  164. on balanced\_mod;\\
  165. ratjordan(a);&
  166. \begin{multilineoutput}{6cm}
  167. [- 8 0] [ - 7 8] [1 - 2]
  168. \{ [ ], [ ], [ ] \}
  169. [ 0 6] [ - 4 4] [1 4 ]
  170. \end{multilineoutput}\\
  171. \end{Examples}
  172. \end{Operator}
  173. \begin{Operator}{Jordansymbolic}
  174. The operator \name{jordansymbolic} computes the Jordan normal form J
  175. of a \nameref{matrix} (A say). It returns \{J,L,P,$P^-1$\} where
  176. $P*J*P^-1 = A$. L = \{ll,mm\} where mm is a name and ll is a list of
  177. irreducible factors of p(mm).
  178. \begin{Syntax}
  179. \name{jordansymbolic}\(\meta{matrix}\)
  180. \meta{matrix} :- a square \nameref{matrix}.
  181. \end{Syntax}
  182. Field Extensions:
  183. By default, calculations are performed in the rational numbers. To
  184. extend this field the \nameref{arnum} package can be used. The package must
  185. first be loaded by load\_package arnum;. The field can now be extended
  186. by using the defpoly command. For example, defpoly sqrt2**2-2; will
  187. extend the field to include the square root of 2 (now defined by sqrt2).
  188. See \nameref{frobenius} for an example.
  189. Modular Arithmetic:
  190. \name{jordansymbolic} can also be calculated in a modular base. To do this
  191. first type on modular;. Then setmod p; (where p is a prime) will set
  192. the modular base of calculation to p. By further typing on balanced\_mod
  193. the answer will appear using a symmetric modular representation. See
  194. \nameref{ratjordan} for an example.
  195. % Extras:
  196. % If using \name{xr}, the X interface for REDUCE, then the appearance of the
  197. % output can be improved by switching on looking\_good. This
  198. % converts any lambdas to a greek font.
  199. \begin{Examples}
  200. a := mat((1,y),(2,5*y)); &
  201. \begin{multilineoutput}{6cm}
  202. [1 y ]
  203. a := [ ]
  204. [2 5*y]
  205. \end{multilineoutput}\\
  206. jordansymbolic(a); &
  207. \begin{multilineoutput}{6cm}
  208. \{
  209. [lambda11 0 ]
  210. [ ]
  211. [ 0 lambda12]
  212. ,
  213. 2
  214. {{lambda - 5*lambda*y - lambda + 3*y},lambda},
  215. [lambda11 - 5*y lambda12 - 5*y]
  216. [ ]
  217. [ 2 2 ]
  218. ,
  219. [ 2*lambda11 - 5*y - 1 5*lambda11*y - lambda11 - y + 1 ]
  220. [---------------------- ---------------------------------]
  221. [ 2 2 ]
  222. [ 25*y - 2*y + 1 2*(25*y - 2*y + 1) ]
  223. [ ]
  224. [ 2*lambda12 - 5*y - 1 5*lambda12*y - lambda12 - y + 1 ]
  225. [---------------------- ---------------------------------]
  226. [ 2 2 ]
  227. [ 25*y - 2*y + 1 2*(25*y - 2*y + 1) ]
  228. \}
  229. \end{multilineoutput}\\
  230. \end{Examples}
  231. \end{Operator}
  232. \begin{Operator}{Jordan}
  233. The operator \name{jordan} computes the Jordan normal form J
  234. of a \nameref{matrix} (A say). It returns \{J,P,$P^-1$\} where $P*J*P^-1 = A$.
  235. \begin{Syntax}
  236. \name{jordan}\(\meta{matrix}\)
  237. \meta{matrix} :- a square \nameref{matrix}.
  238. \end{Syntax}
  239. Field Extensions:
  240. By default, calculations are performed in the rational numbers. To
  241. extend this field the \name{arnum} package can be used. The package must
  242. first be loaded by load\_package arnum;. The field can now be extended
  243. by using the defpoly command. For example, defpoly sqrt2**2-2; will
  244. extend the field to include the square root of 2 (now defined by sqrt2).
  245. See \nameref{frobenius} for an example.
  246. Modular Arithmetic:
  247. \name{Jordan} can also be calculated in a modular base. To do this
  248. first type on modular;. Then setmod p; (where p is a prime) will set
  249. the modular base of calculation to p. By further typing on balanced\_mod
  250. the answer will appear using a symmetric modular representation. See
  251. \nameref{ratjordan} for an example.
  252. \begin{Examples}
  253. a := mat((1,x),(0,x)); &
  254. \begin{multilineoutput}{6cm}
  255. [1 x]
  256. a := [ ]
  257. [0 x]
  258. \end{multilineoutput}\\
  259. jordan(a);&
  260. \begin{multilineoutput}{6cm}
  261. \{
  262. [1 0]
  263. [ ]
  264. [0 x]
  265. ,
  266. [ 1 x ]
  267. [------- --------------]
  268. [ x - 1 2 ]
  269. [ x - 2*x + 1 ]
  270. [ ]
  271. [ 1 ]
  272. [ 0 ------- ]
  273. [ x - 1 ]
  274. ,
  275. [x - 1 - x ]
  276. [ ]
  277. [ 0 x - 1]
  278. \}
  279. \end{multilineoutput}\\
  280. \end{Examples}
  281. \end{Operator}