MathGroup Archive 1998

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

Search the Archive

Re: A Bug / Feature


  • To: mathgroup@smc.vnet.net
  • Subject: [mg12569] Re: A Bug / Feature
  • From: "P.J. Hinton" <paulh@wolfram.com>
  • Date: Mon, 25 May 1998 14:24:42 -0400
  • Organization: Wolfram Research, Inc.
  • References: <6k7e81$1n1@smc.vnet.net>

On 23 May 1998 Ersek_Ted%PAX1A@mr.nawcad.navy.mil wrote:

> I don't know if this is a bug or a feature, but I don't like what I get
> for {Head[expr], Head[%n]}  in the lines below!
> 
> In[1]:=
> m1=MatrixForm[{{1,2},{3,4}}]
> Out[1]//MatrixForm=
> (* output deleted *)
> 
> In[2]:=
> {Head[m1],Head[%1]}
> Out[2]=
> {MatrixForm, List}
> 
> 
> In[3]:=
> m2=TableForm[{{1,2},{3,4}}]
> Out[3]//TableForm=
> (* output deleted *)
> 
> In[4]:=
> {Head[m2],Head[%3]}
> Out[4]=
> {TableForm,List}
> 
> 
> In[5]:=
> m3=TraditionalForm[{{1,2},{3,4}}]
> Out[5]//TraditionalForm=
> (* output deleted *)
> 
> In[6]:=
> {Head[m3],Head[%5]}
> Out[6]=
> {TraditionalForm,List}
> 
> 
> In[7]:=
> m4=StandardForm[{{1,2},{3,4}}]
> Out[7]//StandardForm=
> {{1,2},{3,4}}
> 
> In[8]:=
> {Head[m4],Head[%7]}
> Out[8]=
> {StandardForm,List}
> 
> 
> In[9]:=
> num=N[Pi];
> 
> In[10]:=
> x1=NumberForm[num]
> Out[10]//NumberForm=
> "3.14159"
> 
> In[11]:=
> {Head[x1],Head[%10]}
> Out[11]=
> {NumberForm,Real}
> 
> 
> In[12]:=
> x2=InputForm[num]
> Out[12]//InputForm=
> 3.141592653589793
> 
> In[13]:=
> {Head[x2],Head[%12]}
> Out[13]=
> {InputForm,Real}
> 
> _____________________________
> If you do the following:
> 
> In[1]:=
> m1=MatrixForm[{{1,2},{3,4}}]
> Out[1]//MatrixForm=
> (* output deleted *)
> 
> Then you can do;
> ( In[2]:=  Inverse[%1] )
> because (%1) has the head List.
> But you can't do;
> ( In[2]:= Inverse[m1] )
> because (m1) has the head MatrixForm.
> 
> Shouldn't they both have the same head? Makes no sense to me.

The In[]/Out[] prompts do not record the textual representations of
formatting operations.  They store only the underlying expressions.

This is the intended behavior of format wrapper functions, and it is
documented in _the Mathematica Book_.  See Section 2.8.2 for the
details. 

You can paste the following ButtonBox in a Mathematica 3.0 notebook.  It
creates a hyperlink that will point you to the appropriate portion of
text in the online documentation.

\!\(\*FormBox[
  TagBox[
    ButtonBox[\(Explanation\ of\ format\ discrepancy\),
      ButtonData:>{"2.8.2", "2.7"},
      ButtonStyle->"MainBookLink"],
    DisplayForm], TextForm]\)

--
P.J. Hinton
Mathematica Programming Group           paulh@wolfram.com Wolfram
Research, Inc.                  http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.




  • Prev by Date: Re: Solution for a System of ODEs and equations
  • Next by Date: Re: ListPlot?
  • Prev by thread: Re: A Bug / Feature
  • Next by thread: NFactorial[n_], fast for large (n).