Question: ****** USING PYTHON 3.7 ******** As the question states, work from the previous problem is needed. Below is the code that I wrote to assist
****** USING PYTHON 3.7 ********

As the question states, work from the previous problem is needed. Below is the code that I wrote to assist with assisting me with part b. This will simply show that the part b is to use the same values that the user entered in the previous code (i.e., keep those values of A, B, C, D, and x. Thank you so much in advance!
print("This code finds the roots of a cubic polynomial")
# Take inputs for 4 coefficients from user A = float(input("Input a value for coefficient A: ")) B = float(input("Input a value for coefficient B: ")) C = float(input("Input a value for coefficient C: ")) D = float(input("Input a value for coefficient D: ")) print() # in order to display cubic polynomial correctly, code will need to account for # both positive and negative values
if B > 0: sign_B = ("+") if B
if C > 0: sign_C = ("+") if C
if D > 0: sign_D = ("+") if D
print("The initial cubic polynomial is", A,"x^3", sign_B,B,"x^2", sign_C, C, "x", sign_D, D) print()
# find derivative # while also accounting for both positive and negative values
A_prime = 3 * A B_prime = 2 * B if B_prime > 0: sign_B_prime = ("+") if B_prime
C_prime = C if C_prime > 0: sign_C_prime = ("+") if C_prime
print("The derivative of the function is", A_prime,"x^2", sign_B_prime,B_prime,"x", sign_C_prime, C_prime) print()
a b) Evaluating a polynomial derivative numerically For a function f(x), the derivative of the function at a value x can be found by evaluating and finding the limit as a gets closer and closer to 0. Using the same polynomial as the user entered in part (a), and for the same value of x as entered in part (a), compute the limit numerically. That is, start with an estimate by evaluating using a value for a such as 0.1. Then, repeatedly halve the value of a until the difference between successive evaluations of 7 is less than some small value, such as 10%. Print the result, along with the number ased upon Dr. Keyser's Original Revised Summer 2019 TLF Lab Assignment #5a of evaluations it took. Calculate how close that result is to the actual answer, computed in part (a). Repeat the above activity by evaluating the limits of the following expressions: ions. f(x)-f(x-a) or ". Try computing each of those, and calculate how many iterations you need to 2a converge to the limit. Do you get different results with any of them, or does any of them take fewer steps to get an answer? (Put your answer as a comment in your code.) a b) Evaluating a polynomial derivative numerically For a function f(x), the derivative of the function at a value x can be found by evaluating and finding the limit as a gets closer and closer to 0. Using the same polynomial as the user entered in part (a), and for the same value of x as entered in part (a), compute the limit numerically. That is, start with an estimate by evaluating using a value for a such as 0.1. Then, repeatedly halve the value of a until the difference between successive evaluations of 7 is less than some small value, such as 10%. Print the result, along with the number ased upon Dr. Keyser's Original Revised Summer 2019 TLF Lab Assignment #5a of evaluations it took. Calculate how close that result is to the actual answer, computed in part (a). Repeat the above activity by evaluating the limits of the following expressions: ions. f(x)-f(x-a) or ". Try computing each of those, and calculate how many iterations you need to 2a converge to the limit. Do you get different results with any of them, or does any of them take fewer steps to get an answer? (Put your answer as a comment in your code.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
