MathGroup Archive 2001

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

Search the Archive

Re: Write output to file continuously

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31114] Re: [mg31074] Write output to file continuously
  • From: Omega Consulting <omega_consulting at yahoo.com>
  • Date: Wed, 10 Oct 2001 19:14:33 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 02:33 AM 10/6/2001, bradamanteus at yahoo.com wrote:

>1.Here the NestList works but the output is not written to a file. Although
>it does create a file called datafilename with a content of NULL
>
>
>
>Clear[outputstep];
>outputstep[datafilename_String][{variablelist_}] :=
>     nextstate[{variablelist}] >>> datafilename
>
>Clear[simulation];
>simulation[datafilename_String, simlength_][{variablelist_}] :=
>   NestList[outputstep[datafilename], {variablelist}, simlength]
>
>simulation["dat3", 3][{initiallist}]

There are two problems here. Look at the definition of outputstep.

?outputstep

Global`outputstep

outputstep[datafilename_String][{variablelist_}] :=
                   nextstate[{variablelist}]

The above definition is interpreted as the expression to be Put. The second 
problem is that this form of Put interprets datafilename as the actual file 
name, not a variable.

!!datafilename
Null

>2. This creates a filename named dat3, but only has the initial list of
>variables and NestList cannot be calculated.
>
>
>
>Clear[outputstep];
>outputstep[datafilename_String][{variablelist_}] :=
>   PutAppend[nextstate[{variablelist}], datafilename]
>
>Clear[simulation];
>simulation[datafilename_String, simlength_][{variablelist_}] :=
>   NestList[outputstep[datafilename], {variablelist}, simlength]
>
>simulation["dat3", 3][{initiallist}]

This fixes the above problems, but another is still there. The output of 
outputstep is the input for the next nesting, but the output of 
PutAppend[x, y] is Null, not x. Instead, outputstep should be

outputstep[datafilename_String][{variablelist_}] :=
Module[{new = nextstate[{variablelist}]},
     PutAppend[new, datafilename];
     new
]

>I would appreciate any assistance.
>
>Amateur mathematica programmer
>Leanne Ussher
>bradamanteus at yahoo.com

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"

Spend less time searching and more time finding.
http://www.wz.com/internet/Mathematica.html



  • Prev by Date: Re: Assumptions question (1/m^x,x>1,m=Infinity)
  • Next by Date: another question.
  • Previous by thread: Write output to file continuously
  • Next by thread: Require derivation for the intersection of three planes