Re: $Post
- To: mathgroup at smc.vnet.net
- Subject: [mg67444] Re: $Post
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 25 Jun 2006 03:19:03 -0400 (EDT)
- References: <e7j0ta$7ol$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bruce Colletti schrieb:
> $Post = N displays all numeric output in digit form. Thus, sqrt(2) appears as 1.4142.
>
> Likewise, $Post = If[MatrixQ@#, MatrixForm@#] & causes all matrices to appear as matrices.
>
> Unfortunately, I don't see how to establish both at once. How would I do this?
>
> Thanx.
>
> Bruce
>
In[1]:=
$Post=N@If[MatrixQ@#,MatrixForm@#,#]&;
In[2]:= Sqrt[2]
Out[2]= 1.41421
In[3]:= {{Sqrt[2]}}
Out[3]//MatrixForm= (1.41421)
does not do what you expect?
To get results close to the exact values in less trivial cases, I would recommend N[If[...],16] instead of N at If[...].
Peter