$Post vs. $PrePrint
- To: mathgroup at smc.vnet.net
- Subject: [mg36423] $Post vs. $PrePrint
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Fri, 6 Sep 2002 03:16:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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