scipy.misc.derivative(func, x0, dx=1.0, n=1, args=(), order=3)
func
: function
x0
: float
dx
: float, optional(float类型数据,可选参数)
n
: int, optional
args
: tuple, optional
order
: int, optional
>>> from scipy.misc import derivative
>>> def f(x):
... return x**3 + x**2
>>> derivative(f, 1.0, dx=1e-6)
4.9999999999217337
参考链接:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.derivative.html