# How to find all local maxima in a given domain?

I wish to locate all local maxima of the function $$f(x,y)=1 + Sinc[8*(x - 1)]*Sinc[10*(y - 1)]$$ on the domain $$\{(x,y):0\leq x\leq 2,0\leq y\leq 2\}.$$ The code only shows one of them:

FindMaximum[{1 + Sinc[8*(x - 1)]*Sinc[10*(y - 1)],
0 <= x <= 2.2 && 0 <= y <= 2.2}, {x, y}]


The following is my dream (but only for one variable function) in which the locations are also marked.

Thanks so much.

Try NSolve to find all of the extrema:

gln = D[1 + Sinc[8*(x - 1)]*Sinc[10*(y - 1)], {{x, y}}];
gln = Map[# == 0 &, gln {(x - 1)^2, (y - 1)^2} // Simplify] (* equation without singularity x=y=1*)


NSolve is able to solve these equations in the given range 0<x,y<2

extrema =NSolve[{gln, 0 <= x <= 2 && 0 <= y <= 2} // Flatten, {x, y}] //Normal;
extrema = Select[extrema, Length[#] == 2 &] (* only solution points {x,y}*)

Show[{Plot3D[1 + Sinc[8*(x - 1)]*Sinc[10*(y - 1)], {x, 0, 2.2}, {y, 0, 2.2},PlotStyle-> Opacity[.25], PlotRange -> All,MeshFunctions -> (#3 &), Mesh -> 50]
, Graphics3D[{Red,Point[{x, y, 1 + Sinc[8*(x - 1)]*Sinc[10*(y - 1)]} /. extrema]}]}] Looking at the second derivatives filters out the maxima…

• Looking at the second derivatives filters out the maxima…and so what are your conclusions? – Artes Mar 2 at 15:22
• @Artes My answer shows a way to find all extrema in the given range, not more! – Ulrich Neumann Mar 2 at 15:27
• You have to find local maxima, not extrema or critical points. – Artes Mar 2 at 15:29