Sponsored links: Algebra eBooks
 

Related

local

Run Example
(%i1)det(M):=block(local(D, R),               R:0,               D:matrix_size(M)[1],               block(local(J),for J:1 thru D do                    block(local(I, P),                           P:1,                           for I:0 thru (D-1) do                              P:P*(if (J+I) >
 D then M[J+I-D,I+1] else M[J+I,I+1]),                          R:R+P),                    block(local(I, P),                           P:1,                           for I:0 thru (D-1) do                              P:P*(if (J-I) <
 1 then M[J-I+D,I+1] else M[J-I,I+1]),                          R:R-P)                    ),              R);
(%o1) det(M) := block(local(D, R), R : 0, D : matrix_size(M) , 
                                                            1
block(local(J), for J thru D do block(local(I, P), P : 1, 
for I from 0 thru D - 1 do P : P (if J + I > D then M
                                                     J + I - D, I + 1
 else M            ), R : R + P), block(local(I, P), P : 1, 
       J + I, I + 1
for I from 0 thru D - 1 do P : P (if J - I < 1 then M
                                                     J - I + D, I + 1
 else M            ), R : R - P)), R)
       J - I, I + 1
(%i2)  det(matrix([a,b],[c,d]));
(%o2) - (if J - 1 < 1 then M         else M        )
                            J + 1, 2       J - 1, 2
                               (if J < 1 then M         else M    ) + a d + b c
                                               J + 2, 1       J, 1
(%i3) 
Run Example
simp:true;
(%o1)                                true
(%i2) show(L)::=block(local(simp), simp:false, return(block(buildq([L], first([L[1]/L[2]])))));
(%o2) show(L) ::= block(local(simp), simp : false, 
                                                                       L
                                                                        1
                                       return(block(buildq([L], first([--])))))
                                                                       L
                                                                        2
(%i3) L:[0, 1];
(%o3)                               [0, 1]
(%i4) R:[1, 0];
(%o4)                               [1, 0]
(%i5) k:[L, L+R, R];
(%o5)                      [[0, 1], [1, 1], [1, 0]]
(%i6) h:[L, 2*L+R, L+R, L+2*R, R];
(%o6)              [[0, 1], [1, 2], [1, 1], [2, 1], [1, 0]]
(%i7) n:[L, 3*L+R, 2*L+R, L+R, L+2*R, L+3*R, R];
(%o7)      [[0, 1], [1, 3], [1, 2], [1, 1], [2, 1], [3, 1], [1, 0]]
(%i8) show(L);
                                       0
(%o8)                                  -
                                       1
(%i9) show(R);
                                       1
(%o9)                                  -
                                       0
(%i10) map(show, (L+R));
                                     0   1
(%o10)                               - + -
                                     1   0
(%i11) block([m:[]], for i in k do (m:append(m, [show(i)])), return(m));
                                    0  1  1
(%o11)                             [-, -, -]
                                    1  1  0
(%i12) block([m:[]], for i in h do (m:append(m, [show(i)])), return(m));
                                 0  1  1  2  1
(%o12)                          [-, -, -, -, -]
                                 1  2  1  1  0
(%i13) block([m:[]], for i in n do (m:append(m, [show(i)])), return(m));
                              0  1  1  1  2  3  1
(%o13)                       [-, -, -, -, -, -, -]
                              1  3  2  1  1  1  0
(%i14) simp;
(%o14)                               false
(%i15) 
Run Example
simp:true;
(%o1)                                true
(%i2) show(L)::=block(local(simp), simp:false, block(buildq([L], first([L[1]/L[2]]))));
(%o2) show(L) ::= block(local(simp), simp : false, 
                                                                        L
                                                                         1
                                               block(buildq([L], first([--]))))
                                                                        L
                                                                         2
(%i3) L:[0, 1];
(%o3)                               [0, 1]
(%i4) R:[1, 0];
(%o4)                               [1, 0]
(%i5) k:[L, L+R, R];
(%o5)                      [[0, 1], [1, 1], [1, 0]]
(%i6) h:[L, 2*L+R, L+R, L+2*R, R];
(%o6)              [[0, 1], [1, 2], [1, 1], [2, 1], [1, 0]]
(%i7) n:[L, 3*L+R, 2*L+R, L+R, L+2*R, L+3*R, R];
(%o7)      [[0, 1], [1, 3], [1, 2], [1, 1], [2, 1], [3, 1], [1, 0]]
(%i8) show(L);
                                       0
(%o8)                                  -
                                       1
(%i9) show(R);
                                       1
(%o9)                                  -
                                       0
(%i10) map(show, (L+R));
                                     0   1
(%o10)                               - + -
                                     1   0
(%i11) block([m:[]], for i in k do (m:append(m, [show(i)])), return(m));
                                    0  1  1
(%o11)                             [-, -, -]
                                    1  1  0
(%i12) block([m:[]], for i in h do (m:append(m, [show(i)])), return(m));
                                 0  1  1  2  1
(%o12)                          [-, -, -, -, -]
                                 1  2  1  1  0
(%i13) block([m:[]], for i in n do (m:append(m, [show(i)])), return(m));
                              0  1  1  1  2  3  1
(%o13)                       [-, -, -, -, -, -, -]
                              1  3  2  1  1  1  0
(%i14) simp;
(%o14)                               false
(%i15) 

Related Help

Help for Local