# Help on limiting range and domain for critical points

I've been working on some simple scripts to find critical points. I've been using this one.

Where the red script is the particular function I'm interested in.

But I am struggling to find a way to calculate the critical points when the domain and/or range is limited.

For example, I'm interested in finding the critical points of f(x,y) = sin(x)sin(y) ,f[x_,y_]=Sin[x] Sin[y], where -pi =< x =< pi, and -pi =< y =< pi. Here's the code I use, and, absent the limits on x and y, it gives a wild unusable answer. But I get errors when I try to mess around with limiting x and y to their respective range and domain. Here's the basic function, sans limits on x and y.

ResourceFunction["StationaryPoints"][Sin[x] Sin [y], {x, y}]


Any thoughts?

• Try e.g.: Solve[{Grad[f[x, y], {x, y}] == 0, -Pi <= x <= Pi, -Pi <= y <= Pi}, {x, y}] Commented Dec 16, 2020 at 12:16

ResourceFunction[

<|"Saddle" -> {{0, {x -> 0, y -> 0}}, {0, {x -> 0, y -> -π}}, {0, {x -> 0, y -> π}}, {0, {x -> -π, y -> 0}}, {0, {x -> -π, y -> -π}}, {0, {x -> -π, y -> π}}, {0, {x -> π, y -> 0}}, {0, {x -> π, y -> -π}}, {0, {x -> π, y -> π}}}, "Maxima" -> {{1, {x -> -(π/2), y -> -(π/2)}}, {1, {x -> π/2, y -> π/2}}}, "Minima" -> {{-1, {x -> -(π/2), y -> π/2}}, {-1, {x -> π/2, y -> -(π/2)}}}|>