Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*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 1992

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

Search the Archive

input/output

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: input/output
  • From: tuk at natazhat.uafphys.alaska.edu (John Pender)
  • Date: Wed, 17 Jun 92 11:10:35 YDT

does anybody know how to get mathematica to write a bunch of numbers to
a file in fortran-compatible format?  the best option i've found so far
is to use the ColumnForm command, but as you can see below, the output
isn't compatible with standard fortran (which uses ** instead of ^).  if
you use the FortranForm command you get (at least on my machine) a lot of
excess baggage as well.  i can work around this problem, but it sure seems
to me that there's got to be a nice way to do such a simple i/o excercise.

thanks a lot,
john pender 

**********************
In[1]:= data=Table[Exp[-5 x],{x,10}]//N

                                             -7            -9            -11
Out[1]= {0.00673795, 0.0000453999, 3.05902 10  , 2.06115 10  , 1.38879 10   , 
 
               -14            -16            -18            -20
>    9.35762 10   , 6.30512 10   , 4.24835 10   , 2.86252 10   , 
 
               -22
>    1.92875 10   }

In[2]:= ColumnForm[data]>>out.dat

In[3]:= 
Natazhat% m out.dat
0.00673794699908547
0.00004539992976248488
3.05902320501826*10^-7
2.061153622438559*10^-9
1.388794386496403*10^-11
9.35762296884019*10^-14
6.305116760146998*10^-16
4.248354255291597*10^-18
2.8625185805494*10^-20
1.928749847963922*10^-22
Natazhat% 






  • Prev by Date: chaos?
  • Next by Date: "Improved" Macintosh interface to Mma 2.0
  • Previous by thread: chaos?
  • Next by thread: "Improved" Macintosh interface to Mma 2.0