123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290 |
- Sun Aug 18 18:21:38 2002 run on Windows
- *** co already defined as operator
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % Examples of calculations of matrix normal forms using the REDUCE %
- % NORMFORM package. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % load_package normform;
- on errcont;
- % So that computation continues after an error.
- %
- % If using xr, the X interface for REDUCE, then turn on looking_good to
- % improve the appearance of the output.
- %
- fluid '(options!*);
- lisp if memq('fmprint ,options!*) then on looking_good;
- procedure test(tmp,A);
- %
- % Checks that P * N * P^-1 = A where tmp is the output {P,N,P^-1}
- % of the Normal form calculation on A.
- %
- begin
- if second tmp * first tmp * third tmp = A then
- write "Seems O.K." else rederr "something isn't working.";
- end;
- test
- %%%%%%%%%%%%%%%%%%%%%%%%%%%% Smithex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat((3*x,x^2+x),(0,x^2));
- [3*x x*(x + 1)]
- [ ]
- a := [ 2 ]
- [ 0 x ]
- answer := smithex(A,x);
- answer := {
- [x 0 ]
- [ ]
- [ 2]
- [0 x ]
- ,
- [1 0]
- [ ]
- [x 1]
- ,
- [3 x + 1]
- [ ]
- [-3 - x ]
- }
- test(answer,A);
- Seems O.K.
- %
- % Extend algebraic field to include sqrt2.
- %
- load_package arnum;
- defpoly sqrt2**2-2;
- A := mat((sqrt2*y^2,y+1),(3*sqrt2,y^3+y*sqrt2));
- [ 2 ]
- [sqrt2*y y + 1 ]
- a := [ ]
- [ 2 ]
- [3*sqrt2 y*(y + sqrt2)]
- answer := smithex(A,y);
- answer := {
- [1 0 ]
- [ ]
- [ 5 3 ]
- [0 y + sqrt2*y - 3*y - 3]
- ,
- [ 2 1 ]
- [sqrt2*y ---*sqrt2]
- [ 6 ]
- [ ]
- [3*sqrt2 0 ]
- ,
- [ 1 2 ]
- [1 ---*sqrt2*y*(y + sqrt2)]
- [ 6 ]
- [ ]
- [0 - sqrt2 ]
- }
- test(answer,A);
- Seems O.K.
- off arnum;
- %
- % smithex will compute the Smith normal form of matrices containing
- % only integer entries but the integers are regarded as univariate
- % polynomials in x over a field F (the rationals unless the field has
- % been extended). For calculations over the integers use smithex_int.
- %
- A := mat((9,-36,30),(-36,192,-180),(30,-180,180));
- [ 9 -36 30 ]
- [ ]
- a := [-36 192 -180]
- [ ]
- [30 -180 180 ]
- answer := smithex(A,x);
- *** WARNING: all matrix entries are integers.
- If calculations in Z(the integers) are required, use smithex_int.
- answer := {
- [1 0 0]
- [ ]
- [0 1 0]
- [ ]
- [0 0 1]
- ,
- [ 1 ]
- [ 9 18 -----]
- [ 720 ]
- [ ]
- [-36 -24 0 ]
- [ ]
- [30 0 0 ]
- ,
- [1 -6 6 ]
- [ ]
- [ - 3 ]
- [0 1 ------]
- [ 2 ]
- [ ]
- [0 0 2160 ]
- }
- test(answer,A);
- Seems O.K.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%% Smithex_int %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat((1,2,3),(4,5,6),(7,8,x));
- [1 2 3]
- [ ]
- a := [4 5 6]
- [ ]
- [7 8 x]
- answer := smithex_int(A);
- ***** ERROR: matrix contains non_integer entries. Try smithex.
- A := mat((9,-36,30),(-36,192,-180),(30,-180,180));
- [ 9 -36 30 ]
- [ ]
- a := [-36 192 -180]
- [ ]
- [30 -180 180 ]
- answer := smithex_int(A);
- answer := {
- [3 0 0 ]
- [ ]
- [0 12 0 ]
- [ ]
- [0 0 60]
- ,
- [-17 -5 -4 ]
- [ ]
- [64 19 15 ]
- [ ]
- [-50 -15 -12]
- ,
- [1 -24 30 ]
- [ ]
- [-1 25 -30]
- [ ]
- [0 -1 1 ]
- }
- test(answer,A);
- Seems O.K.
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Frobenius %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat(((y+y^2-x^2)/y,(x-x^2-y+y^2)/y,(x^2-y^2)/y),(1+x+y,
- (x-y+y^2+x*y)/y,-x-y),((y-x+y^2-x^2)/y,(x-y+y^2-x^2)/y,
- (x+x^2-y^2)/y));
- [ 2 2 2 2 2 2 ]
- [ - x + y + y - x + x + y - y x - y ]
- [ ---------------- -------------------- --------- ]
- [ y y y ]
- [ ]
- [ 2 ]
- [ x*y + x + y - y ]
- a := [ x + y + 1 ------------------ - (x + y) ]
- [ y ]
- [ ]
- [ 2 2 2 2 2 2 ]
- [ - x - x + y + y - x + x + y - y x + x - y ]
- [-------------------- -------------------- -------------]
- [ y y y ]
- answer := frobenius(A);
- answer := {
- [ x ]
- [--- 0 0 ]
- [ y ]
- [ ]
- [ - x*(x + y) ]
- [ 0 0 --------------]
- [ y ]
- [ ]
- [ 2 ]
- [ x*y + x + y ]
- [ 0 1 --------------]
- [ y ]
- ,
- 3 2 2 2 2 2 2
- - x - 2*x *y - x - x*y + x*y + 2*y + y x - y - y
- mat((---------------------------------------------,-1,-------------),
- y*(x + y + 1) y
- (x + y + 1,0, - (x + y + 1)),
- 2 2 2 2
- - x - x + y + 2*y x + x - y - y
- (----------------------,0,-----------------))
- y y
- ,
- [ x - y ]
- [0 ------- 1 ]
- [ y ]
- [ ]
- [ 3 2 2 2 3 2 2 2 ]
- [ - x - x *y - x + x*y + y + y + y - x - 2*x*y - y ]
- [-1 ---------------------------------------- --------------------]
- [ y*(x + y + 1) x + y + 1 ]
- [ ]
- [ 2 2 ]
- [ x + x - y - 2*y ]
- [0 ------------------- 1 ]
- [ y*(x + y + 1) ]
- }
- test(answer,A);
- Seems O.K.
- %
- % Extend algebraic field to include i.
- %
- % load_package arnum;
- defpoly i^2+1;
- A := mat((-3-i,1,2+i,7-9*i),(-2,1,1,5-i),(-2-2*i,1,2+2*i,4-2*i),
- (2,0,-1,-2+8*i));
- [ - (i + 3) 1 i + 2 - (9*i - 7)]
- [ ]
- [ -2 1 1 - (i - 5) ]
- a := [ ]
- [ - (2*i + 2) 1 2*i + 2 - (2*i - 4)]
- [ ]
- [ 2 0 -1 8*i - 2 ]
- answer := frobenius(A);
- answer := {
- [i + 1 0 0 0 ]
- [ ]
- [ 0 0 0 7*i - 3 ]
- [ ]
- [ 0 1 0 - (8*i - 9)]
- [ ]
- [ 0 0 1 8*i - 3 ]
- ,
- [ 425 189 ]
- [-----*i + ----- -1 i + 3 18*i - 18 ]
- [ 106 106 ]
- [ ]
- [ 634 258 ]
- [-----*i + ----- 0 2 2*i - 12 ]
- [ 53 53 ]
- [ ]
- [ 150 588 ]
- [-----*i - ----- 0 2*i + 2 4*i - 10 ]
- [ 53 53 ]
- [ ]
- [ 108 7 ]
- [-----*i + ---- 0 -2 - (16*i - 8)]
- [ 53 53 ]
- ,
- mat((0, - i,1,1),
- 143 268 263 152 491 155
- (-1, - (-----*i - -----),-----*i + -----,-----*i + -----),
- 53 53 53 53 106 106
- 339 368 392 383 370 189
- (0, - (-----*i + -----), - (-----*i - -----), - (-----*i - -----)
- 106 53 53 106 53 53
- ),
- 101 9 7 54
- (0, - (-----*i + -----), - (-----*i - ----),1))
- 106 106 106 53
- }
- off arnum;
- A := mat((10,-5,-5,8,3,0),(-4,2,-10,-7,-5,-5),(-8,2,7,3,7,5),
- (-6,-7,-7,-7,10,7),(-4,-3,-3,-6,8,-9),(-2,5,-5,9,7,-4));
- [10 -5 -5 8 3 0 ]
- [ ]
- [-4 2 -10 -7 -5 -5]
- [ ]
- [-8 2 7 3 7 5 ]
- a := [ ]
- [-6 -7 -7 -7 10 7 ]
- [ ]
- [-4 -3 -3 -6 8 -9]
- [ ]
- [-2 5 -5 9 7 -4]
- F := first frobenius(A);
- [0 0 0 0 0 -867960]
- [ ]
- [1 0 0 0 0 -466370]
- [ ]
- [0 1 0 0 0 47845 ]
- f := [ ]
- [0 0 1 0 0 -712 ]
- [ ]
- [0 0 0 1 0 -95 ]
- [ ]
- [0 0 0 0 1 16 ]
- %
- % Calculate in Z\23Z...
- %
- on modular;
- setmod 23;
- 1
- F_mod := first frobenius(A);
- [0 17 0 0 0 0 ]
- [ ]
- [1 19 0 0 0 0 ]
- [ ]
- [0 0 0 0 0 10]
- f_mod := [ ]
- [0 0 1 0 0 5 ]
- [ ]
- [0 0 0 1 0 15]
- [ ]
- [0 0 0 0 1 20]
-
- %
- % ...and with a balanced modular representation.
- %
- on balanced_mod;
- F_bal_mod := first frobenius(A);
- [0 - 6 0 0 0 0 ]
- [ ]
- [1 - 4 0 0 0 0 ]
- [ ]
- [0 0 0 0 0 10 ]
- f_bal_mod := [ ]
- [0 0 1 0 0 5 ]
- [ ]
- [0 0 0 1 0 - 8]
- [ ]
- [0 0 0 0 1 - 3]
- off balanced_mod;
- off modular;
- %%%%%%%%%%%%%%%%%%%%%%%%%%% Ratjordan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat(((y+y^2-x^2)/y,(x-x^2-y+y^2)/y,(x^2-y^2)/y),(1+x+y,
- (x-y+y^2+x*y)/y,-x-y),((y-x+y^2-x^2)/y,(x-y+y^2-x^2)/y,
- (x+x^2-y^2)/y));
- [ 2 2 2 2 2 2 ]
- [ - x + y + y - x + x + y - y x - y ]
- [ ---------------- -------------------- --------- ]
- [ y y y ]
- [ ]
- [ 2 ]
- [ x*y + x + y - y ]
- a := [ x + y + 1 ------------------ - (x + y) ]
- [ y ]
- [ ]
- [ 2 2 2 2 2 2 ]
- [ - x - x + y + y - x + x + y - y x + x - y ]
- [-------------------- -------------------- -------------]
- [ y y y ]
- answer := ratjordan(A);
- answer := {
- [ x ]
- [--- 0 0 ]
- [ y ]
- [ ]
- [ x ]
- [ 0 --- 0 ]
- [ y ]
- [ ]
- [ 0 0 x + y]
- ,
- 3 2 2 2 2 2
- - x - 2*x *y - x - x*y + x*y + 2*y + y - x - x*y + y
- mat((---------------------------------------------,-----------------,
- y*(x + y + 1) 2
- x*y - x + y
- 2 2
- x + x - y - y
- -----------------),
- 2
- x*y - x + y
- y*(x + y + 1) - y*(x + y + 1)
- (x + y + 1,---------------,------------------),
- 2 2
- x*y - x + y x*y - x + y
- 2 2 2 2 2 2
- - x - x + y + 2*y - x - x + y + y x + x - y - y
- (----------------------,--------------------,-----------------))
- y 2 2
- x*y - x + y x*y - x + y
- ,
- x - y
- mat((0,-------,1),
- y
- 3 3 2 2 2 2 3 2 4 3 2
- - x *y + x - x *y - x *y + x + x*y - x*y - 2*x*y + y + y + y
- (-1,-----------------------------------------------------------------------,
- 2
- y *(x + y + 1)
- 2 2 2 3
- - x *y + x - 2*x*y + x*y + x - y
- --------------------------------------),
- y*(x + y + 1)
- - x - y + 1 x + y
- (-1,--------------,-----------))
- x + y + 1 x + y + 1
- }
- test(answer,A);
- Seems O.K.
- %
- % Extend algebraic field to include sqrt(2).
- %
- % load_package arnum;
- defpoly sqrt2**2-2;
- A:= mat((4*sqrt2-6,-4*sqrt2+7,-3*sqrt2+6),(3*sqrt2-6,-3*sqrt2+7,
- -3*sqrt2+6),(3*sqrt2,1-3sqrt2,-2*sqrt2));
- [4*sqrt2 - 6 - (4*sqrt2 - 7) - (3*sqrt2 - 6)]
- [ ]
- a := [3*sqrt2 - 6 - (3*sqrt2 - 7) - (3*sqrt2 - 6)]
- [ ]
- [ 3*sqrt2 - (3*sqrt2 - 1) - 2*sqrt2 ]
- answer := ratjordan(A);
- answer := {
- [sqrt2 0 0 ]
- [ ]
- [ 0 sqrt2 0 ]
- [ ]
- [ 0 0 - (3*sqrt2 - 1)]
- ,
- [ 21 49 21 18 ]
- [7*sqrt2 - 6 ----*sqrt2 - ---- - (----*sqrt2 - ----)]
- [ 31 31 31 31 ]
- [ ]
- [ 21 18 21 18 ]
- [3*sqrt2 - 6 ----*sqrt2 - ---- - (----*sqrt2 - ----)]
- [ 31 31 31 31 ]
- [ ]
- [ 3 24 3 24 ]
- [3*sqrt2 + 1 - (----*sqrt2 + ----) ----*sqrt2 + ---- ]
- [ 31 31 31 31 ]
- ,
- [0 sqrt2 + 1 1 ]
- [ ]
- [-1 4*sqrt2 + 9 4*sqrt2]
- [ ]
- [ 1 ]
- [-1 - (---*sqrt2 - 1) 1 ]
- [ 6 ]
- }
- test(answer,A);
- Seems O.K.
- off arnum;
- A := mat((-12752,-6285,-9457,-7065,-4939,-5865,-3769),(13028,6430,
- 9656, 7213,5041,5984,3841),(16425,8080,12192,9108,6370,7569,
- 4871), (-6065,-2979,-4508,-3364,-2354,-2801,-1803),(2968,
- 1424,2231, 1664,1171,1404,919),(-22762,-11189,-16902,-12627,
- -8833, -10498,-6760),(23112,11400,17135,12799,8946,10622,
- 6821));
- [-12752 -6285 -9457 -7065 -4939 -5865 -3769]
- [ ]
- [13028 6430 9656 7213 5041 5984 3841 ]
- [ ]
- [16425 8080 12192 9108 6370 7569 4871 ]
- [ ]
- a := [-6065 -2979 -4508 -3364 -2354 -2801 -1803]
- [ ]
- [ 2968 1424 2231 1664 1171 1404 919 ]
- [ ]
- [-22762 -11189 -16902 -12627 -8833 -10498 -6760]
- [ ]
- [23112 11400 17135 12799 8946 10622 6821 ]
- R := first ratjordan(A);
- [0 2 0 0 0 0 0 ]
- [ ]
- [1 0 0 0 0 0 0 ]
- [ ]
- [0 0 0 0 0 0 5 ]
- [ ]
- r := [0 0 1 0 0 0 0 ]
- [ ]
- [0 0 0 1 0 0 -2]
- [ ]
- [0 0 0 0 1 0 3 ]
- [ ]
- [0 0 0 0 0 1 0 ]
- %
- % Calculate in Z/23Z...
- %
- on modular;
- setmod 23;
- 23
- R_mod := first ratjordan(A);
- [19 0 0 0 0 0 0 ]
- [ ]
- [0 18 0 0 0 0 0 ]
- [ ]
- [0 0 17 0 0 0 0 ]
- [ ]
- r_mod := [0 0 0 5 0 0 0 ]
- [ ]
- [0 0 0 0 0 0 5 ]
- [ ]
- [0 0 0 0 1 0 19]
- [ ]
- [0 0 0 0 0 1 10]
- %
- % ...and with a balanced modular representation.
- %
- on balanced_mod;
- R_bal_mod := first ratjordan(A);
- [5 0 0 0 0 0 0 ]
- [ ]
- [0 - 4 0 0 0 0 0 ]
- [ ]
- [0 0 - 5 0 0 0 0 ]
- [ ]
- r_bal_mod := [0 0 0 - 6 0 0 0 ]
- [ ]
- [0 0 0 0 0 0 5 ]
- [ ]
- [0 0 0 0 1 0 - 4]
- [ ]
- [0 0 0 0 0 1 10 ]
- off balanced_mod;
- off modular;
- %%%%%%%%%%%%%%%%%%%%%%%%%%% jordansymbolic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat(((y+y^2-x^2)/y,(x-x^2-y+y^2)/y,(x^2-y^2)/y),(1+x+y,
- (x-y+y^2+x*y)/y,-x-y),((y-x+y^2-x^2)/y,(x-y+y^2-x^2)/y,
- (x+x^2-y^2)/y));
- [ 2 2 2 2 2 2 ]
- [ - x + y + y - x + x + y - y x - y ]
- [ ---------------- -------------------- --------- ]
- [ y y y ]
- [ ]
- [ 2 ]
- [ x*y + x + y - y ]
- a := [ x + y + 1 ------------------ - (x + y) ]
- [ y ]
- [ ]
- [ 2 2 2 2 2 2 ]
- [ - x - x + y + y - x + x + y - y x + x - y ]
- [-------------------- -------------------- -------------]
- [ y y y ]
- answer := jordansymbolic(A);
- answer := {
- [ x ]
- [--- 0 0 ]
- [ y ]
- [ ]
- [ x ]
- [ 0 --- 0 ]
- [ y ]
- [ ]
- [ 0 0 x + y]
- ,
- lambda*y - x
- {{--------------,lambda - x - y},
- y
- lambda},
- 3 2 2 2 2 2
- - x - 2*x *y - x - x*y + x*y + 2*y + y - x - x*y + y
- mat((---------------------------------------------,-----------------,
- y*(x + y + 1) 2
- x*y - x + y
- 2 2
- x + x - y - y
- -----------------),
- 2
- x*y - x + y
- y*(x + y + 1) - y*(x + y + 1)
- (x + y + 1,---------------,------------------),
- 2 2
- x*y - x + y x*y - x + y
- 2 2 2 2 2 2
- - x - x + y + 2*y - x - x + y + y x + x - y - y
- (----------------------,--------------------,-----------------))
- y 2 2
- x*y - x + y x*y - x + y
- ,
- x - y
- mat((0,-------,1),
- y
- 3 3 2 2 2 2 3 2 4 3 2
- - x *y + x - x *y - x *y + x + x*y - x*y - 2*x*y + y + y + y
- (-1,-----------------------------------------------------------------------,
- 2
- y *(x + y + 1)
- 2 2 2 3
- - x *y + x - 2*x*y + x*y + x - y
- --------------------------------------),
- y*(x + y + 1)
- - x - y + 1 x + y
- (-1,--------------,-----------))
- x + y + 1 x + y + 1
- }
- %
- % Extend algebraic field.
- %
- % load_package arnum;
- defpoly b^3-2*b+b-5;
- A := mat((1-b,2+b^2),(3+b-2*b^2,3));
- [ 2 ]
- [ - (b - 1) b + 2]
- a := [ ]
- [ 2 ]
- [ - (2*b - b - 3) 3 ]
- answer := jordansymbolic(A);
- answer := {
- [lambda11 0 ]
- [ ]
- [ 0 lambda12]
- ,
- 2 2
- {{lambda + (b - 4)*lambda + 3*b + 4*b - 8},lambda},
- [ lambda11 - 3 lambda12 - 3 ]
- [ ]
- [ 2 2 ]
- [ - (2*b - b - 3) - (2*b - b - 3)]
- ,
- 1966 2 3514 1054 1
- mat(( - (--------*b + --------*b - --------)*(lambda11 + ---*b - 2),
- 239891 239891 239891 2
- 127472 2 236383 82923
- (----------*b + ----------*b + ---------)
- 29986375 29986375 5997275
- 26 2 107 45
- *(lambda11 + ----*b - -----*b + ----)),
- 11 11 11
- 1966 2 3514 1054 1
- ( - (--------*b + --------*b - --------)*(lambda12 + ---*b - 2),
- 239891 239891 239891 2
- 127472 2 236383 82923
- (----------*b + ----------*b + ---------)
- 29986375 29986375 5997275
- 26 2 107 45
- *(lambda12 + ----*b - -----*b + ----)))
- 11 11 11
- }
- off arnum;
- A := mat((-9,21,-15,4,2,0),(-10,21,-14,4,2,0),(-8,16,-11,4,2,0),
- (-6,12,-9,3,3,0),(-4,8,-6,0,5,0),(-2,4,-3,0,1,3));
- [-9 21 -15 4 2 0]
- [ ]
- [-10 21 -14 4 2 0]
- [ ]
- [-8 16 -11 4 2 0]
- a := [ ]
- [-6 12 -9 3 3 0]
- [ ]
- [-4 8 -6 0 5 0]
- [ ]
- [-2 4 -3 0 1 3]
- answer := jordansymbolic(A);
- answer := {
- [3 0 0 0 0 0 ]
- [ ]
- [0 3 0 0 0 0 ]
- [ ]
- [0 0 1 1 0 0 ]
- [ ]
- [0 0 0 1 0 0 ]
- [ ]
- [0 0 0 0 lambda31 0 ]
- [ ]
- [0 0 0 0 0 lambda32]
- ,
- 2
- {{lambda - 3,lambda - 1,lambda - 4*lambda + 5},lambda},
- [ - 3 1 6*lambda31 - 17 6*lambda32 - 17 ]
- [3 ------ 1 --- ----------------- ----------------- ]
- [ 8 4 2 2 ]
- [ ]
- [ - 3 1 5*(lambda31 - 3) 5*(lambda32 - 3) ]
- [3 ------ 1 --- ------------------ ------------------]
- [ 8 4 2 2 ]
- [ ]
- [ - 3 1 ]
- [3 ------ 1 --- 2*(lambda31 - 3) 2*(lambda32 - 3) ]
- [ 8 4 ]
- [ ]
- [ - 3 3 3 3*(lambda31 - 3) 3*(lambda32 - 3) ]
- [3 ------ --- --- ------------------ ------------------]
- [ 8 4 8 2 2 ]
- [ ]
- [ - 3 1 1 ]
- [3 ------ --- --- lambda31 - 3 lambda32 - 3 ]
- [ 8 2 4 ]
- [ ]
- [ - 1 1 1 lambda31 - 3 lambda32 - 3 ]
- [2 ------ --- --- -------------- -------------- ]
- [ 8 4 8 2 2 ]
- ,
- [ - 1 ]
- [ 0 0 0 ------ 0 1]
- [ 3 ]
- [ ]
- [ 8 ]
- [ 0 0 0 --- -8 8]
- [ 3 ]
- [ ]
- [ 0 -4 6 0 -2 0]
- [ ]
- [ 0 0 -4 8 -4 0]
- [ ]
- [ - lambda31 + 3 lambda31 - 4 1 0 0 0]
- [ ]
- [ - lambda32 + 3 lambda32 - 4 1 0 0 0]
- }
-
- % Check to see if looking_good (*) is on as the choice of using
- % either lambda or xi is dependent upon this.
- % (* -> the use of looking_good is described in the manual.).
- if not lisp !*looking_good then
- <<
- %
- % NB: we use lambda_ in solve (instead of lambda) as lambda is used
- % for other purposes in REDUCE which mean it cannot be used with
- % solve.
- %
- solve(lambda_^2-4*lambda_+5,lambda_);
- J := sub({lambda31=i + 2,lambda32= - i + 2},first answer);
- P := sub({lambda31=i + 2,lambda32= - i + 2},third answer);
- Pinv :=sub({lambda31=i + 2,lambda32= - i + 2},third rest answer);
- >>
- else
- <<
- solve(xi^2-4*xi+5,xi);
- J := sub({xi(3,1)=i + 2,xi(3,2)= - i + 2},first answer);
- P := sub({xi(3,1)=i + 2,xi(3,2)= - i + 2},third answer);
- Pinv := sub({xi(3,1)=i + 2,xi(3,2)= - i + 2},third rest answer);
- >>;
- test({J,P,Pinv},A);
- Seems O.K.
- %
- % Calculate in Z/23Z...
- %
- on modular;
- setmod 23;
- 23
- answer := jordansymbolic(A)$
- J_mod := {first answer, second answer};
- j_mod := {
- [3 0 0 0 0 0 ]
- [ ]
- [0 3 0 0 0 0 ]
- [ ]
- [0 0 1 1 0 0 ]
- [ ]
- [0 0 0 1 0 0 ]
- [ ]
- [0 0 0 0 lambda31 0 ]
- [ ]
- [0 0 0 0 0 lambda32]
- ,
- 2
- {{lambda + 20,lambda + 22,lambda + 19*lambda + 5},lambda}}
- %
- % ...and with a balanced modular representation.
- %
- on balanced_mod;
- answer := jordansymbolic(A)$
- J_bal_mod := {first answer, second answer};
- j_bal_mod := {
- [3 0 0 0 0 0 ]
- [ ]
- [0 3 0 0 0 0 ]
- [ ]
- [0 0 1 1 0 0 ]
- [ ]
- [0 0 0 1 0 0 ]
- [ ]
- [0 0 0 0 lambda31 0 ]
- [ ]
- [0 0 0 0 0 lambda32]
- ,
- 2
- {{lambda - 3,lambda - 1,lambda - 4*lambda + 5},lambda}}
- off balanced_mod;
- off modular;
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%% jordan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- A := mat((1,y),(y^2,3));
- [1 y]
- [ ]
- a := [ 2 ]
- [y 3]
- answer := jordan(A);
- answer := {
- [ 3 ]
- [sqrt(y + 1) + 2 0 ]
- [ ]
- [ 3 ]
- [ 0 - sqrt(y + 1) + 2]
- ,
- [ 3 3 ]
- [sqrt(y + 1) - 1 - (sqrt(y + 1) + 1)]
- [ ]
- [ 2 2 ]
- [ y y ]
- ,
- [ 3 3 3 ]
- [ sqrt(y + 1) sqrt(y + 1) + y + 1 ]
- [ -------------- ----------------------- ]
- [ 3 2 3 ]
- [ 2*(y + 1) 2*y *(y + 1) ]
- [ ]
- [ 3 3 3 ]
- [ - sqrt(y + 1) - sqrt(y + 1) + y + 1 ]
- [----------------- --------------------------]
- [ 3 2 3 ]
- [ 2*(y + 1) 2*y *(y + 1) ]
- }
- test(answer,A);
- Seems O.K.
- A := mat((-12752,-6285,-9457,-7065,-4939,-5865,-3769),(13028,6430,
- 9656, 7213,5041,5984,3841),(16425,8080,12192,9108,6370,7569,
- 4871), (-6065,-2979,-4508,-3364,-2354,-2801,-1803),(2968,
- 1424,2231, 1664,1171,1404,919),(-22762,-11189,-16902,-12627,
- -8833, -10498,-6760),(23112,11400,17135,12799,8946,10622,
- 6821));
- [-12752 -6285 -9457 -7065 -4939 -5865 -3769]
- [ ]
- [13028 6430 9656 7213 5041 5984 3841 ]
- [ ]
- [16425 8080 12192 9108 6370 7569 4871 ]
- [ ]
- a := [-6065 -2979 -4508 -3364 -2354 -2801 -1803]
- [ ]
- [ 2968 1424 2231 1664 1171 1404 919 ]
- [ ]
- [-22762 -11189 -16902 -12627 -8833 -10498 -6760]
- [ ]
- [23112 11400 17135 12799 8946 10622 6821 ]
- on rounded;
- J := first jordan(A);
- *** Domain mode rounded changed to rational
- *** Domain mode rational changed to complex-rational
- *** Domain mode complex-rational changed to rational
- *** Domain mode rational changed to rounded
- j := mat((1.41421356237,0,0,0,0,0,0),
- (0, - 1.41421356237,0,0,0,0,0),
- (0,0, - 1.80492,0,0,0,0),
- (0,0,0, - 1.12491,0,0,0),
- (0,0,0,0,1.03589*i + 0.620319,0,0),
- (0,0,0,0,0, - 1.03589*i + 0.620319,0),
- (0,0,0,0,0,0,1.68919))
- off rounded;
- %
- % Extend algebraic field.
- %
- % load_package arnum;
- defpoly b^3-2*b+b-5;
- A := mat((1-b,2+b^2),(3+b-2*b^2,3));
- [ 2 ]
- [ - (b - 1) b + 2]
- a := [ ]
- [ 2 ]
- [ - (2*b - b - 3) 3 ]
- J := first jordan(A);
- 1 2
- j := mat((---*(sqrt(11*b + 24*b - 48)*i - (b - 4)),0),
- 2
- 1 2
- (0, - ---*(sqrt(11*b + 24*b - 48)*i + b - 4)))
- 2
- off arnum;
- end;
- Time for test: 62953 ms, plus GC time: 1061 ms
|