Re: bug in InputForm (Mathematica 9)?
- To: mathgroup at smc.vnet.net
- Subject: [mg132503] Re: bug in InputForm (Mathematica 9)?
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Thu, 3 Apr 2014 02:16:41 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140327085954.1A3806A26@smc.vnet.net>
Do not include the "Form" when setting the value of the symbol. MatrixForm[a={{1,2},{3,4}}] (1 2 3 4 ) (a={{1,2},{3,4}})//MatrixForm (1 2 3 4 ) To automaticly apply MatrixForm $Post=If[MatrixQ[#],MatrixForm[#],#]&; a (1 2 3 4 ) To clear $Post $Post=. Bob Hanlon On Wed, Apr 2, 2014 at 2:36 AM, Szabolcs Horv=E1t <szhorvat at gmail.com> wrot= e: > note: also sent to comp.soft-sys.math.mathematica > > On 2014-3-28, 3:30 , Itai Seggev wrote: > >> Put the following into a notebook cell: > >> > >> InputForm[1] > >> InputForm[2] > >> "test" > >> > >> Evaluate the cell. Only one of the InputForm commands produces output= , > and > >> that output comes after "test". > >> > >> I am guessing these behaviors are not intended ... > >> > >> Alan Isaac > > > > An old and well known bug, at least to those of us who work on > Mathematica' s > > input/output system. :) Not as trivial to fix as you might think, > because > > doing InputForm[foo] in a notebook lives in this strange world which is > half > > command-line terminal and half notebook interface, and so wires can get > > crossed easily. > > > > Marginally related to this, I'm curious how all these *Form functions wor= k. > > MatrixForm has this slightly confusing property: > > In[1]:= a=MatrixForm[{{1,2},{3,4}}] > Out[1]//MatrixForm= > (1 2 > 3 4) > > In[2]:= Head[a] > Out[2]= MatrixForm > > In[3]:= Head[%1] > Out[3]= List > > 'a' cannot be used as a matrix because it is wrapped in MatrixForm. But > MarixForm is stripped before the expression is assgined to Out[1]. It > is also indicated (using Out[1]//MatrixForm) that the output is shown in > a special form. > > How does MatrixForm achieve this, i.e. that it gets stripped from the > output and that it's shown in the cell label? Is there a general, > user-accessible mechanism for this? Can I create my own "form-function" > that behaves like this? > > Szabolcs > >