联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> 数据库数据库

日期:2023-02-05 08:03

BU MET CS-550: Comp. Math. for Data Analytics, v.1.0 Homework: Derivatives
Homework
Problem 1. Plot both the function f(·), its derivative f′(·), and the values of both at point x = 1 on the same plot for each of the following functions (take ?3 ≤ x ≤ 3):
1. f(x) = 1 ?→ f′(x) = 0
2. f(x) = x ?→ f′(x) = 1
3.f(x)=x2 ?→f′(x)=2x
4.f(x)=xn ?→f′(x)=nxn?1, forn=3 5. f(x) = √x ?→ f′(x) = 1/(2√x) 6.f(x)=ex ?→f′(x)=ex
7. f(x) = 2x ?→ f′(x) = (log a)ax
8. f(x) = logx ?→ f′(x) = 1/x
9. f(x) = sinx ?→ f′(x) = cos(x)
10. f(x) = cosx ?→ f′(x) = ?sin(x)
Color curves for f in green and curves for f′ in red, values for f(x = 1) and f′(x = 1) in black.
Page 0

BU MET CS-550: Comp. Math. for Data Analytics, v.1.0 Homework: Derivatives
Problem 2. derive the formulas for the first 4 functions in Problem 1.
Problem 3. read and install the ”sympy” Python package https://scipy-lectures.org/packages/sympy.html
Read the section on calculus (differentiation) and use the ”sympy” Python package to compute derivatives for each function in Problem 1.
Problem 4. for each of 10 functions in problem 1, write a script to compute f′(x = 1) using numerical differentiation with forward, backward and central differences for △x = 0.2. Summarize your results (rounded to 4 decimal digits) in the table as shown. For each row, color the closest value to exact in green and the furthest value in red. Discuss your findings.
Problem 5. for each of 10 functions in problem 1, write a script to compute the relative error (as percentage compared to the exact value) of computing derivatives f′(x = 1 using numerical differentiation with forward, backward and central differences for △x = 0.2. Summarize your results (rounded to 2 decimal digits) in the second table similar to the first one,
Page 1

BU MET CS-550: Comp. Math. for Data Analytics, v.1.0 Homework: Derivatives
Table 1: A Comparison of Derivatives
function
f(x)
1
x x2
···
···
cos(x)
forward
f(x+△x)?f(x) △x
backward
f(x)?f(x?△x) △x
central
f(x+△x)?f(x?△x) 2△x
exact f′(x = 1)
but with relative errors. Examine your table and discuss your findings
Page 2

相关文章

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。