Re: A question of matrix multiply, who can solve it?
- To: mathgroup at smc.vnet.net
- Subject: [mg25703] Re: [mg25671] A question of matrix multiply, who can solve it?
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Thu, 19 Oct 2000 04:35:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Not so terrible. If you want to multiply matrices you must use "Dot". "Dot" is the notation for matrix multiplication in Mathematica (The Book, p.841). For example, try In[1]:= Array[A, {3, 3}].Array[B, {3, 3}] (please notice the dot "." between the two arrays indicating multiplication), which may be written also as In[12]:= Dot[Array[A, {3, 3}], Array[B, {3, 3}]] Out[12]= {{A[1, 1] B[1, 1] + A[1, 2] B[2, 1] + A[1, 3] B[3, 1], A[1, 1] B[1, 2] + A[1, 2] B[2, 2] + A[1, 3] B[3, 2], A[1, 1] B[1, 3] + A[1, 2] B[2, 3] + A[1, 3] B[3, 3]}, {A[2, 1] B[1, 1] + A[2, 2] B[2, 1] + A[2, 3] B[3, 1], A[2, 1] B[1, 2] + A[2, 2] B[2, 2] + A[2, 3] B[3, 2], A[2, 1] B[1, 3] + A[2, 2] B[2, 3] + A[2, 3] B[3, 3]}, {A[3, 1] B[1, 1] + A[3, 2] B[2, 1] + A[3, 3] B[3, 1], A[3, 1] B[1, 2] + A[3, 2] B[2, 2] + A[3, 3] B[3, 2], A[3, 1] B[1, 3] + A[3, 2] B[2, 3] + A[3, 3] B[3, 3]}} No mistake. Tomas Garza Mexico City "Chen Jisheng" <chenjs at iopp.ccnu.edu.cn> wrote: > 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?