# Why does EvaluationMonitor in FindMaximum only work for some regions?

This has come about after trying to understand what was going on with this question about FindMaximum and regions. My first thought in that scenario was to set-up EvaluationMonitor and StepMonitor to see which points in the region Mathematica visited as it tried to find the maximum.

$Version (* 10.1.0 for Microsoft Windows (64-bit) (March 24, 2015) *) (* from the linked question *) region = Polygon[{{0, 0}, {10, 0}, {10, 5}, {5, 5}, {5, 10}, {0, 10}}]; (* build up a list of regions to test *) regionlist = {Disk[], Triangle[], Rectangle[], Parallelogram[], region}; (* use FindMaximum *) result = Last@FindMaximum[{x + y, {x, y} \[Element] #}, {x, y}, EvaluationMonitor :> Print["Evaluation: ", x, ",", y], StepMonitor :> Print["Step: ", x, ",", y]] & /@ regionlist graphics = MapThread[ Show[ContourPlot[x + y, {x, y} \[Element] #1], Graphics[{Red, PointSize[Large], Point[{x, y} /. #2]}]] &, {regionlist, result}]; GraphicsRow[graphics]  When I run this code, for Disk[] I get a list of steps and evaluations at various values of x and y. But when I try using either monitor combined with a region other than Disk[], I get no output. Why is this? • Possibly related: when I try discretizing the regions, I get a FindMaximum::elemc: Unable to resolve the domain or region membership condition message. – 2012rcampion Apr 28 '15 at 18:11 • @2012rcampion is that for all regions, including Disk[]? – dr.blochwave Apr 29 '15 at 6:48 • Since the objective function is linear, probably the solution for all these regions except Disk[] comes from a linear programming method, so there are no iterations to monitor. – ilian May 7 '15 at 12:12 ## 1 Answer Thanks to a comment from @ilian, I came back to the question: Since the objective function is linear, probably the solution for all these regions except Disk[] comes from a linear programming method, so there are no iterations to monitor And indeed, that's we see. Change the function to e.g.$x^{2}+y^{2}\$ and EvaluationMonitor/StepMonitor works a treat.

Alternatively, defining the region with machine-precision numbers also works, i.e.

region = Polygon[{{0., 0.}, {10., 0.}, {10., 5.}, {5., 5.}, {5., 10.}, {0., 10.}}]


and indeed doing this seems to solve the problem in the related question.