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

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

```On Jun 8, 6:08 am, Bill Rowe <readn... at sbcglobal.net> wrote:
> On 6/7/10 at 8:08 AM, rgo... at gmail.com (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
>
> 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}
>
> Alternatively, something that displays as a column in MatrixForm is:
>
> List/@Range
>
> But note:
>
> In:= MatrixQ /@ {{Range}, List /@ Range}
>
> Out= {True,True}
>
> That is, both of these constructs are seen as matrices by
> Mathematica and displayed appropriately by MatrixForm.
>
> Also, notice
>
> In:= a = Range;
> b = RandomInteger[1, {4, 4}];
>
> In:= b.a
>
> Out= {3,1,8,7}
>
> In:= a.b
>
> Out= {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.

In:= vector=Range;
MatrixForm[vector,TableDirections->Row]
%//Dimensions

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

Now the same thing with TableDirections->Column:

In:= vector=Range;
xPrime=MatrixForm[vector,TableDirections->Column]
%//Dimensions

Out//MatrixForm=
(
1
2
3
4
5
)
Out= {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?

-RG

```

• 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