fsolve: avoid useless numerical evaluation of the function