
% Dušan Kokosík, 317 484, 2. ročník Bc štúdia, 3ZEH20
function semestralna_praca_2_dusan_kokosik_317484(x,f,J,number_of_digits)

epsilon = 10^(-number_of_digits);
i=1;

while i < 1000
    x_pom = x;
    x = x - J(x)\f(x);  % x - inv(J(x))*f(x);
    %disp("Interacia: " + i);
    %disp(x);

    if abs(x - x_pom) < epsilon
        disp("Iteracia cislo: " + i);
        for k=1:size(x)           
            fprintf(['%0.' num2str(number_of_digits) 'f\n'], round(x(k),number_of_digits));
        end
        break;
    end
    i = i + 1;
end