编写程序多项式f(x)

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

img

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