Re: How to transpose vector?
- To: mathgroup at smc.vnet.net
- Subject: [mg14673] Re: How to transpose vector?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 8 Nov 1998 21:15:33 -0500
- References: <720th6$1vl@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nobuhiko Tamura wrote in message <720th6$1vl at smc.vnet.net>... >I have a problem about manupirating vectors. I wanted to make 3x3 >matrixtwo by using 3x1 vector alpha and beta. and I tried by > >>>Transpose[alpha].beta > >but it dosen't work. >Please tell me how to do it. > >Sorry for poor English. >Nobuhiko Tamura >@Chiba university >Japan > >Email-> ntamura at tky2.3web.ne.jp > Nabuhiko, It looks as if you want to use, what traditionally would be written (leaving out brackets) like a1 . (b1,b2,b3) = a1 b1, a1 b2, a1 b3 a2 a2 b1, a2 b2, a2 b3 a3 a3 b1, a3 b2, a3 b3 To get the same result with Mathematica we need {{a1}, {a2}, {a3}}. {{b1, b2, b3}} {{a1 b1, a1 b2, a1 b3}, {a2 b1, a2 b2, a2 b3}, {a3 b1, a3 b2, a3 b3}} or Transpose[{{a1, a2, a3}}].{{b1, b2, b3}} {{a1 b1, a1 b2, a1 b3}, {a2 b1, a2 b2, a2 b3}, {a3 b1, a3 b2, a3 b3}} *** In Mathematica a vector is simply a list like {a1,a2,a3} (and this cannot be transposed)***. To change it to a matrix form we can use List[{a1, a2, a3}] {{a1, a2, a3}} giving a 1 by 3 matrix or List/@{a1, a2, a3} {{a1}, {a2}, {a3}} giving a 3 by 1 matrix *** However, there is a way of getting the answer that you want directly from vectors***: Outer[Times, alpha, beta] {{a1 b1, a1 b2, a1 b3}, {a2 b1, a2 b2, a2 b3}, {a3 b1, a3 b2, a3 b3}} Allan, --------------------- Allan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565