Computational Physics, Python, Interpolation, Differentiation, Integration.
return x1 myresult2=my_newton2(f,lambda x:2*x+2,10,1.48e-08) print(myresult2) newton1 Out: -0.999999999893281472 newton1-myresult2 Out: 0.0 We hit exactly the same number as Scipy! We can even get back to our old answer in scipy by replacing newton2=optimize.newton(lambda