RE-1: [TS 9937]--Formatting (x_Real)
- To: mathgroup@smc.vnet.net
- Subject: [mg12534] RE-1: [TS 9937]--Formatting (x_Real)
- From: Ersek_Ted%PAX1A@mr.nawcad.navy.mil
- Date: Sat, 23 May 1998 18:11:00 -0400
This is Ted Ersek again,
Carlos replied with:
|
|To have this NumberForm affect all outputs the $Post function can be
used. |This will also help avoid the problems you had using NumberForm
with other |expressions. In your previous expression "In[5]:= 1.0 /
dec" is the same |as saying "1.0/NumberForm[3]" or say
"1.0/InputForm[3]" |
OK that formats Out[2] below using decimal notation. Notice I changed
$Post so NumberForm isn't applied to Null. Now when I end a cell with a
semicolon, I don't get ( Out[n]//NumberForm= Null ).
In[1]:=
$Post= If[#=!=Null, NumberForm[#,ExponentFunction->(Null &)]]&;
In[2]:=
num=Exp[-45.0]
Out[2]//NumberForm=
"0.0000000000000000000286252"
In[3]:=
{1.0/8,Log[3]}
Out[3]//NumberForm=
{"0.125",Log["3"]}
But there are still a few aspects of this I would like to change.
(1) I would like to use to use scientific notation for
(x_Real)/;(Abs[x]<=10^-8), and decimal notation for
(x_Real)/;(Abs[x]>10^-8). That can probably be done with a suitable
ExponentFunction, but I don't know how to use that option.
(2) Now all output cells are preceded by "Out[n]//NumberForm=". I
would like to have the normal performance where output cells are
preceded by "Out[n]=". At one time I stumbled across a selection to
control that feature, but I don't remember where it was.
(3) Now when I copy a cell into an ASC file (ie. e-mail) all numbers
are in quotes
(see Out[3] above). Normally numbers aren't in quotes (see below). I
would like to have this work as normal.
Obviously Mathematica normally uses rules to decide whether to use
decimal notation or scientific notation for real numbers. Perhaps I
can just change that rule instead of using NumberForm.
Thanks,
Ted Ersek