Re: MatrixForm odd behaviour

*To*: mathgroup at smc.vnet.net*Subject*: [mg124491] Re: MatrixForm odd behaviour*From*: roby <roby.nowak at gmail.com>*Date*: Sat, 21 Jan 2012 05:19:03 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <jf8q80$3iv$1@smc.vnet.net> <jfb3b0$hsm$1@smc.vnet.net>

Dear All. One can argue a thousend times or even more that MatrixForm is for display purpose only. On the other hand the user majority (is this a democratic process ?) would like to have the possibility to use MatrixForm or a similar "Wrapper" in calculations. The strange and funny thing is that matrices entered by <Insert><Table/ Matrix><New> provide a Form similar to MatrixForm which can be used in calculations. We just neeed a Wrapper for Display which should be ignored for calculations, this would ease many things. So the only thing we need is a simple way to apply the fuctionality provided from matrix input menu to Mathematica matrix expressions, may be this exists allready and I just missed soemthing ? Cheers Robert On 20 Jan., 07:58, "Oleksandr Rasputinov" <oleksandr_rasputi... at hmamail.com> wrote: > On Thu, 19 Jan 2012 10:11:12 -0000, roby <roby.no... at gmail.com> wrote: > > Dear Group > > > As a similar Question is discussed on the group now. > > > The following issue: > > > When entering e.g.: > > Dot[MatrixForm[{{1, 0}, {0, 2}}], MatrixForm[{{1, 0}, {0, 2}}]] > > Mathematica does not evaluate the Dot operation and displays the two > > unchanged > > input matrices seperated by a "Dot" each respectively wrapped by > > MatrixForm, so far so good (or perhaps not so good). > > > But if one now marks the most recent Mathematica output, the two "Dot" > > seperated matrices and copy and paste's them into a new Mathematica > > cell, > > both matrices still are seperated By "Dot", still looking like two > > MatrixForm wrapped matrices. > > But if you now evaluate the new cell guess what happens: the Dot > > operation is performed (despite both matrices seem to be wrapped by > > MatrixForm) and the result is displayed (of course not matrixForm > > wrapped) > > > seems highly inconsistent, or ? > > > other funny things to try: > > TraditionalForm[2] * TraditionalForm[2] > > or: > > Times[TraditionalForm[2], TraditionalForm[2]] > > > Cheers Robert > > Perhaps a bit obscure, but not (in my opinion) all that inconsistent when > one understands how these things work. > > This behaviour comes about because the TagBox generated when MatrixForm is > typeset for output is re-interpreted when given as input. However, > MatrixForm does not get converted into a TagBox (unless this is done > manually) except when it is typeset for output (the documentation usually > contains phrases like "prints with..." for functions of this sort), so > when given in an ordinary expression it stays where it is and can get in > the way of operations on expressions wrapped with it. For example, doing > the same thing manually: > > In := > boxes = ToBoxes@MatrixForm@IdentityMatrix[3] > > Out = > < ugly box expression elided > > > In := > (* ToExpression interprets both strings and boxes *) > ToExpression[boxes] > > Out = > {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} > > One could perhaps argue that the statement in the documentation that > "MatrixForm acts as a "wrapper", which affects printing, but not > evaluation" is somewhat misleading as it is only true in a fairly narrow > sense.