Python class that implements the Newton method
Pathological cases exist where Newton's method will not converge on a solution.  Yet, there is no obvious way for the caller to tell whether convergence was achieved.  You should distinguish between whether the loop terminated via the break (success) or by exhaustion of the loop condition (failure).

for _ in range(self.num_iter):
    x_tplus1 = x_t - self.step_size * np.dot(np.linalg.inv(H(x_t)), g(x_t))
    #check for convergence
    if abs(max(x_tplus1-x_t))&lt;self.tol:
        break
    x_t = x_tplus1
else:
    raise SolutionNotFound, "No convergence after %d iterations" % (self.num_iter)