MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MatrixForm affects values instead of only printing


You included MatrixForm as part of the definition of test2

test2 = {-3, 7, 5} // MatrixForm

MatrixForm[{-3, 7, 5}]

?test2

Global`test2

test2=MatrixForm[{-3,7,5}]


You want MatrixForm applied to the output not the definition, i.e.,

(test2 = {-3, 7, 5}) // MatrixForm

MatrixForm[{-3, 7, 5}]

?test2

Global`test2

test2={-3,7,5}


test2[[3]]

5


Bob Hanlon

---- summer <summertan at hotmail.com> 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?




  • Prev by Date: problem with reduce
  • Next by Date: Re: treatment on C[i]
  • Previous by thread: Re: MatrixForm affects values instead of only printing
  • Next by thread: Re: MatrixForm affects values instead of only printing