[Maxima] What's wrong with this code II

David Ronis ronis at ronispc.chem.mcgill.ca
Wed May 9 20:58:23 CDT 2007


Well now that the display problem is fixed in CVS I went back to the
problem I was really trying to solve:

s[0]:matrix([1,0],[0,1]);
s[1]:matrix([1,0],[0,-1]);
s[2]:matrix([0,1],[1,0]);
s[3]:matrix([0,%i],[-%i,0]);

array(b,4);
array(a,4,4);

for i:0 thru 4 do
block ( scalar(b[i]),
  for j:0 thru 4 do
  scalar(a[i,j])
  );

bb:0;

for i:0  thru 3 do
   bb:bb+b[i]*s[i];

for i:1 thru 3 do
block( aa[i]:0,
  for j:0 thru 3 do
  aa[i]:aa[i]+a[i,j]*s[j]
  );
            
aa[1].bb$
ratsimp(%)

Which gives 
	      [ 1  0 ]	       [ 1   0  ]	  [  0	  %i ]
(%o12) (a     [      ] + a     [        ] + a	  [ 	     ]
	 1, 0 [ 0  1 ]	  1, 1 [ 0  - 1 ]    1, 3 [ - %i  0  ]
	 [ 0  1 ]	 [ 1  0 ]      [ 1   0  ]      [  0    %i ]
 + a     [      ]) . (b  [      ] + b  [        ] + b  [ 	  ]
    1, 2 [ 1  0 ]      0 [ 0  1 ]    1 [ 0  - 1 ]    3 [ - %i  0  ]
      [ 0  1 ]
 + b  [      ])
    2 [ 1  0 ]

This isn't right, or rather it is right, but useless (This should give a
2x2 matrix whose elements contain a[1,j]*b[j'].  It seems that it is
assuming noncommutative algebra for the a's and b's.  I tried adding the
scalar definitions as shown above, but this didn't seem to help.
Similarly, moving the scalar define loops elsewhere didn't help.




More information about the Maxima mailing list