Finally, I have come up with a script that calculates iteratively all critical points and Lagrange solutions and discards the ones which are out of the domain.
I'm not very familiar with Maple, so there are a few things which are yet to improve:
- I had to introduce the conditions in two different formats, so that they can both be evaluated and used as parameters for LagrangeMultipliers.
- I don't know how to avoid writing the function expression manually to plot3d's arguments.
- I could search for the absolute maximum and minimum in a list, but I think it's not necessary, since they can be chosen at sight. I still might add it later.
- It probably lacks efficiency.
- This could have been implemented as a function instead, like vv did, but I don't know how it's done.
Note: the results in the preview are shown incomplete, but they are fine in the original file.