%%%% Sta of "RREF-Mod-p.Lisp.txt" ;; Uses a semicolon ";" to start a comment. ;; Use "::::" to indicate a new problem or section. ;; Use "%" for the Lisp prompt. :::: Reducing a Zed_{17} matrix :::: % (set-ring-modulus 17) % (setq *REWid* 4) ;;Printing-width can be less % (use-ring Mod-M-ring) % (setq m17 (mat-make-random 4 6 100)) [ 6 4 14 7 16 9 ] [ 16 8 12 10 13 11 ] [ 10 14 12 2 6 16 ] [ 6 0 2 12 3 15 ] % (rref-mtab-beforecol m17 :stepwise t) Reducing column-0 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 12 8 4 14 10 | 3 0 0 0 r1 | 0 3 3 14 10 4 | 3 1 0 0 r2 | 0 13 0 13 2 1 | 4 0 1 0 r3 | 0 13 5 5 4 6 | 16 0 0 1 |---------------------------| Reducing column-1 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 13 16 8 11 | 8 13 0 0 r1 | 0 1 1 16 9 7 | 1 6 0 0 r2 | 0 0 4 9 4 12 | 8 7 1 0 r3 | 0 0 9 1 6 0 | 3 7 0 1 |---------------------------| Reducing column-2 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 0 8 12 6 | 16 3 1 0 r1 | 0 1 0 1 8 4 | 16 0 4 0 r2 | 0 0 1 15 1 3 | 2 6 13 0 r3 | 0 0 0 2 14 7 | 2 4 2 1 |---------------------------| Reducing column-3 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 0 0 7 12 | 8 4 10 13 r1 | 0 1 0 0 1 9 | 15 15 3 8 r2 | 0 0 1 0 15 10 | 4 10 15 1 r3 | 0 0 0 1 7 12 | 1 2 1 9 |---------------------------| JK: Found 4 pivots before the sixth column. ;; Reducing again, but using symmetric-residues. % (use-ring Modsym-M-ring) % (rref-mtab-beforecol m17 :stepwise t) Reducing column-0 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 -5 8 4 -3 -7 | 3 0 0 0 r1 | 0 3 3 -3 -7 4 | 3 1 0 0 r2 | 0 -4 0 -4 2 1 | 4 0 1 0 r3 | 0 -4 5 5 4 6 | -1 0 0 1 |---------------------------| Reducing column-1 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 -4 -1 8 -6 | 8 -4 0 0 r1 | 0 1 1 -1 -8 7 | 1 6 0 0 r2 | 0 0 4 -8 4 -5 | 8 7 1 0 r3 | 0 0 -8 1 6 0 | 3 7 0 1 |---------------------------| Reducing column-2 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 0 8 -5 6 | -1 3 1 0 r1 | 0 1 0 1 8 4 | -1 0 4 0 r2 | 0 0 1 -2 1 3 | 2 6 -4 0 r3 | 0 0 0 2 -3 7 | 2 4 2 1 |---------------------------| Reducing column-3 produces c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 0 0 7 -5 | 8 4 -7 -4 r1 | 0 1 0 0 1 -8 | -2 -2 3 8 r2 | 0 0 1 0 -2 -7 | 4 -7 -2 1 r3 | 0 0 0 1 7 -5 | 1 2 1 -8 |---------------------------| JK: Found 4 pivots before the sixth column. c0 c1 c2 c3 c4 c5 Row operations |---------------------------| r0 | 1 0 0 0 7 -5 | 8 4 -7 -4 r1 | 0 1 0 0 1 -8 | -2 -2 3 8 r2 | 0 0 1 0 -2 -7 | 4 -7 -2 1 r3 | 0 0 0 1 7 -5 | 1 2 1 -8 |---------------------------| :::: Change-of-Basis :::: ;; Over Zed_{17}, we have this mystery matrix: % (setq Mys (mat-make-initseq 3 3 '( -3 7 6 2 4 -7 0 -1 -1 ))) [ -3 7 6 ] [ 2 4 -7 ] [ 0 -1 -1 ] ;; By sheer luck, we discover that Mys cubed, is the Identity-matrix. % (mat-mul Mys Mys Mys) [ 1 0 0 ] [ 0 1 0 ] [ 0 0 1 ] ;; So Mys is, relative to the std. basis, the matrix-name of some ;; abstract trn Y (for "mYstery") which will likely have a simple ;; description relative to a better basis. Let's rename our given ;; matrix as the standard-basis-name of Y: ;; Matrix of trn Y, going To basis E, From basis E. % (setq Y-To-E-Fr-E Mys) [ -3 7 6 ] [ 2 4 -7 ] [ 0 -1 -1 ] ;; Some nice person tells us that ordered-basis (b0, b1, b2) is ;; better for Y, where % b0 , b1 , b2 [ -8 ] [ -6 ] [ -6 ] [ 0 ] , [ -5 ] , [ 2 ] [ -5 ] [ -7 ] [ 5 ] ;; Hence the Change-of-Basis matrix we need is ;; Matrix of Identity-trn, going To basis E, From basis B ... % (setq Id-To-E-Fr-B (mat-Horiz-concat b0 b1 b2)) [ -8 -6 -6 ] [ 0 -5 2 ] [ -5 -7 5 ] ;; ... together with its inverse: % (setq Id-To-B-Fr-E (mat-inverse? Id-To-E-Fr-B)) [ -5 8 1 ] [ -3 -4 -2 ] [ 1 -1 -5 ] ;; We now conjugate Mys to get trn Y w.r.t basis B. % (setq Y-To-B-Fr-B (mat-mul Id-To-B-Fr-E Y-To-E-Fr-E Id-To-E-Fr-B)) [ 0 1 0 ] [ 0 0 1 ] [ 1 0 0 ] ;;; Ah ha! Our Y is simply cyclic permution of the three Basis-B vectors. ;; Its lefthand-action sends ;; b0 -> b2 -> b1 -> ;; and back to b0. ;; Matrix Y-To-B-Fr-B is an example ;; of a PERMUTATION MATRIX. In the ring of NxN matrices, there ;; are N! (N factorial) many permutation-matrices. ;;; The ring makes a difference: % (with-ring Rational-ring (setq Wrong-ring (mat-mul Id-To-B-Fr-E Y-To-E-Fr-E Id-To-E-Fr-B))) [ 187 443 -629 ] [ -68 85 -16 ] [ -50 -136 136 ] ;;; Although, we CAN recover the correct result: % (mat-mul Wrong-ring (mat-eye 3)) [ 0 1 0 ] [ 0 0 1 ] [ 1 0 0 ] %%%% End of "RREF-Mod-p.Lisp.txt"