Re: Transpose[A]*A wrong?
- To: mathgroup at smc.vnet.net
- Subject: [mg41193] Re: Transpose[A]*A wrong?
- From: Petr Kujan <kujanp at fel.cvut.cz>
- Date: Tue, 6 May 2003 06:07:56 -0400 (EDT)
- Organization: Czech Technical University
- References: <b950vl$r49$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Daniel Lidström wrote: >Hi, > >why does Mathematica give the wrong result here? > >In[1]:= \!\(A\ = \ {{x\_11, x\_12, x\_13}, {x\_21, x\_22, x\_23}, {x\_31, >x\_32, > x\_33}}\) > >Out[1]= {{x , x , x }, {x , x , x }, {x , x , x }} > 11 12 13 21 22 23 31 32 33 > >In[2]:= Transpose[A]*A > > 2 2 >2 >Out[2]= {{x , x x , x x }, {x x , x , x x }, {x x , x x >, x }} > 11 12 21 13 31 12 21 22 23 32 13 31 23 >32 33 > >Look at the diagonal elements for example. >Thanks! > >/Daniel > > > Hi Daniel, function - Times[ ] .. "*" -> array multiply, function - Dot[ ] .. "." -> matrix multiply. Now it's matrix multiply: In[9]:= \!\(A\ = \ {{x\_11, x\_12, x\_13}, {x\_21, x\_22, x\_23}, {x\_31, x\_32, x\_33}}\) Out[9]= \!\({{x\_11, x\_12, x\_13}, {x\_21, x\_22, x\_23}, {x\_31, x\_32, x\_33}}\) In[8]:= Transpose[A].A Out[8]= \!\({{x\_11\%2 + x\_21\%2 + x\_31\%2, x\_11\ x\_12 + x\_21\ x\_22 + x\_31\ x\_32, x\_11\ x\_13 + x\_21\ x\_23 + x\_31\ x\_33}, {x\_11\ x\_12 + x\_21\ x\_22 + x\_31\ x\_32, x\_12\%2 + x\_22\%2 + x\_32\%2, x\_12\ x\_13 + x\_22\ x\_23 + x\_32\ x\_33}, {x\_11\ x\_13 + x\_21\ x\_23 + x\_31\ x\_33, x\_12\ x\_13 + x\_22\ x\_23 + x\_32\ x\_33, x\_13\%2 + x\_23\%2 + x\_33\%2}}\) Petr