function [xi] = newton(x0, error, baller, ballerprime, baller2, ballerprime2) 

format long;

j = 100000;

while (error < abs(j))
    xi = x0 - (baller(x0) - baller2(x0))/(ballerprime(x0) - ballerprime2(x0));
    j = abs(xi - x0);
    x0 = xi;   
end
