% newton.m: solves one nonlinear equation in 1 unknown by Newton's method

absf=10;
tol=1.0e-15;
x0=0.15;
i=0;

while(absf > tol & i < 100)
    
    i=i+1;
    x1=x0-f(x0)/fp(x0);
    absf=abs(f(x1));
    x0=x1;
    fprintf('iteration %i x=%g absf=%g\n',i,x1,absf);
   
end;

