Question: In python code please Write a Python procedure to implement basic Newton's Method. The definition statement of your program should be def Newt(f, fp, x0,
Write a Python procedure to implement basic Newton's Method. The definition statement of your program should be def Newt(f, fp, x0, TOL, N): where f and fp are the function and derivative, x0 is the initial guess, TOL is the stopping tolerance, and N is the maximum number of iterations allowed. Implement the stopping condition where the difference of the iterates is less than the tolerance. Test your program on the function f(x) = x - cos x on [0, 1]. Print out each iteration and compare with the numbers from class or Excel. Use 20 as the maximum number of iterations. Your output statement should be of the form: The solution to the equation is XXXX in NNNN iterations. or The solution wasn't found in N iterations. Where X0X0X0 is the initial value x_0, XXXX is the value the sequence converges to and NNNN is the number of iterations it takes to converge
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
