function varargout = objd(x,mode) % Powell bacdly-scaled function from More, Garbow, Hillstrom % (TOMS 1981, v.7, pp. 17-41) global numf numg numH argout = 0; f1 = 10^4*x(1)*x(2) - 1.0; f2 = exp(-x(1)) + exp(-x(2)) - 1.0001; if bitand(mode,1) numf = numf + 1; argout = argout + 1; varargout(argout) = {f1^2 + f2^2}; end if bitand(mode,2) numg = numg + 1; argout = argout + 1; varargout(argout) = {[2*f1*10^4*x(2) - 2*f2*exp(-x(1)); ... 2*f1*10^4*x(1) - 2*f2*exp(-x(2))]}; end if bitand(mode,4) numH = numH + 1; argout = argout + 1; varargout(argout) = {[2*10^8*x(2)^2 + 2*f2*exp(-x(1)) + 2*exp(-2*x(1)) ... 2*10^8*x(1)*x(2) + 2*10^4*f1 + 2*exp(-x(1))*exp(-x(2)); ... 2*10^8*x(1)*x(2) + 2*10^4*f1 + 2*exp(-x(1))*exp(-x(2)) ... 2*10^8*x(1)^2 + 2*f2*exp(-x(2)) + exp(-2*x(2))]}; end return;