This demo opens with one window titled "Constraining Surface".  Modify this surface by modifying the equation in this window.  Several intervals have been included in the control window to make modifying this surface easier.  The white hotspot is restricted to this surface.  Enter your desired function of three variables, and observe the readout telling you the value of the function at the hotspot restrained to the surface.  Try to find maximum and minimum values for locations of the hotspot on the surface.