Re: MatrixForm affects values instead of only printing
- To: mathgroup at smc.vnet.net
- Subject: [mg100333] Re: [mg100298] MatrixForm affects values instead of only printing
- From: "Scot T. Martin" <smartin at seas.harvard.edu>
- Date: Mon, 1 Jun 2009 07:08:37 -0400 (EDT)
- References: <200905311035.GAA16937@smc.vnet.net>
The issue is that in FullForm[], you have created:
MatrixForm[List[-3,7,5]]
So now you can see why Part[xxx,3] does not work. You would have to do
Part[xxx,1,3] to get your desired result.
On Sun, 31 May 2009, summer wrote:
> 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?
>
>