Re: Don't want to calculate scalar product
- To: mathgroup at smc.vnet.net
- Subject: [mg19721] Re: Don't want to calculate scalar product
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 13 Sep 1999 02:40:55 -0400
- References: <7ree45$489@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Toshiyuki (Toshi) Meshii <meshii at mech.fukui-u.ac.jp> wrote in message news:7ree45$489 at smc.vnet.net... > Hi, > > I understand that one of the unique point of Mathematica is that you don't > have to be conscious about whether a vector is a "row" or a "column" vector. > > However, I think there is a case in which you have to specify whether you > want Mathematica to recognize a vector as a row vector or a column vector. > Let me explain my case. > > a={1,2,3}; b={4,5,6} > > I want to define "a" as a column vector (3x1 matrix) and "b" as a row vector > (1x3 matrix). > > I expect the product > a.b > as a 3x3 matrix, but the answer Mathematica gives is a scalar product "32". > > Please give me an advice to get the 3x3 matrix as a product. > > -Toshi > Toshi, Make a into a 1x3 matrix an b into a 3x1 matrix : a = {1, 2, 3}; b = {4, 5, 6}; List /@ a .{b} {{4, 5, 6}, {8, 10, 12}, {12, 15, 18}} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565