From: telefunkenvf14 on
Group:

I'm trying to understand the *reasoning* behind Mathematica's treatment of
lists, rows and columns. Basically, I feel like I'm in a weird place---
I get what's going on well enough to translate various econometric
examples, but I wouldn't be able to clearly explain Mathematica's behavior to
someone previously exposed to matrix programming in Gauss, SAS IML,
etc.

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

-RG

From: Jagra on
{a,b,c,d} // MatrixForm
{{a,b,c,d}} // MatrixForm

The following doesn't work, because one can't transpose a one
directional object.

Transpose[{a,b,c,d}] // MatrixForm

The following as a matrix will transpose:

Transpose[{{a,b,c,d}}] // MatrixForm

Just some clues that help it all begin to make sense.

From: David Park on
What about:

vector = Range[5];
MatrixForm[vector, TableDirections -> Row]

(1 2 3 4 5 )


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/


From: telefunkenvf14 [mailto:rgorka(a)gmail.com]


Group:

I'm trying to understand the *reasoning* behind Mathematica's treatment of
lists, rows and columns. Basically, I feel like I'm in a weird place---
I get what's going on well enough to translate various econometric
examples, but I wouldn't be able to clearly explain Mathematica's behavior
to
someone previously exposed to matrix programming in Gauss, SAS IML,
etc.

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

-RG



From: Bill Rowe on
On 6/7/10 at 8:08 AM, rgorka(a)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.


From: Kevin J. McCann on
However,

a = Range[5]
a.a gives the dot product, but Transpose[a].a doesn't work. Since I do
this a lot, I agree with the sense of the original post that some of the
matrix/vector operations are not very user friendly.

Kevin

David Park wrote:
> What about:
>
> vector = Range[5];
> MatrixForm[vector, TableDirections -> Row]
>
> (1 2 3 4 5 )
>
>
> David Park
> djmpark(a)comcast.net
> http://home.comcast.net/~djmpark/
>
>
> From: telefunkenvf14 [mailto:rgorka(a)gmail.com]
>
>
> Group:
>
> I'm trying to understand the *reasoning* behind Mathematica's treatment of
> lists, rows and columns. Basically, I feel like I'm in a weird place---
> I get what's going on well enough to translate various econometric
> examples, but I wouldn't be able to clearly explain Mathematica's behavior
> to
> someone previously exposed to matrix programming in Gauss, SAS IML,
> etc.
>
> 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. :)
>
> -RG
>
>
>