Find a zero using the NewtonRaphson or secant method.
Find a zero of the function func given a nearby starting point x0. The NewtonRaphson method is used if the derivative fprime of func is provided, otherwise the secant method is used.
Parameters :  func : function
x0 : float
fprime : function, optional
args : tuple, optional
tol : float, optional
maxiter : int, optional


Returns :  zero : float

Notes
The convergence rate of the NewtonRaphson method is quadratic while that of the secant method is somewhat less. This means that if the function is well behaved the actual error in the estimated zero is approximately the square of the requested tolerance up to roundoff error. However, the stopping criterion used here is the step size and there is no guarantee that a zero has been found. Consequently the result should be verified. Safer algorithms are brentq, brenth, ridder, and bisect, but they all require that the root first be bracketed in an interval where the function changes sign. The brentq algorithm is recommended for general use in one dimensional problems when such an interval has been found.