MathGroup Archive 1997

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

Search the Archive

RE: make 1. x 10^-10 read simpl

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8868] RE: [mg8479] make 1. x 10^-10 read simpl
  • From: Ersek_Ted%PAX1A at mr.nawcad.navy.mil
  • Date: Tue, 30 Sep 1997 20:16:32 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Rob Peterson wrote:
|
|Seems like I am always losing graph space because the vertical axis is
|  labeled like "1. x 10^-10" (except the ^ isn't there).  I can't seem to
|  find a way to make it take up half the space by showing simply
|  "10^-10".
|

I have been working with Rob on his problem.  An example of a graphics Rob 
is talking about can be made using the following commands.

In[1]:=
h = 6.63*^-34; k = 1.38*^-23; c = 3.0*^8;
c1 = 8*Pi*h*c; c2 = h*c/k;
(* BlackBodyDistr Black Body distr vs T and lambda  *)
rho[lambda_, T_] := c1/(lambda^5*(Exp[c2/lambda/T] - 1));
<<Graphics`Graphics`

In[2]:=
LogLogPlot[rho[lambda/10^6, 300], {lambda, 0.5, 100},
PlotRange -> All ];

Out[2]=    (*  Graphics not shown.  *)

The resulting graphic has TickMarks on the vertical axis labeled
1. x 10^-4,    1. x 10^-10,  1. x 10^-16,  etc.

Most would rather not have the "1. x" displayed.
I modified the standard package to produce better looking results (in my 
opinion).

To do this I changed the definition of the LogTicks command in the 
 Graphics.m  package.
The change I made is shown below.  Please let me know If you think the code 
should not be changed, or if there is a better way to get the desired 
results.

Once Graphics.m  is modified as shown below, the commands above will produce 
a graphics with TickMarks labeled as  10^-4,  10^-10,  10^-16,   etc.

Question:
What is the purpose of   NumberForm[x]
in the original code ?

                    Ted Ersek

_______________________________________

(*  The original definition was:   *)
    LogTicks[x_] :=
     {Log[10., x],NumberForm[x]}


(*  My new definition is:   *)
    LogTicks[x_]:=
    Module[{xx=MantissaExponent[N[x]], y=Rationalize[x]},
       {Log[10. , x],
           Which[
               xx=={0.1, -1}, 0.01,
               xx=={0.1, 0}, 0.1,
               xx=={0.1, 1}, 1,
               xx=={0.1, 2}, 10,
               xx=={0.1, 3}, 100,
               Part[xx, 1]==1.0, Superscript[10, Part[xx, 2]],
               Part[xx, 1]==0.1, Superscript[10, Part[xx, 2]-1],
               IntegerQ[y]&&(y<1000), y,
               True, x
           ]
       }
    ]
________________________________________
Note:
Under Windows 95 the Mma install program put the  Graphics.m  package in the 
following folder:
C/ProgramFiles/WolframResearch/Mathematica/3.0/AddOns/StandardPackages/Graph  
ics



  • Prev by Date: FW: make 1. x 10^-10 read simpl
  • Next by Date: Re: [Help?] Integer/Decimal portion of a real number
  • Previous by thread: FW: make 1. x 10^-10 read simpl
  • Next by thread: AxesLabels on the MacOS, mkdk