syms x1 x2 n;
x=[x1 x2]';
f=3x1^2-4x1x2+x2^2+x1-3x2+8;
g=[6x1-4x2+1,-4x1+2x2-3]';
h=[6,-4;-4,2];
h0=inv(h);
eps=0.01;
k=0;
tol=1;
x0=[0,0]';
while tol>eps
g0=subs(g,x,x0);
m=eval(norm(g0));
if m<eps
minf=subs(f,{x1,x2},{x0(1,1),x0(2,1)});
x=x0
break
else
d0=-h0g0;
fn=subs(f,x,x0);
dfn=diff(fn);
n0=solve(dfn);
[r,s]=size(n0);
d2fn=diff(fn,2);
for i=1:s
I(i)=limit(d2fn,n,n0(i));
temp=double(I(i));
if temp>0
n=n0;
end;
end;
end;
x0=x0+nd0;
tol=m;
k=k+1;
end