function retval = extrosenfn(x) % usage: y = extrosenfn(x) % description: Returns value of function of function of % Exercise 9.1 of Nocedal and Wright's text, Numerical % Optimization. This is the extended Rosenbrock % function. It is *assumed* that length(x) is even! % Solution is x* = (1,1,...,1), minimum value 0. % no bulletproofing % for adapting this problem, change c here and in % gradient and hessian functions. c = 10; m = length(x); retval = sum((1-x(1:2:m-1)).^2 + c*(x(2:2:m)-x(1:2:m-1).^2).^2);