Re: MatrixForm affects values instead of only printing
- To: mathgroup at smc.vnet.net
 - Subject: [mg100318] Re: [mg100298] MatrixForm affects values instead of only printing
 - From: "A. B." <functionalcoatings at gmail.com>
 - Date: Mon, 1 Jun 2009 07:05:48 -0400 (EDT)
 
The same holds for TableForm. I have already noticed this. It seems a bit
strange, given that "TableForm (MatrixForm) acts as a "wrapper", which
affects printing, but not evaluation."
In[194]:= list1 = {{1, 2, 3, 4}, {5, 6, 7, 8}}
Out[194]= {{1, 2, 3, 4}, {5, 6, 7, 8}}
In[195]:= Part[list1, All, 2]
Out[195]= {2, 6}
And...
In[196]:= list1 = {{1, 2, 3, 4}, {5, 6, 7, 8}} // TableForm
1    2    3    4
5    6    7    8
Part[list1, All, 2]
5
6
7
8
A.B.
> Here is the example:
> 
> test1={-3, 7, 5}
> test1[[3]]
> 
> returns the list and 5 as expected;
> 
> test2={-3, 7, 5}//MatrixForm
> test2[[3]]
> 
> returns a column vector and error: "part 3 of blah blah doesn't exist". The
> actual list itself is test2[[1]]. To get the right 3rd element I have to do:
> 
> test2[[1,3]]
> 
> which returns 5 as expected.
> 
> 
> The problem is MatrixForm is NOT supposed to change the expression it is
> applied on according to the manual. Is that a bug or there's logical
> explanation?
>