Re: A question of matrix multiply, who can solve it?

*To*: mathgroup at smc.vnet.net*Subject*: [mg25677] Re: A question of matrix multiply, who can solve it?*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Thu, 19 Oct 2000 04:35:09 -0400 (EDT)*Organization*: Universitaet Leipzig*References*: <8sjkht$g2h@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hmm, More strange things happends Dot[A,B] are not the same as Outer[Times,A,B} and different form A*B. So what can we do in this situation ? First of all we should look what "multiply" with tensors mean. It *is* terrible that tensors can multiplyed in three different ways. If you wish to calculate the inner product you should use A.B If you wish a element wise multiply Times[] or A*B is needed. If you wish to calculate the outer product Outer[] may help. Since it is not clear what kind of multiplication you want, no one can say if you output is correct. Regards Jens Chen Jisheng wrote: > > Dear Sir, > > As a beginning user, I find a mistake of Mathematic 4.0(/3.0 for student). > > That is about the multipy method of matrix. > > For example, as I input the two matrices: > > A={a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5]} > {a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5]} > {a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5]} > {a[4, 1], a[4, 2], a[4, 3], a[4, 4], a[4, 5]} > {a[5, 1], a[5, 2], a[5, 3], a[5, 4], a[5, 5]}, > B={{b[1, 1], b[1, 2], b[1, 3], b[1, 4], b[1, 5]}, > > {b[2, 1], b[2, 2], b[2, 3], b[2, 4], b[2, 5]}, > > {b[3, 1], b[3, 2], b[3, 3], b[3, 4], b[3, 5]}, > > {b[4, 1], b[4, 2], b[4, 3], b[4, 4], b[4, 5]}, > > {b[5, 1], b[5, 2], b[5, 3], b[5, 4], b[5, 5]}}, > > then calculate the result of A B. The mathematics gives the following > result: > > A B={{a[1, 1] b[1, 1], a[1, 2] b[1, 2], a[1, 3] b[1, 3], > > a[1, 4] b[1, 4], a[1, 5] b[1, 5]}, > > {a[2, 1] b[2, 1], a[2, 2] b[2, 2], a[2, 3] b[2, 3], > > a[2, 4] b[2, 4], a[2, 5] b[2, 5]}, > > {a[3, 1] b[3, 1], a[3, 2] b[3, 2], a[3, 3] b[3, 3], > > a[3, 4] b[3, 4], a[3, 5] b[3, 5]}, > > {a[4, 1] b[4, 1], a[4, 2] b[4, 2], a[4, 3] b[4, 3], > > a[4, 4] b[4, 4], a[4, 5] b[4, 5]}, > > {a[5, 1] b[5, 1], a[5, 2] b[5, 2], a[5, 3] b[5, 3], > > a[5, 4] b[5, 4], a[5, 5] b[5, 5]}}. > > As all knows, this is not correct. I think it is terrible. > > Do you think so? How can improve it? > > Looking forward to receiving the reply. > > J.-S CHen, > Institute of Particle Physics, > Hua-Zhong Normal University, > Wuhan 430079,China