Re: Data
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Data
- From: rubin at msu.edu (Paul A. Rubin)
- Date: Fri, 24 Jun 94 09:47:47 EDT
>I would like to know how to use data from a data file >to solve an equation in a continuous loop. What procedures >do I need to take to obtain this goal? Could someone please >direct me in the right direction? > >Lost in Illinois >Sab > Do you mean that you want to solve an equation repeatedly using sets of parameter values read from a file? One way would be something like this: p = ReadList[ "file", {Number, Number, ... Number} ]; (* reads parameters into p; see section 2.10.6 of the gospel according to Wolfram for syntax *) While[ !MemberQ[ p, EndOfFile ], (* if the data file ended, p will contain the symbol EndOfFile in one or more entries - if it ran out in the right place, p will be *all* EndOfFiles - see p. 498) <your code goes here>; <output your solution someplace>; p = ReadList[ "file", {Number, Number, ... Number} ] (* grab the next round of parameters *) ]; (* when you get here, you're done *) Paul ************************************************************************** * Paul A. Rubin Phone: (517) 336-3509 * * Department of Management Fax: (517) 336-1111 * * Eli Broad Graduate School of Management Net: RUBIN at MSU.EDU * * Michigan State University * * East Lansing, MI 48824-1122 (USA) * ************************************************************************** Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. J. W. v. GOETHE