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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

5act2 Please help me code in python programming.

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
*+)-f(*) and finding the limit as a gets closer and closer to zero (0). Start by using
a
a value for a of 0.1. Then, divide a by 2 repeatedly until the difference between two successive
evaluations of -
f(x+a)-f(x)
is less than a tolerance of 10*. Use the same polynomial and value of
a
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.
Repeat the above numerical erivative by evaluating the limits of the following expressions:
f(x)-f(x-a)
and *+a)-f(x-c
Compute each of these, and output the results using the format
a
2a
shown below. Do you get difi rent results with any of them? Add a comment in your code to
answer the question.
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
Transcribed Image Text: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 *+)-f(*) and finding the limit as a gets closer and closer to zero (0). Start by using a a value for a of 0.1. Then, divide a by 2 repeatedly until the difference between two successive evaluations of - f(x+a)-f(x) is less than a tolerance of 10*. Use the same polynomial and value of a 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. Repeat the above numerical erivative by evaluating the limits of the following expressions: f(x)-f(x-a) and *+a)-f(x-c Compute each of these, and output the results using the format a 2a shown below. Do you get difi rent results with any of them? Add a comment in your code to answer the question. 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education