Computational Physics, Python, Interpolation, Differentiation, Integration.
xs=Decimal(x0) x1=xs-Decimal(f(xs))/Decimal(fprime(xs)) # new point according to newton if abs(Decimal(f(x1)))>Decimal(err): # need the absolute value here print(Decimal(f(x1))) return my_newton3(f,fprime,x1,err) # repeat if the error is too large else: return x1 my_newton3(f,lambda