I enchanced my algorithm a bit and now I am getting a "better output" , but its not correct
Here is my algorithm
Evaluate the polynomial at root, x0 (starting with an initial guess):
result = f(x0)
2. If the maximum number of iterations was exceeded, or the
absolute value of result is less than or equal to some epsilon
of error difference, return the root, x0.
3. Otherwise, compute the new root using Newton's Method:
x1 = x0 - f(x0)/f'(x0)
4. Recurse with new root, x1.
Here is a new code
The rest of the code was not change
I am
testing this input [3,-1] and my output is 3.524746445015649
But the right output is 3.0