function [f,g] = f53(n,x) %F53 function and gradient f5 for c=100.CMSC 764 HW1. % [f,g] = f53(n,x) gives the function value f and % gradient g for the vector x of dimension n for test % problem f5. % % See also Hf53. % Geping Liu 09-21-06 f = (x(1,:) - 1) .^2 + (x(2,:) - 1) .^2 + 100 .* (x(1,:) .^2 + x(2,:) .^2 - .25) .^2; g = [ 2 .* x(1,:) - 2 + 400 .* (x(1,:) .^2 + x(2,:) .^2 - 1/4) .* x(1,:) 2 .* x(2,:) - 2 + 400 .* (x(1,:) .^2 + x(2,:) .^2 - 1/4) .* x(2,:)];