Activity #2: Taking limits to compute derivatives Write a program named Lab5a_Act2.py to compute a derivative as a numerical limit. This activity has three parts. Please separate the various parts of your code with a comment to identify the separate sections. a) Evaluating a polynomial Write a program that takes as input from the user a set of four (4) coefficients for a cubic polynomial of the form f(x) = Ax² + Bx² + Cx + D Next, take as input from the user a value for x, and evaluate the polynomial at that x. b) Evaluating a polynomial limit analytically In your calculus class, you should have learned by now how to find the derivative of a polynomial (as another polynomial). If you are struggling with how to find a derivative, ask a member of the teaching team for help. Add to your program code to compute the derivative of a polynomial (i.e. compute the three coefficients of the derivative f'(x)) using the same coefficients and value of x as you used in part a. c) Evaluating a polynomial derivative numerically For a function f(x), the numerical derivative of the function at a value x can be found by evaluating **a)-/ and finding the limit as a gets closer and closer to zero (0). Start by using a value for a of 0.1. Then, divide a by 2 repeatedly until the difference between two successive evaluations of **a)-/¥) is less than a tolerance of 10". Use the same polynomial and value of x as you used in part a, and compute the limit numerically. Taking numerical derivatives like this is commonly done when fun ions are too complicated to evaluate analytically. a Repeat the above numerical erivative by evaluating the limits of the following expressions: f(K) –f (x=a) and /(x+a)-f(x=a Compute each of these, and output the results using the format shown below. Do you get difi rent results with any of them? Add a comment in your code to answer the question. 2a Use six (6) decimal places to print the umerical derivatives. Example output using 2x³ + 3x² – 1 x – 6 = 0 and x = -2: Enter the coefficient A: - Enter the coefficient B: 3 Enter the coefficient C: -11 Enter the coefficient D: -6 Enter a value for x: -2 f(-2.0) is 12.0 f'(-2.0) analytically is 1.0 f'(-2.0) numerically is 0.999999 f' (-2.0) numerically is 1.000001 f'(-2.0) numerically is 1.000000
Activity #2: Taking limits to compute derivatives Write a program named Lab5a_Act2.py to compute a derivative as a numerical limit. This activity has three parts. Please separate the various parts of your code with a comment to identify the separate sections. a) Evaluating a polynomial Write a program that takes as input from the user a set of four (4) coefficients for a cubic polynomial of the form f(x) = Ax² + Bx² + Cx + D Next, take as input from the user a value for x, and evaluate the polynomial at that x. b) Evaluating a polynomial limit analytically In your calculus class, you should have learned by now how to find the derivative of a polynomial (as another polynomial). If you are struggling with how to find a derivative, ask a member of the teaching team for help. Add to your program code to compute the derivative of a polynomial (i.e. compute the three coefficients of the derivative f'(x)) using the same coefficients and value of x as you used in part a. c) Evaluating a polynomial derivative numerically For a function f(x), the numerical derivative of the function at a value x can be found by evaluating **a)-/ and finding the limit as a gets closer and closer to zero (0). Start by using a value for a of 0.1. Then, divide a by 2 repeatedly until the difference between two successive evaluations of **a)-/¥) is less than a tolerance of 10". Use the same polynomial and value of x as you used in part a, and compute the limit numerically. Taking numerical derivatives like this is commonly done when fun ions are too complicated to evaluate analytically. a Repeat the above numerical erivative by evaluating the limits of the following expressions: f(K) –f (x=a) and /(x+a)-f(x=a Compute each of these, and output the results using the format shown below. Do you get difi rent results with any of them? Add a comment in your code to answer the question. 2a Use six (6) decimal places to print the umerical derivatives. Example output using 2x³ + 3x² – 1 x – 6 = 0 and x = -2: Enter the coefficient A: - Enter the coefficient B: 3 Enter the coefficient C: -11 Enter the coefficient D: -6 Enter a value for x: -2 f(-2.0) is 12.0 f'(-2.0) analytically is 1.0 f'(-2.0) numerically is 0.999999 f' (-2.0) numerically is 1.000001 f'(-2.0) numerically is 1.000000
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
Related questions
Question
100%
5act2 Please help me code in python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,