function [x_star tav] = feladat1_newton
%Newton-modszer

%a program akkor all le, ha |x_{n+1}-x_n| eleg kicsi.

f = @(x)(x.^5-x-1);
f_der = @(x)(5*x^4-1);
hiba = 1e-8;
maxit = 50;
tav=Inf;
%Newton-modszer
x(1) = 2;
it = 0;
while (tav > hiba) & (it < maxit)
    it = it + 1;
    x(it+1) = x(it) - f(x(it))/f_der(x(it));
    tav = abs(x(end)-x(end-1));
end
x_star= x; 



