MathGroup Archive 2005

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

Search the Archive

Re: problems with memory usage

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63319] Re: [mg63263] problems with memory usage
  • From: Marcelle Santos <marcellesantos at yahoo.com>
  • Date: Fri, 23 Dec 2005 05:08:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

sorry, but my message was not completely posted. here
goes the complete message:


I have to fit a model to a long set of data from
previous calculations. These data are in a file called
"ptab.m", which has this structure:

{k1,{{x1,y1},{x2,y2},{x3,y3},...}}
{k2,{{x1,y1},{x2,y2},{x3,y3},...}}

Since I need to fit the model for each "k", I read
only one line per time using

s=OpenRead["ptab.m"];
p1=ReadList[s,Expression,1][[1]];

then I do

k1=p1[[1]];
p1=Drop[p1,1];

and fit the data to the model with

NonlinearRegress[p1,model,x,{a,n},RegressionReport->
BestFitParameters];

than I save k1 and the parameters to a file, clear
everything with

Clear[p1];

and then do everything again to the next line:

p1=ReadList[s,Expression,1][[1]];

k1=p1[[1]];
p1=Drop[p1,1];

NonlinearRegress[p1,model,x,{a,n},RegressionReport->
BestFitParameters];

I do that up to the end of the file "ptab.m" and
finaly close it with

Close[s];


Well, the program works properly. I'm not a specialist
in Mathematica or in computation, so it may not be the
most elegant and simple way to do write this program,
but it works and this should be enough.
Howerver, after each step, the amount of memory used
gets larger and larger and, of course, the calculation
gets slower and slower. I don't understand exactly why
it happens since it reads one line per time and the
lines are very similar to each other.

Shouldn't it just use the same amount of memory in
every step?
What is going on?
How can I avoid this to happen?

Thanks,
Marcelle Soares-Santos. 

--- Marcelle Santos <marcellesantos at yahoo.com> wrote:

> I have to fit a model to a long set of data from
> previous calculations. These data are in a file
> called
> "ptab.m", which has this structure:
> 
> {k1,{{x1,y1},{x2,y2},{x3,y3},...}}
> {k2,{{x1,y1},{x2,y2},{x3,y3},...}}
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


  • Prev by Date: Re: Re: NDSolve
  • Next by Date: Re: problems with memory usage
  • Previous by thread: problems with memory usage
  • Next by thread: Re: Re: problems with memory usage