Minimization of a function in two variables