Apparent error in struct Amoeba code


Art Quaife
11-27-2014, 04:58 PM
In NR3 page 506, the code line immediately following the comment "Gives a better result than the best point, ..." causes the Embarcadero 32-bit compiler to give the diagnostic warning W8004 :" 'ytry' is assigned a value that is never used." I agree. How should this code be fixed?

Art Quaife, Ph.D.

Saul Teukolsky
12-01-2014, 03:50 PM
Hi Art,

The helper function amotry is called at several points in the code. It evaluates the function at the trial point, and if it's better than the highest, replaces the highest. It then returns the function value at the trial point as ytry. For some of the calls to amotry, this value of ytry is used, but for the one you mention, it isn't. There's nothing to fix in the code, except perhaps to insert a clarifying comment.

Best,
Saul Teukolsky

Art Quaife
12-01-2014, 06:44 PM
Hi Saul,

Thanks much for the explanation.

Art