MATLAB calculations
MATLAB code
syms x y
k=(x^4 + y^4 + x*y -x^2 -y^2)
kx=diff(k,x)
ky=diff(k,y)
[x1,y1]=meshgrid(-8:.1:8,-8:.1:8);
kxfun=inline(vectorize(kx));
kyfun=inline(vectorize(ky));
figure(1);
contour(x1,y1,kxfun(x1,y1),[0,0],'r'), hold on
contour(x1,y1,kyfun(x1,y1),[0,0],'b'), hold off
[xsol,ysol]=newton2d(kx, ky, -0.8, 0.8);
[xsol,ysol]
[xsol,ysol]=newton2d(kx, ky, 0.8, -0.8);
[xsol,ysol]
[xsol,ysol]=newton2d(kx, ky, 0, 0);
[xsol,ysol]
[xsol,ysol]=newton2d(kx, ky, -0.5, -0.5);
[xsol,ysol]
[xsol,ysol]=newton2d(kx, ky, 0.5, 0.5);
[xsol,ysol]
hessdetk = simplify(diff(kx, x)*diff(ky, y) - diff(kx, y)^2)
double(subs(hessdetk, [x,y], [-3^(1/2)/2, 3^(1/2)/2]))
double(subs(hessdetk, [x,y], [3^(1/2)/2, -3^(1/2)/2]))
double(subs(hessdetk, [x,y], [0, 0]))
double(subs(hessdetk, [x,y], [-0.5, -0.5]))
double(subs(hessdetk, [x,y], [0.5, 0.5]))
double(subs(diff(kx, x), [x,y], [-3^(1/2)/2, 3^(1/2)/2]))
double(subs(diff(kx, x), [x,y], [3^(1/2)/2, -3^(1/2)/2]))
double(subs(diff(kx, x), [x,y], [0,0]))
figure(2);
ezcontour(k, [0.75, 0, 0.75, 0])
figure(3);
ezsurf(k, [-1.5, 1.5, -1.5, 1.5])