clear all

x = -1.2 :.01 : 1.2;
y = -0.5 :.01 : 1.5;
[X,Y]=meshgrid(x,y);
Z = l24f(X,Y);
cvals = -1:0.5:10;
contour(x,y,Z,cvals)

hold on

tau = 0.5;
beta = 0.1;
xk = -1.2;
yk = 1.0;
xi(1) = xk;
yi(1) = yk;

for k = 2:100;
 fk = l24f(xk,yk);
 gxk = -40*xk*(yk-xk^2) - 2*(1-xk);
 gyk = 20*(yk-xk^2);
 pxk = - gxk;
 pyk = - gyk;
 gtp = pxk*gxk + pyk*gyk ;
 alpha = 1;
 while l24f(xk+alpha*pxk,yk+alpha*pyk) > fk + beta*alpha*gtp
   alpha = alpha * tau;
 end
 alpha;
 xk = xk+alpha*pxk ;
 yk = yk+alpha*pyk ;
 xi(k) = xk;
 yi(k) = yk;
end

plot(xi,yi,'-r.')
xsol=1;
ysol=1;
plot(xsol,ysol,'ko')

hold off

print -depsc eps/l24
