function [Jopt,uopt,yopt,Hess]=getOptimum(d)


bestguess=[ 0.5557
    0.7670];
 Jbest=inf;
 Jprev=inf;
% 
%  for i=1:10
%     u0=15*rand(2,1);
%     warning off
%  opts=optimset('GradObj','on','Hessian','on','Display','on','algorithm','sqp');
%     [uopt,Jopt,flag,output,grad,Hess]=fminunc(@(u)objective(u,d),u0,opts);
%     
%     
%     eig(Hess)
%     flag
%     
%     if Jbest>Jopt && flag==1
%         Jbest=Jopt;
%         bestguess=u0;
%         eig(Hess)
%     end
%     
% end
% 
% 
% bestguess
% Jbest
  warning off
 opts=optimset('GradObj','on','Hessian','off','Display','on','TolX',1e-9,'TolFun',1e-12);
 [uopt,Jopt,flag,output,grad,Hess]=fminunc(@(u)objective(u,d),bestguess,opts);
 [~,~,~,yopt]=objective(uopt,d);
%  grad
%  Hess