Mathematica 9 is now available
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 smc.vnet.net
  • Subject: [mg110251] Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 10 Jun 2010 08:08:59 -0400 (EDT)

On 6/9/10 at 7:20 AM, rgorka at gmail.com (telefunkenvf14) wrote:

>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
>>>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
>reply:

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

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

>Now the same thing with TableDirections->Column:

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

>In[4]:= vector=Range[5];
>xPrime=MatrixForm[vector,TableDirections->Column]
>%//Dimensions
>
>Out[5]//MatrixForm=
>(
>1
>2
>3
>4
>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.

Right. That is the point of MatrixForm. It puts a wrapper around
the list and causes it to *display*  (look like) what you want.
But MatrixForm in no way makes the list a column or row vector.

While I also prefer the appearance of matrices displayed by
MatrixForm, I never use MatrixForm. Instead, I have my
preferences set to display output cells in TraditionalForm. That
way, something that displays as a 5 x 1 array is a 5 x 1 array.



  • Prev by Date: Re: difficulty using FindRoot
  • Next by Date: Re: Export
  • 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