m0_73659947 2022-09-10 20:39 采纳率: 100%
浏览 39
已结题

编写程序多项式f(x)

编写程序绘制多项式fx)
及其导两数的图像,多项式
如下:
f(x) = 415 - 1023 + 72 + 2-2 + 10.

img

  • 写回答

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()
    

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 9月18日
  • 已采纳回答 9月10日
  • 创建了问题 9月10日