MathGroup Archive 2002

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

Search the Archive

Re: $Post vs. $PrePrint

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36436] Re: $Post vs. $PrePrint
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 7 Sep 2002 02:53:43 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <al9l9g$b1t$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

yo can just try


In[]:=$Post = (# /. mtrx_?MatrixQ :> AnyHead[mtrx] &);
In[]:=m = {{2, 3}, {0, 1}}
In[]:=q=%;
In[]:=Head[q]


and

In[]:=$PrePost = (# /. mtrx_?MatrixQ :> AnyHead[mtrx] &);
In[]:=m = {{2, 3}, {0, 1}}
In[]:=q=%;
In[]:=Head[q]


But you are right -- the behaviour of MatrixForm[] in your example
is strange. 

Regards
  Jens


"Ersek, Ted R" wrote:
> 
> I am trying to find an example that will demonstrate the difference between
> $PrePrint  and   $Post.   I found an old thread in this news group where a
> user wanted to display all matrices using MatrixForm.  Some users suggested
> the following:
> 
>      In[1]:=   $Post=(#/.mtrx_?MatrixQ:>MatrixForm[mtrx]&);
> 
> Then Dave Withoff said it's better to assign this to  $PrePrint  since the
> objective here is to adjust the display rather than the result of the
> calculation.  With the assignment to  $Post  you could, for example, get
> unexpected results from calculations using %, since matrices will be wrapped
> in MatrixForm.
> --------
> 
> However, if we use  $Post  above, the next input will compute the inverse
> the matrix.  I did verify that Inverse can't take a matrix wrapped in
> MatrixForm.  Can somebody give an example where doing this with  $PrePrint
> instead of  $Post  gives a different result.
> 
>     In[2]:=   m={{2,3},{0,1}};
>               Inverse[%]
> 
>    Out[3]=   (*  Inverse of (m) in MatrixForm, not shown. *)
> 
> ------
> Thanks,
>    Ted Ersek
>    Get Mathematica tips, tricks from
>    http://www.verbeia.com/mathematica/tips/Tricks.html


  • Prev by Date: RE: Generating Two Unit Orthogonal Vectors
  • Next by Date: RE: Plot several graphs generated by Table
  • Previous by thread: $Post vs. $PrePrint
  • Next by thread: fourier transform time