function f = myf2(x,X,Y) G=normcdf(X*x); f=-(Y'*log(G)+(1-Y)'*log(1-G));