Find the n-th derivative of a function at point x0.
Given a function, use a central difference formula with spacing dx to compute the n-th derivative at x0.
Parameters : | func : function
x0 : float
dx : int, optional
n : int, optional
args : tuple, optional
order : int, optional
|
---|
Notes
Decreasing the step size too small can result in round-off error.
Examples
>>> def x2(x):
... return x*x
...
>>> derivative(x2, 2)
4.0