% f = @ (x) [x(1)*x(1)+x(1)*x(2)-10;x(2)+3*x(1)*x(2)*x(2)-57];
% J = @ (x) [2*x(1)+x(2),x(1);3*x(2)*x(2),1+6*x(1)*x(2)];
function Newton_Raphson(x_0,f,J,pocet_cislic)
epsilon = 10^(-pocet_cislic);
x = x_0;
v = x_0;
i = 0;
while i < 40000
    delta = J(x)\f(x);
    x = x - delta;
    i = i + 1;
    v(:,end+1) = x;
    if max(abs(delta))<epsilon
        fprintf('pocet iteracii je %d\n',i);
        fprintf('priblizne riesenie je %f\n',round(x,pocet_cislic));
        figure
        plot(v(1,:),v(2,:),'.-');
        break
    end
end