I'm trying to find a maximum of interpolated function inside a particular mesh cell. However for some cells the process is very slow and it returns a warning:
FindMinimum::eit: The algorithm does not converge to the tolerance of 1.`*^-6 in 500 iterations
The code is:
FF = Interpolation[q, InterpolationOrder -> 2];
dp = DensityPlot[FF[x, y], {x, y} \[Element] Disk[{0, 0}, 2], PlotRange -> All, PlotPoints -> 40];
ms = DelaunayMesh[kekL, MeshCellStyle -> {2 -> Opacity[0]}];
pg = MeshPrimitives[ms, 2][[104]];
fm = FindMaximum[{FF[x, y], {x, y} \[Element] pg}, {{x, pg[[1, 1, 1]]}, {y, pg[[1, 1, 2]]}}, MaxIterations -> 30]
Show[{dp, ms, Graphics[{White, Point[{x, y} /. fm[[2]]], Point[RegionCentroid[pg]]}]}, ImageSize -> 600]
And definitions of q
and kekL
are on pastebin.
I don't want a particularly accurate solution (even 10^-2 precision is fine) but I'd like it to be fast. I tried using option MaxIterations
but no matter what the parameter was it still reported "500 iterations" warning. It seems like it's ignoring eveything I put like AccuracyGoal
and PrecisionGoal
as well. The version is 11.2