xc=.7067;
yc=-3.2672;
zc=funcn(xc,yc);
gc=grad(xc,yc);
Hc=hessn(xc,yc);
mc=zc;
disp(['original point x_0 is :  ',num2str([xc yc])]);
disp(['objective value at x_0 is :  ',num2str(zc)]);
disp('hit any key to continue')
pause

xp=.7565;
yp=-2.3361;
zp=funcn(xp,yp);
p=[xp;yp]-[xc;yc];
gc=grad(xc,yc);
Hc=hessn(xc,yc);
mp=zc+gc'*p+.5*p'*Hc*p;
rho=(zc-zp)/(mc-mp);
disp(' ');
disp(['new point x_1 is :  ',num2str([xp yp])]);
disp(['objective value at x_1 is :  ',num2str(zp)]);
disp(['rho value at x_0 is: ',num2str(rho)]);
xc=xp;yc=yp;zc=zp;
disp('hit any key to continue')
pause



xp=.1413;
yp=-.5570;
zp=funcn(xp,yp);
p=[xp;yp]-[xc;yc];
gc=grad(xc,yc);
Hc=hessn(xc,yc);
mp=zc+gc'*p+.5*p'*Hc*p;
rho=(zc-zp)/(mc-mp);
disp(' ');
disp(['new point x_2 is :  ',num2str([xp yp])]);
disp(['objective value at x_2 is :  ',num2str(zp)]);
disp(['rho value at x_1 is: ',num2str(rho)]);
xc=xp;yc=yp;zc=zp;
disp('x_2=x_3')
disp('hit any key to continue')
pause



xp=2.0368;
yp=-.4739;
zp=funcn(xp,yp);
p=[xp;yp]-[xc;yc];
gc=grad(xc,yc);
Hc=hessn(xc,yc);
mp=zc+gc'*p+.5*p'*Hc*p;
rho=(zc-zp)/(mc-mp);
disp(' ');
disp(['new point x_4 is :  ',num2str([xp yp])]);
disp(['objective value at x_4 is :  ',num2str(zp)]);
disp(['rho value at x_3 is: ',num2str(rho)]);
xc=xp;yc=yp;zc=zp;
disp('hit any key to continue')
pause




xp=2.3195;
yp=-.3409;
zp=funcn(xp,yp);
p=[xp;yp]-[xc;yc];
gc=grad(xc,yc);
Hc=hessn(xc,yc);
mp=zc+gc'*p+.5*p'*Hc*p;
rho=(zc-zp)/(mc-mp);
disp(' ');
disp(['new point x_5 is :  ',num2str([xp yp])]);
disp(['objective value at x_5 is :  ',num2str(zp)]);
disp(['rho value at x_4 is: ',num2str(rho)]);
xc=xp;yc=yp;zc=zp;
disp('hit any key to continue')
pause




