Re: MatrixForm affects values instead of only printing
- To: mathgroup at smc.vnet.net
- Subject: [mg100368] Re: [mg100298] MatrixForm affects values instead of only printing
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Tue, 2 Jun 2009 06:42:12 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200905311035.GAA16937@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Nothing wrong or inconsistent there. Look at: FullForm[test2] MatrixForm[List[-3,7,5]] Then, as expected: test2[[1]] {-3,7,5} And so the 3rd element of that is... test2[[1]][[3]] 5 ... which is the same result as from: test2[[1, 3]] The MatrixForm is still lurking there, as you'll see if you evaluate: Head[test2] MatrixForm Nothing has "changed"! 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? > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305