%%
%Solution of the non-linear system of equations

%Initialization of symbolic variables
syms x y;
%Initial solution
x0 = [1;2];
%functions in the system
F = [x^2+y^2-4; y-x^3-1];
%Jacobi matrix (Jacobian) of the system
J = jacobian(F, [x;y]);
%Substitution of the initial solution into the Jacobi matrix
J0 = subs(J, [x;y], x0);
%Substitution of the initial solution into the functions
F0 = subs(F, [x;y], x0);
%First iteration results
x1 = x0-inv(J0)*F0;
J1 = subs(J, [x;y], x1);
F1 = subs(F, [x;y], x1);
%Second iteration results
x2 = x1-inv(J1)*F1;

%prints out numerical value of the first iteration result
double(x1)
%prints out numerical value of the second iteration result
double(x2)
