Re: How to get 2.334E+6 output form ?
- To: mathgroup at smc.vnet.net
- Subject: [mg5631] Re: How to get 2.334E+6 output form ?
- From: dendzik at usctoux1.cto.us.edu.pl (Zbigniew Dendzik)
- Date: Wed, 1 Jan 1997 21:04:58 -0500
- Organization: Silesian University, Katowice, Poland
- Sender: owner-wri-mathgroup at wolfram.com
Sergio Rojas (sergio at scisun.sci.ccny.cuny.edu) wrote:
(...)
: How can one tell to Mathematica to write
: 6
: numbers in the form 2.3456E+6 instead of 2.3456*10^6 (or 2.3456 10 ).
(...)
: How the data can be written to a file without the braces and comma in
: between?
(...)
Hi Sergio,
Below is a simple piece of Mma code which I have written to solve this
problem.
RegularForm[x_]:= OutputForm[NumberForm[TableForm[x//N], ExponentFunction->
(If[-10<#<10, Null, #]&), NumberFormat->(If[#3=="", SequenceForm[#1, #3],
SequenceForm[#1, "E", #3]]&)]]
If you put the above definition into the file named user.m (for example,
or simply add it to your init.m file), you will get:
In[1]:= << user.m
In[2]:= x=Table[(-1^i)*4.6^(i-j*10), {i, 1, 4}, {j, 1, 3}];
In[3]:= RegularForm[x] >> foo
In[4]:= !! foo
-0.00000108438 -2.55624E-13 -6.02591E-20
-0.00000498813 -1.17587E-12 -2.77192E-19
-0.0000229454 -5.409E-12 -1.27508E-18
-0.000105549 -2.48814E-11 -5.86538E-18
I hope it helps. Happy New Year to you and to all mathgroupers.
--Zbigniew Dendzik
dendzik at us.edu.pl