%Newton.m takes a hardwired function and a hardwired starting point and
%tries to find the zero around that starting point

f=inline('816*x^3-3835*x^2+6000*x-3125');
fprime=inline('2448*x^2-7670*x^+6000');

%f=inline('x^2-2');
%fprime=inline('2*x');

xprev=1.5;
x=xprev-f(xprev)/fprime(xprev)
k=0;
while abs(x-xprev) > eps*abs(x)
    xprev=x;
       x=x-f(x)/fprime(x)
       k=k+1
       disp([k x]);
   end
   