Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education