Question: Q . Consider the following polynomial with a real variable, x ; p ( x ) = 3 x 3 - 5 x 2 -

Q. Consider the following polynomial with a real variable, x;
p(x)=3x3-5x2-16x+12
The polynomial and its root are shown in the figure below.
a.(15 points) Write a Python function for p(x) that takes x as a formal
parameter and returns p(x).
b.(15 points) Write a Python function for the derivative of p(x) that takes x as
a formal parameter and returns the derivative of p(x). Take the derivative of
p(x) analytically with respect to x before writing the function.
c.(45 points) Write a Python function for root finding using the Newton-
Raphson method that takes an initial guess, x0, as a formal parameter, and
returns its root, xr, of p(x) such that p(xr)0. At each iteration, the function is
expected to print the iteration number, the new guess and the absolute
value of p(x) at the guess. Iterations should stop when the absolute value
of p(x) at a new guess is less than 10-6. The function will return that guess
as xr.
d.(25 points) Write a main program that will get the initial guess, x0, from a
user using the input statement, and call the functions developed earlier as
needed to find the root of the polynomial. It should call the function
developed for question 1.b to find the root. The program is supposed to print
the root right after locating it.
Q . Consider the following polynomial with a real

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!