MathGroup Archive 1996

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

Search the Archive

Output to a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4624] Output to a file
  • From: jaimeco at arizona.edu
  • Date: Wed, 21 Aug 1996 03:25:39 -0400
  • Organization: The University of Arizona
  • Sender: owner-wri-mathgroup at wolfram.com

I got this sample input file in which all I want is to create an
output file with an array of numbers (three columns) which will be later
read by a fortran program. The problem is that I can Print the
numbers just fine on the screen but once I try to collect them in
a file I get very different results. 

Would somebody have any ideas as to how to get a file with exactly
the same output shown on the screen? The line I am interested in
contains the Do loop and the Print statement.

I have used a script file to get the results and then edit it.
Mathematica will also save a file which can be edited later
but in real applications the editing step will take lots of time.




-- 
Thanks
                               _   _          
Jaime Combariza
jaimeco at arizona.edu


no=4 Pi 10^(-7)//N;
eo=8.854 10^(-12)//N;
eb=1.0;
sigb=0.00//N;
w=2 Pi 10^7//N;
d=2.;
afe=4.0;
afs=0.00;
weo=w eo//N;
af0=(w weo no)^(1/3)//N;
afc=afe-(I afs/weo)//N;
afg=(Abs[afc])^(1/3) (Cos[(Arg[afc])/3]+(I Sin[-(Abs[Arg[afc]])/3]))//N;
ebc=eb-(I sigb/weo)//N;
ks=af0 afg//N;
zo=ebc af0/(afg afg)//N;
zd=zo+(ks d)//N;
dum=sigb/(eb w eo)//N;
dum=Sqrt[1.0 +dum^2]//N;
temp=eo no eb/2.0//N;
ai=w Sqrt[temp (dum-1.0)]//N;
bi=w Sqrt[temp (dum+1.0)]//N;
nu0=no w/(bi-(I ai))//N;
cb=nu0 ks I/(w no)//N;
ca=(AiryAi[-zd]+(cb AiryAi'[-zd]))/(AiryBi[-zd]+(cb AiryBi'[-zd]))//N;
c11=AiryAi[-zo]-(cb AiryAi'[-zo])//N;
c22=AiryBi[-zo]-(cb AiryBi'[-zo])//N;
c1=2.0/(c11-(ca c22))//N;
c2=-c1 ca//N;
Clear[Ey]
Clear[zi]
zi[i_]:= d/40 i//N;
Ey[z_]:= c1 AiryAi[-(zo+(ks z))]+c2 AiryBi[-(zo+(ks z))]//N;
Table[{d/40 k, Ey[(d/40 k)]}, {k, 40}] >> eydat.txt
Do[ x=zi[k-1]; PutAppend[{x, Abs[Ey[x]], Arg[Ey[x]]},"ey.out"], {k, 41}]
Do[x=zi[k-1]; Print[x, "  ",Abs[Ey[x]], "  ",Arg[Ey[x]]], {k, 41}]
t1=Table[{zi[k],  Abs[Ey[zi[k]]]}, {k, 40}] >> eymag.txt
t2=Table[{d/40 k, Arg[Ey[(d/40 k)]]}, {k, 40}] >> eyphs.txt
p1=ListPlot[t1, PlotJoined -> True]p2==ListPlot[t2, PlotJoined -> True]




--------------2781446B794B--

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


  • Prev by Date: Wolfram Research Career Opportunities
  • Next by Date: Re: Constrained Min, non-linear
  • Previous by thread: Wolfram Research Career Opportunities
  • Next by thread: BUG or FEATURE in Interpolation[] ?