我是ipython的新手 . 我在ipython中有这段代码
def derivative(x):
return 3*(x^2)
derivative_estimate = lambda x: difference_quotient(cube, x, h=0.00001)
x = range(-10, 10)
import matplotlib.pyplot as plt
plt.title("Actual Derivatives vs Estimates")
x = range(-10,10)
plt.plot(x, map(derivative, x), 'rx', label = 'Actual') # red x
plt.plot(x, map(derivative_estimate, x), 'b+', label = 'Estimate') # blue +
plt.show()
当我尝试运行它时,它会向我显示这些错误
ValueError Traceback (most recent call last)
in ()
6 plt.title("Actual Derivatives vs Estimates")
7 x = range(-10,10)
----> 8 plt.plot(x, map(derivative, x), 'rx') # red x
9 plt.plot(x, map(derivative_estimate, x), 'b+') # blue +
10 plt.show()
C:\Users\