Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Row vs. Column Vectors (or Matrices)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33928] Re: [mg33908] Row vs. Column Vectors (or Matrices)
  • From: Murray Eisenberg <murraye at attbi.com>
  • Date: Tue, 23 Apr 2002 07:14:08 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200204220457.AAA02121@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

It's not clear from your message whether you merely want to display a
"row vector" or to create one (these are different issues).  Moreover,
the very notion of "row vector" is ambiguous (at least in ordinary
mathematical parlance!).  

You can represent an ordinary vector in Mathematica as a list (which is
a one-dimensional creature):

  v = {1, 2, 3}

Or you can represent it as a list whose sole element is a list (which is
essentiall a two-dimensional creature):

  vRow = {{1, 2, 3}}

Then using MatrixForm[v]  will produce a "stacked" column 3-rows high! 
But using MatrixForm[vRow] will produce probably what you want to SEE:

  (1 2 3)

You wrote " * " for the operation combining these two vectors.  Do you
mean "dot product"?  If so, then this is abbreviated by " . " in
Mathematica.  Thus:

  v . w
14

Unfortunately the following creates an error:

  vRow . wRow
Dot::"dotsh": "Tensors ({{1, 2, 3})} and ({4, 5, 6})} have incompatible
shapes."

However:

  vRow . Transpose[wRow]
{{32}}

And the latter agrees perfectly with the true definition of dot product,
in mathematics, of a 1-by-3 matrix with a 3-by-1 matrix, which yields a
1-by-1 matrix (and NOT a scalar).

You see that ordinary mathematical notation gets a bit sloppy about
these distinctions, whereas an executable notation such as Mathematica
must be very precise.


John Resler wrote:
> 
> Hi,
>     I'm new to Mathematica and am doing a little linear algebra. I am
> aware of the MatrixForm[m]
> function but I know of no way to create a row vector eg. [ 1.0  2.0  3.0
> ] *   [ 1.0
> 
>                                                2.0
> 
>                                                3.0].
> 
> Can someone point me in the right direction? Thanks ahead of time.
> 
> -John

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.       
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street
Amherst, MA 01375


  • Prev by Date: DSolve solution validation
  • Next by Date: Re: Re: Using NonlinearFit/Regress?
  • Previous by thread: Row vs. Column Vectors (or Matrices)
  • Next by thread: Re: Row vs. Column Vectors (or Matrices)