For what it's worth, I don't think there's a built-in direct matrix product
in Maxima, but you can easily define your own solution. For instance, I
believe the following function will do what you expect:
directprod(A,B):=([P],
IF NOT (MATRIXP(A) AND MATRIXP(B)) THEN
ERROR("Invalid arguments to DIRECTPROD()")
ELSE
(
P:ZEROMATRIX(LENGTH(A)*LENGTH(A[1]),LENGTH(B)*LENGTH(B[1])),
FOR i THRU LENGTH(A) DO
FOR j THRU LENGTH(A[1]) DO
FOR k THRU LENGTH(B) DO
FOR l THRU LENGTH(B[1]) DO
P[(i-1)*LENGTH(A[1])+j,(k-1)*LENGTH(B[1])+l]:A[i,j]*B[k,l],
P
)
);
An example:
(%i1) A:MATRIX([a11,a12],[a21,a22]);
[ a11 a12 ]
(%o1) [ ]
[ a21 a22 ]
(%i2) B:MATRIX([b11,b12,b13,b14],[b21,b22,b23,b24],[b31,b32,b33,b34]);
[ b11 b12 b13 b14 ]
[ ]
(%o2) [ b21 b22 b23 b24 ]
[ ]
[ b31 b32 b33 b34 ]
(%i3) directprod(A,B);
[ a11 b11 a11 b12 a11 b13 a11 b14 a11 b21 a11 b22 a11 b23 a11
b24 a11 b31 a11 b32 a11 b33 a11 b34 ]
[
]
[ a12 b11 a12 b12 a12 b13 a12 b14 a12 b21 a12 b22 a12 b23 a12
b24 a12 b31 a12 b32 a12 b33 a12 b34 ]
(%o3) [
]
[ a21 b11 a21 b12 a21 b13 a21 b14 a21 b21 a21 b22 a21 b23 a21
b24 a21 b31 a21 b32 a21 b33 a21 b34 ]
[
]
[ a22 b11 a22 b12 a22 b13 a22 b14 a22 b21 a22 b22 a22 b23 a22
b24 a22 b31 a22 b32 a22 b33 a22 b34 ]
Viktor
-----Original Message-----
From: maxima-admin@math.utexas.edu [mailto:maxima-admin at math] On
Behalf Of richard n. fell
Sent: Saturday, August 28, 2004 6:50 AM
To: go_furuya@infoseek.jp
Cc: maxima@math.utexas.edu
Subject: Re: [Maxima] direct product
Gosie -
Thanks for your reply. Unfortunately, this is not the direct product.
Dick Fell
go_furuya@infoseek.jp wrote:
hi
That is posiible.
for example
(C1) load(diag);
(D1) /usr/local/share/maxima/5.9.0/share/contrib/diag.mac
(C2) diag([matrix([a0,a1],[a2,a3]),matrix([b1,b2],[b3,b4])]);
[ a0 A1 0 0 ]
[ ]
[ A2 A3 0 0 ]
(D2) [ ]
[ 0 0 B1 B2 ]
[ ]
[ 0 0 b3 b4 ]
diag(x),x is list of numbers,or list of matrix.
Gosei Furuya
Is there a maxima share package that computes the direct
product of
matrices? (I can not find any in my maxima).
Thanks,
Dick Fell
--
Richard N. Fell
Martin Fisher School of Physics
Brandeis University
Waltham, Ma 02454
fell@brandeis.edu
_______________________________________________
Maxima mailing list
Maxima@www.math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
------------------------------------------------------------------------
?????????????????????? by infoseek
http://ap.infoseek.co.jp/gr9.html
--
Richard N. Fell
Martin Fisher School of Physics
Brandeis University
Waltham, Ma 02454
fell@brandeis.edu
_______________________________________________ Maxima mailing list
Maxima@www.math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima