Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: How to write formatted number into a file

  • To: mathgroup at
  • Subject: [mg66620] Re: How to write formatted number into a file
  • From: dh <dh at>
  • Date: Wed, 24 May 2006 03:02:08 -0400 (EDT)
  • References: <e4tdu3$9o0$>
  • Sender: owner-wri-mathgroup at

Hi Steve,
you have 3 problems:
1)You want the ..E..notation
2) You want to control the number of digits printed
3) By default Put writes in a form Mathematica can read back, that is 
All can be solved by "NumberForm":
1) with the option NumberFormat you can exactly tell how to print, e.g.: 
NumberFormat -> (SequenceForm[#1, "E", #3] &)
2) The number of digits is the second argument for "NumberForm". An 
extended form is {n,m}, see manual.
3) You must force Put to write in "OutputForm" by wrapping the number 
into "OutputForm".
Therefore, alltogether will e.g. look like:

     NumberForm[ 1.23456789*10^-6, 6, NumberFormat -> 
(SequenceForm[#1,"E", #3] &)]
   , "FileName"]

phd related wrote:
> Hi, I am try to write a formated number into a file. For example, Writing
> 6.661999999999944*10^-6 as 6.66200E-06 .
> If I use ScientificForm and can see the format 6.66200E-06 in mathematica,
> however when i am trying to write it into a file like the what i see in
> mathematica,
> the I see ScientificForm instead of the result i desired.
> How to tackle this problem?

  • Prev by Date: Re: Re: Simplification and Arg[]
  • Next by Date: Re: Graphics--ProgressBar in GUIKit
  • Previous by thread: Re: How to write formatted number into a file
  • Next by thread: Finding complex root of a function