Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: how to read real numbers in 1.0000e+00 notation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4118] Re: how to read real numbers in 1.0000e+00 notation
  • From: withoff (David Withoff)
  • Date: Wed, 5 Jun 1996 01:38:21 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4ojegb$78s at dragonfly.wolfram.com> fedort at elmo.Princeton.EDU  
(Fedor B. Trintchouk) writes:
> 
> I have to read into mathematica ASCII data files containing floating
> point numbers in the notation 
> that uses the character "e" to separate mantissa and exponent. Is there  
a
> mathematica function that converts this into mathematica's proper
> representation, or do I have to use sed or something similar to
> replace e's by something like "*10^" ?  
> 
> Thank you.
> -- 
> --
> Fedor Trintchouk                        (609) 258-4745 (office/voice)
> Princeton University                    (609) 258-1089 (lab)
> fedort at princeton.edu                    (609) 258-1139 (fax)
> 
>

The Number format in Read and ReadList can read number in "e" notation.

In[1]:= !!datafile
1.73e+8  2.75e+7  -16.9e-11

In[1]:= ReadList["datafile", Number]

                8         7          -10
Out[1]= {1.73 10 , 2.75 10 , -1.69 10   }

Also, if you think you need it, a sed script sci2mma is available
on MathSource (item 0206-345: sci2mma -- A Filter to Convert Data
in Scientific Notation Format to Mathematica Input Format).

Or the converter could easily be written in Mathematica rather
than sed, in case you need it on a machine that doesn't have sed.

Dave Withoff
Research and Development
Wolfram Research

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Series problem
  • Next by Date: Re: how to read real numbers in 1.0000e+00 notation
  • Previous by thread: how to read real numbers in 1.0000e+00 notation
  • Next by thread: Re: how to read real numbers in 1.0000e+00 notation