Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Last part please Write a function pol (a, x) which takes a list of coefficients a and a point x, and evaluates ,. i=0 Write
Last part please
Write a function pol (a, x) which takes a list of coefficients a and a point x, and evaluates ,". i=0 Write a function coeffs(a) which takes a list of coefficients which define a polynomial p(x) = ;a", i=0 and returns the list of coefficients associated with the first derivative of this polynomial, p'(x). For example given a = [1, 2, 3, 4, 5] the function should return the list [2, 6, 12, 20). flate(a, r) which, given a list of coefficients a which define a Write a function polynomial p(x) = aix, i=0 and a root r of p(2) whence p(r) 0, returns a list of coefficients associated with the deflated polynomial p(x)/(x r). You may use either forwards or backwards deflation. As an example given a = [2, -3, -3, 2] and r = 2 the function should return the list (-1, 1, 2]. Write a function new (f, df, x0) which implements Newton's method to identify a root of the function f whose first derivative is given by the function df, with the starting value being given by xo. Put together your answers from Questions 1-4 to write a function roots (a) which attempts to locate all of the roots of the polynomial given by p(x) = ,". i=0 You may assume that all of the roots of p(x) are real. Your function should be prepared to handle cases where Newton's method does not converge, and retry with several different initial values. Extend your routine from Question 5 to also be capable of handling polynomials with complex roots. Hint: In Python complex numbers can be specified as y = 3 + 2J with the imaginary part being suffixed by J. Write a function pol (a, x) which takes a list of coefficients a and a point x, and evaluates ,". i=0 Write a function coeffs(a) which takes a list of coefficients which define a polynomial p(x) = ;a", i=0 and returns the list of coefficients associated with the first derivative of this polynomial, p'(x). For example given a = [1, 2, 3, 4, 5] the function should return the list [2, 6, 12, 20). flate(a, r) which, given a list of coefficients a which define a Write a function polynomial p(x) = aix, i=0 and a root r of p(2) whence p(r) 0, returns a list of coefficients associated with the deflated polynomial p(x)/(x r). You may use either forwards or backwards deflation. As an example given a = [2, -3, -3, 2] and r = 2 the function should return the list (-1, 1, 2]. Write a function new (f, df, x0) which implements Newton's method to identify a root of the function f whose first derivative is given by the function df, with the starting value being given by xo. Put together your answers from Questions 1-4 to write a function roots (a) which attempts to locate all of the roots of the polynomial given by p(x) = ,". i=0 You may assume that all of the roots of p(x) are real. Your function should be prepared to handle cases where Newton's method does not converge, and retry with several different initial values. Extend your routine from Question 5 to also be capable of handling polynomials with complex roots. Hint: In Python complex numbers can be specified as y = 3 + 2J with the imaginary part being suffixed by JStep by Step Solution
There are 3 Steps involved in it
Step: 1
To complete the question we need to break it down into parts and implement the required functions Le...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started