MathGroup Archive 2002

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

Search the Archive

Re: Use of ShoWProgress option (part 2)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34830] Re: Use of ShoWProgress option (part 2)
  • From: Peter Pein <petsie at arcor.de>
  • Date: Sat, 8 Jun 2002 05:22:05 -0400 (EDT)
  • References: <adpfda$j3q$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Andre Heinemann wrote:
<snip> 

> My aim is to get !automaticaly! a list like this:
> 
> {{Iteration:1,{1.,1.,1.}},...,{Iteration:11,{3.13156,15.1594,0.780051}},...,} 
> 
> 
> May be this problem is very easy to solve, but I  found only the "Hand 
> made solution"
> of copy and paste - this is not the way I want to use a computer (-;
> 
> So if you have any idea how to solve this problem, please give me a hint.
> 
> ----------------------------end of original message ------------------------------------------
> 
> 
> Thanks,
> Andre
> 
> 


Hi Andre,
while having a look at the sources, you might have noticed the call of 
Internal`FindNonlinearFit[...] (line 1108 in my version). So replacing 
any Print or Message call is not possible. My first idea is to redirect 
the output stream to a temporary file to be read in later:
------------
<< Statistics`NonlinearFit`

so = OutputStream["stdout", 1];
st = OpenWrite["tmp", PageWidth -> \[Infinity]];
$Output = $Output /. so -> st;

data = {{1.0, 1.0, .126}, {2.0, 1.0, .219},
   {1.0, 2.0, .076}, {2.0, 2.0, .126}, {.1, .0, .186}};
result = NonlinearRegress[data,
   theta1 theta3 x1/(1 + theta1 x1 + theta2 x2),
   {x1, x2}, {theta1, theta2, theta3},
RegressionReport -> BestFitParameters, ShowProgress -> True];

$Output = $Output /. st -> so;
Close["tmp"];

st = OpenRead["tmp"];
rtmp = ReadList[st, String];
Close["tmp"];

Map[Rest[Apply[List, ToExpression[#]]] &, rtmp] // MatrixForm
-------------

If you want to see what happens while Mathematica is busy, append st to $Output 
first and remove it from the list after finishing NonlinearRegress[].


Peter



  • Prev by Date: Re: Problem with hypergeometric function
  • Next by Date: RE: Graphics
  • Previous by thread: Use of ShoWProgress option (part 2)
  • Next by thread: No "Arrow3D" ?