Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly

  • To: mathgroup at
  • Subject: [mg110224] Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly
  • From: telefunkenvf14 <rgorka at>
  • Date: Wed, 9 Jun 2010 07:20:13 -0400 (EDT)
  • References: <hul8bp$ifh$>

On Jun 8, 6:08 am, Bill Rowe <readn... at> wrote:
> On 6/7/10 at 8:08 AM, rgo... at (telefunkenvf14) wrote:
> >Can someone explain why a list does not display in MatrixForm as a
> >row?---It's ok if the answer is computer sciency. I'll take some
> >advil before I attempt to digest any answers. :)
> Because a 1D list is not defined as either a row nor a column.
> An example of something that displays as a row in MatrixForm
> would be
> {Range[4]}
> Alternatively, something that displays as a column in MatrixForm is:
> List/@Range[4]
> But note:
> In[4]:= MatrixQ /@ {{Range[4]}, List /@ Range[4]}
> Out[4]= {True,True}
> That is, both of these constructs are seen as matrices by
> Mathematica and displayed appropriately by MatrixForm.
> Also, notice
> In[5]:= a = Range[4];
> b = RandomInteger[1, {4, 4}];
> In[8]:= b.a
> Out[8]= {3,1,8,7}
> In[9]:= a.b
> Out[9]= {10,5,3,7}
> showing it is up to you to determine whether a 1D list should be
> interpreted as a column vector or row vector.

Thanks for the answers. To start with, I'll modify David Park's

In[1]:= vector=Range[5];

Out[2]//MatrixForm= (1	2	3	4	5)
Out[3]= {5}

Now the same thing with TableDirections->Column:

In[4]:= vector=Range[5];

Out[6]= {5}

What's confusing is that the displayed (standard form) output in the
first case *looks like* a 1x5 matrix and the second case *looks like*
a 5x1. However, one cannot simply perform matrix operations on these
forms and get the expected output, as Mathematica simply maintains the
dimensions {5} assumption corresponding to the underlying list.

Further confusing is the fact that, if I click in the output cell and
hit space, Mathematica 'interprets the output to input'. If I follow
this by //Dimensions, I again get {5}. For comparison, if I now go to Insert-
>Table/Matrix->New->Matrix, I can create a StandardForm matrix that
*looks* identical, but clearly is not. (as following this new input
with //Dimensions gives the expected {5,1} or {1,5} result.

I guess what I wish Mathematica did (or was expecting Mathematica to
do) by default was have the TableDirections option, TableDirections->Row or
TableDirections->Column, automatically generate the same 5x1 or 1x5
structure. If I had to explain this behavior to new/prospective users,
I'd have difficulties--and that's the main reason I'm asking the
question, BTW. ("...things that look the same, may not, in fact, be
the same...")

Humbly: Perhaps this behavior could be improved upon--or would
altering the behavior break other functionality?


  • Prev by Date: Re: How to navigate the documentation?
  • Next by Date: Re: PDE, laplace, exact, should be simple...
  • Previous by thread: Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly
  • Next by thread: Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly