Computational Physics, Python, Interpolation, Differentiation, Integration.
my_newton(f, fprime, x0, err): x1=x0-f(x0)/float(fprime(x0)) # new point according to newton if abs(f(x1))>err: # we need the absolute value here print(f(x1)) return my_newton(f,fprime,x1,err) # repeat if the error is big else: return x1 # only return when everything goes well my_newton(f,lambda