syms x y;

symjared = 3*x + 2*y + x.^2 - 2*(x.^4) + 2*x*y - 3*(y.^2);

symui = diff(symjared, x);
symvi = diff(symjared, y);

[a,b] = newton2(-10, 10, 10^-6, symui, symvi);

j = 3*a + 2*b + a.^2 - 2*(a.^4) + 2*a*b - 3*(b.^2);

disp(['The Maximum is ', num2str(j), ' at:']);
disp(['X = ',num2str(a),' and Y = ',num2str(b)]);