function [value, nabla] = cost_ex1(x)
% EX1 evaluates a cost functional for an example problem
%
     global PAR
     if PAR.flag(1) == 'f' | PAR.flag(1) == 'a'
         value = x(1)*x(2)^2;
     end
%
     if PAR.flag(1) == 'g' | PAR.flag(1) == 'a'
         nabla = [  x(2)^2;
		        2*x(1)*x(2)];
     end
%
