MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Don't want to calculate scalar product

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19743] Re: Don't want to calculate scalar product
  • From: Martin Kraus <Martin.Kraus at informatik.uni-stuttgart.de>
  • Date: Wed, 15 Sep 1999 03:52:59 -0400
  • Organization: Institut fuer Informatik, Universitaet Stuttgart
  • References: <7ree45$489@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Toshiyuki (Toshi) Meshii wrote:
> 
> 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.

Actually I always think of Mathematica lists as row vectors.
(Though some functions treat them as if they were column vectors. :)

> 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).

Well, just do it:

a={{1},{2},{3}}; b={{4,5,6}}; a.b

returns

{{4, 5, 6}, {8, 10, 12}, {12, 15, 18}}
 
> I expect the product
>  a.b
> as a 3x3 matrix, but the answer Mathematica gives is a scalar product "32".

product. 
The inner product is what "." calculates. For the outer product
use Outer[Times, a, b] with the vectors a and b:

a = {1, 2, 3}; b = {4, 5, 6}; Outer[Times, a, b]

{{4, 5, 6}, {8, 10, 12}, {12, 15, 18}}
 
> Please give me an advice to get the 3x3 matrix as a product.
> 
> -Toshi

Hope that helps

Martin Kraus


  • Prev by Date: Subject: Re: RE: Finding a relative prime
  • Next by Date: Re: RealTime3D in v4.0: Capabilities and compatibilities
  • Previous by thread: Re: Don't want to calculate scalar product
  • Next by thread: Re: Finding a relative prime (corrected)