Question: How to solve it using Python? 2. Write a function called poly_newton which takes input parameters p, x0, tolerance and max_iter where: p is a

How to solve it using Python?
2. Write a function called poly_newton which takes input parameters p, x0, tolerance and max_iter where: p is a list representing a polynomial p(x) x0 is a number tolerance is a positive number max_iter is a positive integer The function returns an approximation of a root of p(x) using the Newton's method (with initial value xo). More precisely, Newton's method defines a recursive sequence beginning with an initial guess xo and then computing p(zn) which, if successful, converges to a solution of p(x)-0. The function poly_newton computes the recursive sequence until one of the following conditions is met o if lp() is less than tolerance, the function terminates, prints the statement Found root is n iterations. (where n is the number of iterations of Newton's method performed) and returns the value xn (an approximate root of p(x)) o if n is equal to max_iter (ie. the algorithm reaches the maximum number of iterations allowed by the user), the function terminates, prints the statement Root not found and returns the value None You may use your functions poly_eval and poly diff from Assignment 1. Finally, note that it is possible (and preferable) to write this function with a for loop and not a while loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
