编写程序绘制多项式fx)
及其导两数的图像,多项式
如下:
f(x) = 415 - 1023 + 72 + 2-2 + 10.
1条回答 默认 最新
- 正在学C++ 2022-09-10 22:22关注
import matplotlib.pyplot as plt import numpy as np def f(x): return 4.0*np.power(x,5)-10*np.power(x,3)+7*x+np.power(x,-2)+10 def df(x): return 20.0*np.power(x,4)-30*np.power(x,2)+7-2*np.power(x,-3) x = np.arange(-10, 10, 0.3) plt.figure(dpi=100,figsize=(10,7)) plt.plot(x,f(x),label='f(x)') plt.plot(x,df(x), label='df(x)') plt.xlim(-10, 10) plt.xlabel("x") plt.ylabel("y") plt.legend() plt.show()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报